Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 677ff7b529 | |||
| 624fc3968e | |||
| eb3b7f3aef | |||
| 785f55a017 | |||
| 2691ca4e46 | |||
| 8413d8e08e | |||
| 5a4791a097 |
@@ -230,26 +230,57 @@ function DrawNamePlates(bDrawingDepth, bDrawingSkybox)
|
|||||||
end
|
end
|
||||||
hook.Add("PostDrawTranslucentRenderables", "PHDrawNamePlates", DrawNamePlates)
|
hook.Add("PostDrawTranslucentRenderables", "PHDrawNamePlates", DrawNamePlates)
|
||||||
|
|
||||||
|
function DrawSelectionHalo(bDrawingDepth, bDrawingSkybox)
|
||||||
|
if (!GAMEMODE.Config.SelectionHalo:Enabled()) then return end
|
||||||
|
if ((LocalPlayer():Team() == GAMEMODE.Teams.Hiders)
|
||||||
|
&& (player_manager.GetPlayerClass(LocalPlayer()) == "Hider")) then
|
||||||
|
local ent = nil
|
||||||
|
if (GAMEMODE.Config.SelectionHalo:Approximate()) then
|
||||||
|
local trace = {
|
||||||
|
start = LocalPlayer():EyePos(),
|
||||||
|
endpos = LocalPlayer():EyePos() + LocalPlayer():EyeAngles():Forward() * 80,
|
||||||
|
mins = Vector(-16, -16, -16),
|
||||||
|
maxs = Vector( 16, 16, 16),
|
||||||
|
mask = MASK_SOLID + CONTENTS_DEBRIS + CONTENTS_PLAYERCLIP,
|
||||||
|
filter = function(ent)
|
||||||
|
-- Ensure that we don't actually hit ourselves by accident, or our "hands" model.
|
||||||
|
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
|
||||||
|
end,
|
||||||
|
output = {}
|
||||||
|
}
|
||||||
|
util.TraceLine(trace)
|
||||||
|
if !IsValid(trace.output.Entity) then util.TraceHull(trace) end
|
||||||
|
if IsValid(trace.output.Entity) then
|
||||||
|
if (!table.HasValue(GAMEMODE.Config.Lists:ModelBlacklist(), trace.output.Entity:GetModel())) then
|
||||||
|
ent = trace.output.Entity
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
ent = LocalPlayer():GetNWEntity("SelectionHalo")
|
||||||
|
end
|
||||||
|
if IsValid(ent) then
|
||||||
|
local color = HSVToColor(
|
||||||
|
GAMEMODE.Config.SelectionHalo:TintHue(),
|
||||||
|
GAMEMODE.Config.SelectionHalo:TintSaturation(),
|
||||||
|
GAMEMODE.Config.SelectionHalo:TintValue()
|
||||||
|
)
|
||||||
|
halo.Add({ ent }, color,
|
||||||
|
GAMEMODE.Config.SelectionHalo:BlurX(), GAMEMODE.Config.SelectionHalo:BlurY(), GAMEMODE.Config.SelectionHalo:Passes(),
|
||||||
|
GAMEMODE.Config.SelectionHalo:Additive(), GAMEMODE.Config.SelectionHalo:IgnoreZ())
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
hook.Add("PostDrawEffects", "PHDrawSelectionHalo", DrawSelectionHalo)
|
||||||
|
|
||||||
-- ------------------------------------------------------------------------- --
|
-- ------------------------------------------------------------------------- --
|
||||||
--! Old Code
|
--! Old Code
|
||||||
-- ------------------------------------------------------------------------- --
|
-- ------------------------------------------------------------------------- --
|
||||||
--[[
|
--[[
|
||||||
function DrawPlayerHalos(bDrawingDepth, bDrawingSkybox)
|
|
||||||
for i,v in ipairs(player.GetAll()) do
|
|
||||||
if v:Alive() then
|
|
||||||
local pos = v:GetPos() + Vector(0, 0, 1) * (v:OBBMaxs().z - v:OBBMins().z + 5)
|
|
||||||
local ang = Angle(0, LocalPlayer():EyeAngles().y - 90, 90 - LocalPlayer():EyeAngles().x)
|
|
||||||
local healthPrc = v:Health() / v:GetMaxHealth()
|
|
||||||
local healthCol = HSVToColor(120 * healthPrc, 1.0, 1.0)
|
|
||||||
|
|
||||||
if v:Team() == TEAM_HUNTERS || LocalPlayer():Team() == TEAM_PROPS then
|
|
||||||
local ent = v
|
|
||||||
if v.ph_prop && v.ph_prop:IsValid() then ent = v.ph_prop end
|
|
||||||
|
|
||||||
halo.Add({ent}, healthCol, 2, 2, 1)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
--hook.Add("PostDrawEffects", "PH_DrawPlayerHalos", DrawPlayerHalos)
|
|
||||||
]]
|
]]
|
||||||
@@ -41,9 +41,6 @@ function CompatTauntPackLoader()
|
|||||||
Taunts[#Taunts+1] = t
|
Taunts[#Taunts+1] = t
|
||||||
elseif (ty == "table") then
|
elseif (ty == "table") then
|
||||||
Taunts[#Taunts+1] = t[1]
|
Taunts[#Taunts+1] = t[1]
|
||||||
-- for j,snd in ipairs(t) do
|
|
||||||
-- HiderTaunts[#HiderTaunts+1] = snd
|
|
||||||
-- end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
GAMEMODE.Config.Taunt.HidersCacheStatic = Taunts
|
GAMEMODE.Config.Taunt.HidersCacheStatic = Taunts
|
||||||
@@ -54,9 +51,6 @@ function CompatTauntPackLoader()
|
|||||||
Taunts[#Taunts+1] = t
|
Taunts[#Taunts+1] = t
|
||||||
elseif (ty == "table") then
|
elseif (ty == "table") then
|
||||||
Taunts[#Taunts+1] = t[1]
|
Taunts[#Taunts+1] = t[1]
|
||||||
-- for j,snd in ipairs(t) do
|
|
||||||
-- SeekerTaunts[#SeekerTaunts+1] = snd
|
|
||||||
-- end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
GAMEMODE.Config.Taunt.SeekersCacheStatic = Taunts
|
GAMEMODE.Config.Taunt.SeekersCacheStatic = Taunts
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
-- ------------------------------------------------------------------------- --
|
-- ------------------------------------------------------------------------- --
|
||||||
-- Shared
|
-- Shared
|
||||||
AddCSLuaFile("sh_init.lua")
|
AddCSLuaFile("sh_init.lua")
|
||||||
|
AddCSLuaFile("meta/player.lua")
|
||||||
AddCSLuaFile("sh_config.lua")
|
AddCSLuaFile("sh_config.lua")
|
||||||
AddCSLuaFile("player_class/class_default.lua")
|
AddCSLuaFile("player_class/class_default.lua")
|
||||||
AddCSLuaFile("player_class/class_spectator.lua")
|
AddCSLuaFile("player_class/class_spectator.lua")
|
||||||
|
|||||||
@@ -0,0 +1,259 @@
|
|||||||
|
--[[
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2017 Xaymar
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
--]]
|
||||||
|
|
||||||
|
-- Finds the player meta table or terminates
|
||||||
|
local meta = FindMetaTable("Player")
|
||||||
|
if !meta then print("FAILED TO FIND PLAYER META") return end
|
||||||
|
|
||||||
|
-- Blinds the player by setting view out into the void
|
||||||
|
function meta:Blind(bool)
|
||||||
|
if !self:IsValid() then return end
|
||||||
|
|
||||||
|
if SERVER then
|
||||||
|
umsg.Start("SetBlind", self)
|
||||||
|
if bool then
|
||||||
|
umsg.Bool(true)
|
||||||
|
else
|
||||||
|
umsg.Bool(false)
|
||||||
|
end
|
||||||
|
umsg.End()
|
||||||
|
elseif CLIENT then
|
||||||
|
blind = bool
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Blinds the player by setting view out into the void
|
||||||
|
function meta:RemoveProp()
|
||||||
|
if CLIENT || !self:IsValid() then return end
|
||||||
|
|
||||||
|
if self.ph_prop && self.ph_prop:IsValid() then
|
||||||
|
self.ph_prop:Remove()
|
||||||
|
self.ph_prop = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Sets a new Hull for a player.
|
||||||
|
function meta:NewHull(hullOBBMin, hullOBBMax)
|
||||||
|
if !self:IsValid() then return end
|
||||||
|
if hullOBBMax == nil then return end
|
||||||
|
if hullOBBMin == nil then return end
|
||||||
|
|
||||||
|
local hullOBB = hullOBBMax - hullOBBMin
|
||||||
|
local hullOBBXY = math.max(hullOBB.x, hullOBB.y)
|
||||||
|
|
||||||
|
local xyMul = 0.5
|
||||||
|
local hullMin = Vector(-hullOBBXY * xyMul, -hullOBBXY * xyMul, 0)
|
||||||
|
local hullMax = Vector( hullOBBXY * xyMul, hullOBBXY * xyMul, hullOBB.z)
|
||||||
|
|
||||||
|
self:SetHull(hullMin, hullMax)
|
||||||
|
self:SetHullDuck(hullMin, hullMax)
|
||||||
|
self:SetViewOffset(Vector(0, 0, hullOBB.z))
|
||||||
|
self:SetViewOffsetDucked(Vector(0, 0, hullOBB.z / 2.0))
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Can the passed entity be used by the player?
|
||||||
|
function testflag(set, flag)
|
||||||
|
if (flag == 0) then return true end -- Mod(%) by 0 is nan.
|
||||||
|
return (set % (2 * flag)) >= flag
|
||||||
|
end
|
||||||
|
|
||||||
|
function meta:IsUseableEntity(ent, requiredCaps)
|
||||||
|
if ((ent != nil) && (ent:IsValid())) then
|
||||||
|
local caps = ent:ObjectCaps()
|
||||||
|
local capsmask = 16 + 32 + 64 + 128
|
||||||
|
if (testflag(caps, 16)
|
||||||
|
|| testflag(caps, 32)
|
||||||
|
|| testflag(caps, 64)
|
||||||
|
|| testflag(caps, 128)
|
||||||
|
) && testflag(caps, requiredCaps) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
function IntervalDistance(x, x0, x1)
|
||||||
|
-- swap so x0 < x1
|
||||||
|
if ( x0 > x1 ) then
|
||||||
|
local tmp = x0
|
||||||
|
x0 = x1
|
||||||
|
x1 = tmp
|
||||||
|
end
|
||||||
|
|
||||||
|
if ( x < x0 ) then
|
||||||
|
return x0-x
|
||||||
|
elseif ( x > x1 ) then
|
||||||
|
return x - x1
|
||||||
|
end
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Find useable entity (Lua version of CBasePlayer:FindUseEntity)
|
||||||
|
function meta:FindUseEntity()
|
||||||
|
-- https://raw.githubusercontent.com/ValveSoftware/source-sdk-2013/0d8dceea4310fde5706b3ce1c70609d72a38efdf/mp/src/game/shared/baseplayer_shared.cpp
|
||||||
|
local PLAYER_USE_RADIUS = 80
|
||||||
|
|
||||||
|
-- Vectors
|
||||||
|
local forward = self:EyeAngles():Forward()
|
||||||
|
local up = self:EyeAngles():Up()
|
||||||
|
local center = self:EyePos()
|
||||||
|
|
||||||
|
local trace = {
|
||||||
|
start = center,
|
||||||
|
endpos = center,
|
||||||
|
mins = Vector(-16, -16, -16),
|
||||||
|
maxs = Vector( 16, 16, 16),
|
||||||
|
mask = MASK_SOLID + CONTENTS_DEBRIS + CONTENTS_PLAYERCLIP,
|
||||||
|
filter = function(ent)
|
||||||
|
if (ent == self) then return false end
|
||||||
|
if (!ent:IsValid()) then return false end
|
||||||
|
if (ent:IsPlayer()) then return false end
|
||||||
|
if (ent == self:GetHands()) then return false end
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
output = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
local foundEnt = nil
|
||||||
|
local nearestDist = 16777216
|
||||||
|
local nearestEnt = nil
|
||||||
|
|
||||||
|
local tangents_num = 8
|
||||||
|
local tangents = {}
|
||||||
|
tangents[1] = 0
|
||||||
|
tangents[2] = 1
|
||||||
|
tangents[3] = 0.57735026919
|
||||||
|
tangents[4] = 0.3639702342
|
||||||
|
tangents[5] = 0.267949192431
|
||||||
|
tangents[6] = 0.1763269807
|
||||||
|
tangents[7] = -0.1763269807
|
||||||
|
tangents[8] = -0.267949192431
|
||||||
|
for idx=1,tangents_num,1 do
|
||||||
|
if (idx == 1) then
|
||||||
|
trace.endpos = center + forward * 1024
|
||||||
|
util.TraceLine(trace)
|
||||||
|
else
|
||||||
|
local down = forward - (Vector(tangents[idx], tangents[idx], tangents[idx]) * up)
|
||||||
|
down:Normalize()
|
||||||
|
trace.endpos = center + down * 72
|
||||||
|
util.TraceHull(trace)
|
||||||
|
end
|
||||||
|
foundEnt = trace.output.Entity
|
||||||
|
|
||||||
|
local useable = self:IsUseableEntity(foundEnt, 0)
|
||||||
|
while ((foundEnt:IsValid()) && !useable && (foundEnt:GetMoveParent():IsValid())) do
|
||||||
|
foundEnt = foundEnt:GetMoveParent()
|
||||||
|
useable = self:IsUseableEntity(foundEnt, 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
if (useable) then
|
||||||
|
local delta = trace.output.HitPos - trace.output.StartPos
|
||||||
|
local centerZ = foundEnt:WorldSpaceCenter().z
|
||||||
|
delta.z = IntervalDistance(trace.output.HitPos.z, centerZ + foundEnt:OBBMins().z, centerZ + foundEnt:OBBMaxs().z)
|
||||||
|
local dist = delta:Length()
|
||||||
|
if (dist < PLAYER_USE_RADIUS) then
|
||||||
|
if (foundEnt:IsNPC() && (foundEnt:Team() == self:Team())) then
|
||||||
|
foundEnt = self:DoubleCheckUseNPC(foundEnt, center, forward)
|
||||||
|
end
|
||||||
|
--if (dist < nearestDist) then -- Not identical to CBasePlayer
|
||||||
|
--nearestDist = dist
|
||||||
|
nearestEnt = foundEnt
|
||||||
|
--end
|
||||||
|
if (idx == 1) then return foundEnt end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- check ground entity first
|
||||||
|
-- if you've got a useable ground entity, then shrink the cone of this search to 45 degrees
|
||||||
|
-- otherwise, search out in a 90 degree cone (hemisphere)
|
||||||
|
if (self:GetGroundEntity():IsValid() && self:IsUseableEntity(self:GetGroundEntity(), 256)) then
|
||||||
|
nearestEnt = self:GetGroundEntity()
|
||||||
|
end
|
||||||
|
if (nearestEnt) then
|
||||||
|
local point = self:NearestPoint(center)
|
||||||
|
nearestDist = util.DistanceToLine(point, center, forward)
|
||||||
|
end
|
||||||
|
|
||||||
|
local search = ents.FindInSphere(center, PLAYER_USE_RADIUS)
|
||||||
|
for k,v in ipairs(search) do
|
||||||
|
if (v) && (v:IsValid()) && (self:IsUseableEntity(v, 512)) then
|
||||||
|
local point = v:NearestPoint(center)
|
||||||
|
local dir = (point - center):GetNormalized()
|
||||||
|
local dot = dir:Dot(forward)
|
||||||
|
if (dot >= 0.8) then
|
||||||
|
local dist = util.DistanceToLine(point, center, forward)
|
||||||
|
if (dist < nearestDist) then
|
||||||
|
trace.endpos = point
|
||||||
|
util.TraceLine(trace)
|
||||||
|
if ((trace.output.Fraction == 1.0) || (trace.output.Entity == v)) then
|
||||||
|
nearestEnt = v
|
||||||
|
nearestDist = dist
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if (!nearestEnt) then
|
||||||
|
trace.endpos = center + forward * PLAYER_USE_RADIUS
|
||||||
|
trace.mask = MASK_OPAQUE_AND_NPCS
|
||||||
|
util.TraceLine(trace)
|
||||||
|
if (trace.output.Entity
|
||||||
|
&& trace.output.Entity:IsValid()
|
||||||
|
&& self:IsUseableEntity(trace.output.Entity, 0)
|
||||||
|
&& trace.output.Entity:IsNPC()
|
||||||
|
&& (trace.output.Entity:Team() == self:Team())) then
|
||||||
|
nearestEnt = trace.output.Entity
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if (foundEnt:IsNPC() && (foundEnt:Team() == self:Team())) then
|
||||||
|
foundEnt = self:DoubleCheckUseNPC(foundEnt, center, forward)
|
||||||
|
end
|
||||||
|
|
||||||
|
return nearestEnt
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Double Check NPC
|
||||||
|
-- Perhaps a poorly-named function. This function traces against the supplied
|
||||||
|
-- NPC's hitboxes (instead of hull). If the trace hits a different NPC, the
|
||||||
|
-- new NPC is selected. Otherwise, the supplied NPC is determined to be the
|
||||||
|
-- one the citizen wants. This function allows the selection of a citizen over
|
||||||
|
-- another citizen's shoulder, which is impossible without tracing against
|
||||||
|
-- hitboxes instead of the hull (sjb)
|
||||||
|
function meta:DoubleCheckUseNPC(npc, src, dir)
|
||||||
|
local trace = {
|
||||||
|
start = src,
|
||||||
|
endpos = src + dir * 1024,
|
||||||
|
mask = MASK_SHOT,
|
||||||
|
result = {}
|
||||||
|
}
|
||||||
|
util.TraceLine(trace)
|
||||||
|
if ((trace.result.Entity != nil) && (trace.result.Entity:IsValid()) && (trace.result.Entity:IsNPC()) && (trace.result.Entity != npc)) then
|
||||||
|
-- Player is selecting a different NPC through some negative space
|
||||||
|
-- in the first NPC's hitboxes (between legs, over shoulder, etc).
|
||||||
|
return trace.result.Entity
|
||||||
|
end
|
||||||
|
return npc
|
||||||
|
end
|
||||||
@@ -44,7 +44,10 @@ CLASS.UseVMHands = true -- Uses viewmodel hands
|
|||||||
--! Server-Side
|
--! Server-Side
|
||||||
-- ------------------------------------------------------------------------- --
|
-- ------------------------------------------------------------------------- --
|
||||||
-- Spawn
|
-- Spawn
|
||||||
function CLASS:InitialSpawn() end
|
function CLASS:InitialSpawn()
|
||||||
|
self.Player.Data = {}
|
||||||
|
self.Player.Data.SelectionHaloTime = CurTime()
|
||||||
|
end
|
||||||
function CLASS:Spawn() end
|
function CLASS:Spawn() end
|
||||||
function CLASS:Loadout() end
|
function CLASS:Loadout() end
|
||||||
|
|
||||||
@@ -122,6 +125,7 @@ function CLASS:ShowSpare2() end
|
|||||||
-- ------------------------------------------------------------------------- --
|
-- ------------------------------------------------------------------------- --
|
||||||
function CLASS:PostThink() end
|
function CLASS:PostThink() end
|
||||||
function CLASS:Tick(mv) end
|
function CLASS:Tick(mv) end
|
||||||
|
function CLASS:FindUseEntity(defEnt) return defEnt end
|
||||||
|
|
||||||
-- ------------------------------------------------------------------------- --
|
-- ------------------------------------------------------------------------- --
|
||||||
--! Client-Side
|
--! Client-Side
|
||||||
|
|||||||
@@ -179,6 +179,32 @@ end
|
|||||||
-- ------------------------------------------------------------------------- --
|
-- ------------------------------------------------------------------------- --
|
||||||
--! Shared
|
--! Shared
|
||||||
-- ------------------------------------------------------------------------- --
|
-- ------------------------------------------------------------------------- --
|
||||||
|
if SERVER then
|
||||||
|
function CLASS:FindUseEntity(defEnt)
|
||||||
|
return self.Player:FindUseEntity()
|
||||||
|
end
|
||||||
|
|
||||||
|
function CLASS:Tick(mv)
|
||||||
|
if (self.Player.Data == nil) then return end
|
||||||
|
|
||||||
|
-- Selection Halo
|
||||||
|
if (GAMEMODE.Config.SelectionHalo:Allow()) && (!GAMEMODE.Config.SelectionHalo:Approximate()) then
|
||||||
|
if (self.Player.Data.SelectionHaloTime == nil) then
|
||||||
|
self.Player.Data.SelectionHaloTime = CurTime()
|
||||||
|
elseif ((CurTime() - self.Player.Data.SelectionHaloTime) > GAMEMODE.Config.SelectionHalo:Interval()) then
|
||||||
|
self.Player.Data.SelectionHaloTime = CurTime()
|
||||||
|
local ent = self.Player:FindUseEntity()
|
||||||
|
if (IsValid(ent)
|
||||||
|
&& table.HasValue(GAMEMODE.Config.Lists:ClassWhitelist(), ent:GetClass())
|
||||||
|
&& !table.HasValue(GAMEMODE.Config.Lists:ModelBlacklist(), ent:GetModel())) then
|
||||||
|
self.Player:SetNWEntity("SelectionHalo", ent)
|
||||||
|
else
|
||||||
|
self.Player:SetNWBool("SelectionHalo", false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- ------------------------------------------------------------------------- --
|
-- ------------------------------------------------------------------------- --
|
||||||
--! Client-Side
|
--! Client-Side
|
||||||
|
|||||||
@@ -462,3 +462,79 @@ if CLIENT then
|
|||||||
return self.ConVars.TintTeam:GetBool()
|
return self.ConVars.TintTeam:GetBool()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- ------------------------------------------------------------------------- --
|
||||||
|
--! Selection Halo
|
||||||
|
-- ------------------------------------------------------------------------- --
|
||||||
|
GM.Config.SelectionHalo = {}
|
||||||
|
GM.Config.SelectionHalo.ConVars = {}
|
||||||
|
|
||||||
|
-- Allow
|
||||||
|
GM.Config.SelectionHalo.ConVars.Allow = CreateConVarIfNotExists("ph_selectionhalo_allow", "1", FCVAR_REPLICATED, "Selection Halo: Allow clients to enable halo around the currently looked at prop?")
|
||||||
|
function GM.Config.SelectionHalo:Allow()
|
||||||
|
return self.ConVars.Allow:GetBool()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Approximate
|
||||||
|
GM.Config.SelectionHalo.ConVars.Approximate = CreateConVarIfNotExists("ph_selectionhalo_approximate", "1", FCVAR_REPLICATED, "Selection Halo: Enable approximate selection halo, which only checks the forward vector on the client.")
|
||||||
|
function GM.Config.SelectionHalo:Approximate()
|
||||||
|
return self.ConVars.Approximate:GetBool()
|
||||||
|
end
|
||||||
|
|
||||||
|
if SERVER then
|
||||||
|
-- Update Interval
|
||||||
|
GM.Config.SelectionHalo.ConVars.Interval = CreateConVarIfNotExists("ph_selectionhalo_interval", "0.05", FCVAR_ARCHIVE, "Selection Halo: Interval for updates of the accuracte selection halo in seconds.")
|
||||||
|
function GM.Config.SelectionHalo:Interval()
|
||||||
|
return self.ConVars.Interval:GetFloat()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if CLIENT then
|
||||||
|
-- Enabled
|
||||||
|
GM.Config.SelectionHalo.ConVars.Enabled = CreateConVarIfNotExists("ph_selectionhalo_enabled", "1", FCVAR_ARCHIVE, "Selection Halo: Enable halo around prop you might become.")
|
||||||
|
function GM.Config.SelectionHalo:Enabled()
|
||||||
|
if (self:Allow()) then
|
||||||
|
return self.ConVars.Enabled:GetBool()
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Settings
|
||||||
|
GM.Config.SelectionHalo.ConVars.Passes = CreateConVarIfNotExists("ph_selectionhalo_passes", "1", FCVAR_ARCHIVE + FCVAR_CLIENTDLL, "Selection Halo: Passes")
|
||||||
|
function GM.Config.SelectionHalo:Passes()
|
||||||
|
return self.ConVars.Passes:GetInt()
|
||||||
|
end
|
||||||
|
GM.Config.SelectionHalo.ConVars.Additive = CreateConVarIfNotExists("ph_selectionhalo_additive", "1", FCVAR_ARCHIVE + FCVAR_CLIENTDLL, "Selection Halo: Additive")
|
||||||
|
function GM.Config.SelectionHalo:Additive()
|
||||||
|
return self.ConVars.Additive:GetBool()
|
||||||
|
end
|
||||||
|
GM.Config.SelectionHalo.ConVars.IgnoreZ = CreateConVarIfNotExists("ph_selectionhalo_ignorez", "0", FCVAR_ARCHIVE + FCVAR_CLIENTDLL, "Selection Halo: Ignore Z")
|
||||||
|
function GM.Config.SelectionHalo:IgnoreZ()
|
||||||
|
return self.ConVars.IgnoreZ:GetBool()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Blur
|
||||||
|
GM.Config.SelectionHalo.ConVars.BlurX = CreateConVarIfNotExists("ph_selectionhalo_blur_x", "2", FCVAR_ARCHIVE + FCVAR_CLIENTDLL, "Selection Halo: Blur X")
|
||||||
|
function GM.Config.SelectionHalo:BlurX()
|
||||||
|
return self.ConVars.BlurX:GetFloat()
|
||||||
|
end
|
||||||
|
GM.Config.SelectionHalo.ConVars.BlurY = CreateConVarIfNotExists("ph_selectionhalo_blur_y", "2", FCVAR_ARCHIVE + FCVAR_CLIENTDLL, "Selection Halo: Blur Y")
|
||||||
|
function GM.Config.SelectionHalo:BlurY()
|
||||||
|
return self.ConVars.BlurY:GetFloat()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Tint Color
|
||||||
|
GM.Config.SelectionHalo.ConVars.TintHue = CreateConVarIfNotExists("ph_selectionhalo_tint_hue", "0", FCVAR_ARCHIVE + FCVAR_CLIENTDLL, "Selection Halo: Tint Hue")
|
||||||
|
function GM.Config.SelectionHalo:TintHue()
|
||||||
|
return self.ConVars.TintHue:GetFloat()
|
||||||
|
end
|
||||||
|
GM.Config.SelectionHalo.ConVars.TintSaturation = CreateConVarIfNotExists("ph_selectionhalo_tint_saturation", "0", FCVAR_ARCHIVE + FCVAR_CLIENTDLL, "Selection Halo: Tint Saturation")
|
||||||
|
function GM.Config.SelectionHalo:TintSaturation()
|
||||||
|
return self.ConVars.TintSaturation:GetFloat()
|
||||||
|
end
|
||||||
|
GM.Config.SelectionHalo.ConVars.TintValue = CreateConVarIfNotExists("ph_selectionhalo_tint_value", "1", FCVAR_ARCHIVE + FCVAR_CLIENTDLL, "Selection Halo: Tint Value")
|
||||||
|
function GM.Config.SelectionHalo:TintValue()
|
||||||
|
return self.ConVars.TintValue:GetFloat()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|||||||
@@ -104,6 +104,10 @@ function GM:PlayerTick(ply, mv)
|
|||||||
return player_manager.RunClass(ply, "Tick", mv)
|
return player_manager.RunClass(ply, "Tick", mv)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function GM:FindUseEntity(ply, defaultEnt)
|
||||||
|
return player_manager.RunClass(ply, "FindUseEntity", defaultEnt)
|
||||||
|
end
|
||||||
|
|
||||||
-- ------------------------------------------------------------------------- --
|
-- ------------------------------------------------------------------------- --
|
||||||
--! Gamemode Functionality
|
--! Gamemode Functionality
|
||||||
-- ------------------------------------------------------------------------- --
|
-- ------------------------------------------------------------------------- --
|
||||||
@@ -126,6 +130,10 @@ end
|
|||||||
-- ------------------------------------------------------------------------- --
|
-- ------------------------------------------------------------------------- --
|
||||||
--! Includes
|
--! Includes
|
||||||
-- ------------------------------------------------------------------------- --
|
-- ------------------------------------------------------------------------- --
|
||||||
|
-- Meta
|
||||||
|
include "meta/player.lua"
|
||||||
|
|
||||||
|
-- Configuration
|
||||||
include "sh_config.lua"
|
include "sh_config.lua"
|
||||||
|
|
||||||
-- Player Classes
|
-- Player Classes
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
-- Finds the player meta table or terminates
|
|
||||||
local meta = FindMetaTable("Player")
|
|
||||||
if !meta then return end
|
|
||||||
|
|
||||||
-- Blinds the player by setting view out into the void
|
|
||||||
function meta:Blind(bool)
|
|
||||||
if !self:IsValid() then return end
|
|
||||||
|
|
||||||
if SERVER then
|
|
||||||
umsg.Start("SetBlind", self)
|
|
||||||
if bool then
|
|
||||||
umsg.Bool(true)
|
|
||||||
else
|
|
||||||
umsg.Bool(false)
|
|
||||||
end
|
|
||||||
umsg.End()
|
|
||||||
elseif CLIENT then
|
|
||||||
blind = bool
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Blinds the player by setting view out into the void
|
|
||||||
function meta:RemoveProp()
|
|
||||||
if CLIENT || !self:IsValid() then return end
|
|
||||||
|
|
||||||
if self.ph_prop && self.ph_prop:IsValid() then
|
|
||||||
self.ph_prop:Remove()
|
|
||||||
self.ph_prop = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Sets a new Hull for a player.
|
|
||||||
function meta:NewHull(hullOBBMin, hullOBBMax)
|
|
||||||
if !self:IsValid() then return end
|
|
||||||
if hullOBBMax == nil then return end
|
|
||||||
if hullOBBMin == nil then return end
|
|
||||||
|
|
||||||
local hullOBB = hullOBBMax - hullOBBMin
|
|
||||||
local hullOBBXY = math.max(hullOBB.x, hullOBB.y)
|
|
||||||
|
|
||||||
local xyMul = 0.5
|
|
||||||
local hullMin = Vector(-hullOBBXY * xyMul, -hullOBBXY * xyMul, 0)
|
|
||||||
local hullMax = Vector( hullOBBXY * xyMul, hullOBBXY * xyMul, hullOBB.z)
|
|
||||||
|
|
||||||
self:SetHull(hullMin, hullMax)
|
|
||||||
self:SetHullDuck(hullMin, hullMax)
|
|
||||||
self:SetViewOffset(Vector(0, 0, hullOBB.z))
|
|
||||||
self:SetViewOffsetDucked(Vector(0, 0, hullOBB.z / 2.0))
|
|
||||||
end
|
|
||||||
@@ -346,7 +346,7 @@
|
|||||||
"default" "20"
|
"default" "20"
|
||||||
"help" "Camera: Horizontal allowed camera distance range."
|
"help" "Camera: Horizontal allowed camera distance range."
|
||||||
}
|
}
|
||||||
803
|
804
|
||||||
{
|
{
|
||||||
"name" "ph_camera_distance_up_range"
|
"name" "ph_camera_distance_up_range"
|
||||||
"text" "Camera Vertical Offset Range"
|
"text" "Camera Vertical Offset Range"
|
||||||
@@ -354,7 +354,7 @@
|
|||||||
"default" "20"
|
"default" "20"
|
||||||
"help" "Camera: Vertical allowed camera distance range."
|
"help" "Camera: Vertical allowed camera distance range."
|
||||||
}
|
}
|
||||||
803
|
805
|
||||||
{
|
{
|
||||||
"name" "ph_camera_lag_min"
|
"name" "ph_camera_lag_min"
|
||||||
"text" "Camera Lag Min."
|
"text" "Camera Lag Min."
|
||||||
@@ -362,7 +362,7 @@
|
|||||||
"default" "0"
|
"default" "0"
|
||||||
"help" "Camera: Minimum Camera Lag."
|
"help" "Camera: Minimum Camera Lag."
|
||||||
}
|
}
|
||||||
803
|
806
|
||||||
{
|
{
|
||||||
"name" "ph_camera_lag_max"
|
"name" "ph_camera_lag_max"
|
||||||
"text" "Camera Lag Max."
|
"text" "Camera Lag Max."
|
||||||
@@ -371,5 +371,31 @@
|
|||||||
"help" "Camera: Maximum Camera Lag."
|
"help" "Camera: Maximum Camera Lag."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Selection Halo
|
||||||
|
900
|
||||||
|
{
|
||||||
|
"name" "ph_selectionhalo_allow"
|
||||||
|
"text" "Selection Halo Allowed"
|
||||||
|
"type" "CheckBox"
|
||||||
|
"default" "1"
|
||||||
|
"help" "Selection Halo: Allow clients to enable halo around the currently looked at prop?"
|
||||||
|
}
|
||||||
|
901
|
||||||
|
{
|
||||||
|
"name" "ph_selectionhalo_approximate"
|
||||||
|
"text" "Selection Approximate Mode"
|
||||||
|
"type" "CheckBox"
|
||||||
|
"default" "1"
|
||||||
|
"help" "Selection Halo: Enable approximate selection halo, which only checks the forward vector on the client."
|
||||||
|
}
|
||||||
|
902
|
||||||
|
{
|
||||||
|
"name" "ph_selectionhalo_interval"
|
||||||
|
"text" "Selection Halo Allowed"
|
||||||
|
"type" "Numeric"
|
||||||
|
"default" "0.05"
|
||||||
|
"help" "Selection Halo: Interval for updates of the accuracte selection halo in seconds."
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user