Added "Display Time" functions to ZS notifications
Mappers can now specify how long a HUD message lasts on screen in seconds.
This commit is contained in:
parent
81820d6e8b
commit
65534fbadf
3 changed files with 25 additions and 7 deletions
|
@ -2,6 +2,7 @@ ENT.Type = "point"
|
||||||
|
|
||||||
function ENT:Initialize()
|
function ENT:Initialize()
|
||||||
self.SendTo = self.SendTo or -1
|
self.SendTo = self.SendTo or -1
|
||||||
|
self.DisplayTime = self.DisplayTime or GAMEMODE.NotifyFadeTime
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:Think()
|
function ENT:Think()
|
||||||
|
@ -16,18 +17,18 @@ function ENT:AcceptInput(name, caller, activator, args)
|
||||||
args = string.gsub(args, "</.->", "")
|
args = string.gsub(args, "</.->", "")
|
||||||
|
|
||||||
if self.SendTo == 0 then
|
if self.SendTo == 0 then
|
||||||
GAMEMODE:CenterNotifyAll(args)
|
GAMEMODE:CenterNotifyAll(args,{CustomTime = self.DisplayTime})
|
||||||
elseif self.SendTo == -1 then
|
elseif self.SendTo == -1 then
|
||||||
for _, pl in pairs(player.GetAll()) do
|
for _, pl in pairs(player.GetAll()) do
|
||||||
if pl == activator or pl == caller then
|
if pl == activator or pl == caller then
|
||||||
pl:CenterNotify(args)
|
pl:CenterNotify(args,{CustomTime = self.DisplayTime})
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
for _, pl in pairs(player.GetAll()) do
|
for _, pl in pairs(player.GetAll()) do
|
||||||
if pl:Team() == self.SendTo then
|
if pl:Team() == self.SendTo then
|
||||||
pl:CenterNotify(args)
|
pl:CenterNotify(args,{CustomTime = self.DisplayTime})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -41,6 +42,8 @@ function ENT:AcceptInput(name, caller, activator, args)
|
||||||
SetGlobalString("hudoverride"..TEAM_UNDEAD, "")
|
SetGlobalString("hudoverride"..TEAM_UNDEAD, "")
|
||||||
elseif name == "clearhumanhudmessage" or name == "clearsurvivorhudmessage" then
|
elseif name == "clearhumanhudmessage" or name == "clearsurvivorhudmessage" then
|
||||||
SetGlobalString("hudoverride"..TEAM_HUMAN, "")
|
SetGlobalString("hudoverride"..TEAM_HUMAN, "")
|
||||||
|
elseif name == "setdisplaytime" then
|
||||||
|
self.DisplayTime = tonumber(args)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -57,5 +60,7 @@ function ENT:KeyValue(key, value)
|
||||||
else
|
else
|
||||||
self.SendTo = 0
|
self.SendTo = 0
|
||||||
end
|
end
|
||||||
|
elseif key == "displaytime" then
|
||||||
|
self.DisplayTime = tonumber(value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -160,12 +160,23 @@ function PANEL:AddNotification(...)
|
||||||
|
|
||||||
notif:Dock(TOP)
|
notif:Dock(TOP)
|
||||||
|
|
||||||
|
local args = {...}
|
||||||
|
|
||||||
|
local FadeTime = GAMEMODE.NotifyFadeTime
|
||||||
|
|
||||||
|
for k, v in pairs(args) do
|
||||||
|
if type(v) == "table" and v.CustomTime and type(v.CustomTime == "number") then
|
||||||
|
FadeTime = v.CustomTime
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
notif:SetAlpha(1)
|
notif:SetAlpha(1)
|
||||||
notif:AlphaTo(255, 0.5)
|
notif:AlphaTo(255, 0.5)
|
||||||
notif:AlphaTo(1, 1, GAMEMODE.NotifyFadeTime - 1)
|
notif:AlphaTo(1, 1, FadeTime - 1)
|
||||||
|
|
||||||
notif.DieTime = CurTime() + GAMEMODE.NotifyFadeTime
|
notif.DieTime = CurTime() + FadeTime
|
||||||
|
|
||||||
return notif
|
return notif
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -635,6 +635,7 @@
|
||||||
"private" : "Activator Only"
|
"private" : "Activator Only"
|
||||||
"all" : "All"
|
"all" : "All"
|
||||||
]
|
]
|
||||||
|
displaytime(integer) : "Display Time (centre message only)" : 8 : "How long the input message displays for, does not have an effect on HUD messages."
|
||||||
|
|
||||||
// Inputs
|
// Inputs
|
||||||
input message(string) : "What to display. Supports the markup library."
|
input message(string) : "What to display. Supports the markup library."
|
||||||
|
@ -642,6 +643,7 @@
|
||||||
input setzombiehudmessage(string) : "Set a message to display in the zombie wave hud."
|
input setzombiehudmessage(string) : "Set a message to display in the zombie wave hud."
|
||||||
input clearhumanhudmessage(void) : "Clear the message to display in the human wave hud."
|
input clearhumanhudmessage(void) : "Clear the message to display in the human wave hud."
|
||||||
input clearzombiehudmessage(void) : "Clear the message to display in the zombie wave hud."
|
input clearzombiehudmessage(void) : "Clear the message to display in the zombie wave hud."
|
||||||
|
input setdisplaytime(integer) : "Change how long the input message displays for."
|
||||||
]
|
]
|
||||||
|
|
||||||
@PointClass base(Targetname) = logic_pantsmode : "ZS: When activated, this will set the special Pants Mode on."
|
@PointClass base(Targetname) = logic_pantsmode : "ZS: When activated, this will set the special Pants Mode on."
|
||||||
|
|
Loading…
Reference in a new issue