base_shutdown: Fix security clips not being defined and add support for toggling multiple clips with the same name

This commit is contained in:
squeek 2014-12-01 17:39:07 -08:00
parent 076b54ebf4
commit 3c7a7e7426

View file

@ -41,13 +41,17 @@ function security_off( team )
OutputEvent(team.."_security_hurt", "Disable") OutputEvent(team.."_security_hurt", "Disable")
OutputEvent(team.."_laser_hurt", "Disable") -- a possible alias OutputEvent(team.."_laser_hurt", "Disable") -- a possible alias
-- get the clip entity -- get the clip entities
local clip = GetEntityByName(team.."_security_clip") local clips = Collection()
local clipname = team.."_security_clip"
clips:GetByName({clipname})
if clip then for clip in clips.items do
clip = CastToTriggerClip(clip) clip = CastToTriggerClip(clip)
-- clear flags, but send a dummy flag (for some reason with zero flags it blocks everything) if clip and _G[clipname] and _G[clipname].clipflags then
clip:SetClipFlags({ClipFlags.kClipTeamBlue}) -- clear flags, but send a dummy flag (for some reason with zero flags it blocks everything)
clip:SetClipFlags({ClipFlags.kClipTeamBlue})
end
end end
end end
@ -59,13 +63,17 @@ function security_on( team )
OutputEvent(team.."_security_hurt", "Enable") OutputEvent(team.."_security_hurt", "Enable")
OutputEvent(team.."_laser_hurt", "Enable") -- a possible alias OutputEvent(team.."_laser_hurt", "Enable") -- a possible alias
-- get the clip entity -- get the clip entities
local clip = GetEntityByName(team.."_security_clip") local clips = Collection()
local clipname = team.."_security_clip"
clips:GetByName({clipname})
if clip then for clip in clips.items do
clip = CastToTriggerClip(clip) clip = CastToTriggerClip(clip)
-- reset flags to normal if clip and _G[clipname] and _G[clipname].clipflags then
clip:SetClipFlags(_G[clipname].clipflags) -- reset flags to normal
clip:SetClipFlags(_G[clipname].clipflags)
end
end end
end end
@ -234,6 +242,13 @@ blue_security_hurt = not_blue_trigger:new({})
red_laser_hurt = red_security_hurt red_laser_hurt = red_security_hurt
blue_laser_hurt = blue_security_hurt blue_laser_hurt = blue_security_hurt
-----------------------------------------------------------------------------
-- Clips
-----------------------------------------------------------------------------
red_security_clip = clip_red:new()
blue_security_clip = clip_blue:new()
------------------------- -------------------------
-- flaginfo -- flaginfo
------------------------- -------------------------