gamemode: Only show the selection halo for Hiders

The selection halo was previously visible to everyone in approximate mode, which caused more issues than it should have.
This commit is contained in:
Michael Fabian 'Xaymar' Dirks
2017-11-26 04:26:23 +01:00
parent 624fc3968e
commit 677ff7b529
@@ -232,45 +232,48 @@ hook.Add("PostDrawTranslucentRenderables", "PHDrawNamePlates", DrawNamePlates)
function DrawSelectionHalo(bDrawingDepth, bDrawingSkybox) function DrawSelectionHalo(bDrawingDepth, bDrawingSkybox)
if (!GAMEMODE.Config.SelectionHalo:Enabled()) then return end if (!GAMEMODE.Config.SelectionHalo:Enabled()) then return end
local ent = nil if ((LocalPlayer():Team() == GAMEMODE.Teams.Hiders)
if (GAMEMODE.Config.SelectionHalo:Approximate()) then && (player_manager.GetPlayerClass(LocalPlayer()) == "Hider")) then
local trace = { local ent = nil
start = LocalPlayer():EyePos(), if (GAMEMODE.Config.SelectionHalo:Approximate()) then
endpos = LocalPlayer():EyePos() + LocalPlayer():EyeAngles():Forward() * 80, local trace = {
mins = Vector(-16, -16, -16), start = LocalPlayer():EyePos(),
maxs = Vector( 16, 16, 16), endpos = LocalPlayer():EyePos() + LocalPlayer():EyeAngles():Forward() * 80,
mask = MASK_SOLID + CONTENTS_DEBRIS + CONTENTS_PLAYERCLIP, mins = Vector(-16, -16, -16),
filter = function(ent) maxs = Vector( 16, 16, 16),
-- Ensure that we don't actually hit ourselves by accident, or our "hands" model. mask = MASK_SOLID + CONTENTS_DEBRIS + CONTENTS_PLAYERCLIP,
if (!IsValid(ent) filter = function(ent)
|| (ent == LocalPlayer()) -- Ensure that we don't actually hit ourselves by accident, or our "hands" model.
|| (ent == LocalPlayer():GetHands())) then if (!IsValid(ent)
|| (ent == LocalPlayer())
|| (ent == LocalPlayer():GetHands())) then
return false
end
if table.HasValue(GAMEMODE.Config.Lists:ClassWhitelist(), ent:GetClass()) then return true end
return false return false
end end,
if table.HasValue(GAMEMODE.Config.Lists:ClassWhitelist(), ent:GetClass()) then return true end output = {}
return false }
end, util.TraceLine(trace)
output = {} if !IsValid(trace.output.Entity) then util.TraceHull(trace) end
} if IsValid(trace.output.Entity) then
util.TraceLine(trace) if (!table.HasValue(GAMEMODE.Config.Lists:ModelBlacklist(), trace.output.Entity:GetModel())) then
if !IsValid(trace.output.Entity) then util.TraceHull(trace) end ent = trace.output.Entity
if IsValid(trace.output.Entity) then end
if (!table.HasValue(GAMEMODE.Config.Lists:ModelBlacklist(), trace.output.Entity:GetModel())) then end
ent = trace.output.Entity else
end ent = LocalPlayer():GetNWEntity("SelectionHalo")
end end
else if IsValid(ent) then
ent = LocalPlayer():GetNWEntity("SelectionHalo") local color = HSVToColor(
end GAMEMODE.Config.SelectionHalo:TintHue(),
if IsValid(ent) then GAMEMODE.Config.SelectionHalo:TintSaturation(),
local color = HSVToColor( GAMEMODE.Config.SelectionHalo:TintValue()
GAMEMODE.Config.SelectionHalo:TintHue(), )
GAMEMODE.Config.SelectionHalo:TintSaturation(), halo.Add({ ent }, color,
GAMEMODE.Config.SelectionHalo:TintValue() GAMEMODE.Config.SelectionHalo:BlurX(), GAMEMODE.Config.SelectionHalo:BlurY(), GAMEMODE.Config.SelectionHalo:Passes(),
) GAMEMODE.Config.SelectionHalo:Additive(), GAMEMODE.Config.SelectionHalo:IgnoreZ())
halo.Add({ ent }, color, end
GAMEMODE.Config.SelectionHalo:BlurX(), GAMEMODE.Config.SelectionHalo:BlurY(), GAMEMODE.Config.SelectionHalo:Passes(),
GAMEMODE.Config.SelectionHalo:Additive(), GAMEMODE.Config.SelectionHalo:IgnoreZ())
end end
end end
hook.Add("PostDrawEffects", "PHDrawSelectionHalo", DrawSelectionHalo) hook.Add("PostDrawEffects", "PHDrawSelectionHalo", DrawSelectionHalo)