mirror of
https://github.com/wiremod/wire.git
synced 2025-03-04 03:03:04 -05:00
Fix issues involving math.tau (#3054)
* Tau fallback value * Change error to WireLib.Notify and add context * Add antispam to WireLib.Notify on the client * Change tau to use mathematically calculated always 1. It's defined like this in the math extension 2. Since I'm already going through the effort of reincluding its literal definition I may as well have it by default * fix time calc Co-authored-by: thegrb93 <grbrown93@sbcglobal.net> --------- Co-authored-by: thegrb93 <grbrown93@sbcglobal.net>
This commit is contained in:
parent
6917a31eb9
commit
337214d938
@ -212,7 +212,10 @@ function E2Lib.registerConstant(name, value, description)
|
||||
extension = E2Lib.currentextension
|
||||
}
|
||||
else
|
||||
error("Invalid value passed to registerConstant. Only numbers, strings, vectors, angles and arrays can be constant values.")
|
||||
local db = debug.getinfo(2, "l")
|
||||
WireLib.Notify(nil,
|
||||
string.format("[%s]:%d: Invalid value passed to registerConstant for \"%s\". Only numbers, strings, vectors, angles and arrays can be constant values.\n", E2Lib.currentextension, db.currentline, name),
|
||||
3)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -44,7 +44,7 @@ E2Lib.registerConstant("PI", pi)
|
||||
E2Lib.registerConstant("INF", inf)
|
||||
E2Lib.registerConstant("E", exp(1))
|
||||
E2Lib.registerConstant("PHI", (1+sqrt(5))/2)
|
||||
E2Lib.registerConstant("TAU", math.tau)
|
||||
E2Lib.registerConstant("TAU", math.pi * 2)
|
||||
|
||||
--[[************************************************************************]]--
|
||||
|
||||
|
@ -262,6 +262,8 @@ local severity2word = {
|
||||
[3] = "error"
|
||||
}
|
||||
|
||||
local notify_antispam = 0 -- Used to avoid spamming sounds to the player
|
||||
|
||||
--- Sends a colored message to the player's chat.
|
||||
--- When used serverside, setting the player as nil will only inform the server.
|
||||
--- When used clientside, the first argument is ignored and only the local player is informed.
|
||||
@ -279,7 +281,9 @@ local function notify(ply, msg, severity, chatprint, color)
|
||||
chat.PlaySound()
|
||||
else
|
||||
MsgC(unpack(WireLib.NotifyBuilder(msg, severity, color)))
|
||||
if severity > 1 then
|
||||
local time = CurTime()
|
||||
if severity > 1 and notify_antispam < time then
|
||||
notify_antispam = time + 1
|
||||
notification.AddLegacy(string.format("Wiremod %s! Check your console for details", severity2word[severity]), NOTIFY_ERROR, 5)
|
||||
surface.PlaySound(severity == 3 and "vo/k_lab/kl_fiddlesticks.wav" or "buttons/button22.wav")
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user