10 Commits

Author SHA1 Message Date
Michael Fabian 'Xaymar' Dirks eb3b7f3aef gamemode: Add new 'Selection Halo' feature
This feature allows Hiders to easily tell which prop they will turn into if they press Use. As always, it can be fully configured and even turned off. By default it is enabled and set to Approximate mode.

In Approximate mode, the client is responsible for guessing the best match to the Use key, but does not have any actual influence on what they will really turn into. This will in most cases be enough, as the internal Use test relies on the forward vector, which is checked by this mode. For those requiring more accuracy, there is the Accurate mode.

In Accurate mode, the server is responsible for exactly knowing the best match to the Use key and sending this to the user. This has a server performance impact that scales with the player base and the rate at which these updates are performed can be configured. This mode is affected by lag and packet loss, so only really useful for high performance LAN servers or testing.
2017-11-25 13:25:29 +01:00
Michael Fabian 'Xaymar' Dirks 785f55a017 gamemode: Add Player meta extension
The meta object is extended by some commonly used functionality that Garry's Mod does not expose directly. Some of these are Server only and will produce wrong results on the Client, also due to Garry's Mod not exposing things properly.
2017-11-25 13:14:57 +01:00
Michael Fabian 'Xaymar' Dirks 2691ca4e46 gamemode/compat: Remove old compatibility code 2017-11-25 09:21:59 +01:00
Michael Fabian 'Xaymar' Dirks 8413d8e08e gamemode: Add support for FindUseEntity hook 2017-11-25 09:18:59 +01:00
Michael Fabian 'Xaymar' Dirks 5a4791a097 gamemode/sh_player: Add proper license header 2017-11-25 09:16:20 +01:00
Michael Fabian 'Xaymar' Dirks cc820a89d3 gamemode: Add new and update existing cvars with help text
The command 'cvarlist ph_' should now actually be much more descriptive than before.
2017-11-25 01:30:06 +01:00
Michael Fabian 'Xaymar' Dirks e8f5fc4b92 compat/tauntpackloader: Fix support for third party taunt packs 2017-11-25 00:16:52 +01:00
Michael Fabian 'Xaymar' Dirks 0091281e90 media: Add wider version of the logo 2017-11-25 00:16:33 +01:00
Michael Fabian 'Xaymar' Dirks 0a1fa75a30 gamemode: Only show nameplates for alive players 2017-11-24 03:53:41 +01:00
Michael Fabian 'Xaymar' Dirks eac0c12d64 Ignore all gma files 2017-11-24 03:13:33 +01:00
13 changed files with 657 additions and 149 deletions
+2 -1
View File
@@ -1,3 +1,4 @@
Pack.gma
Changelog.txt
Description.txt
Description.txt
/*.gma
Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

Binary file not shown.
@@ -208,46 +208,76 @@ function DrawNamePlates(bDrawingDepth, bDrawingSkybox)
for i,v in ipairs(pls) do
if (v:Alive() && v != LocalPlayer()) then
local color = HSVToColor(GAMEMODE.Config.NamePlates:TintHue(),
GAMEMODE.Config.NamePlates:TintSaturation(),
GAMEMODE.Config.NamePlates:TintValue())
if GAMEMODE.Config.NamePlates:TintHealth() then
local healthPrc = v:Health() / v:GetMaxHealth()
color = HSVToColor(120 * healthPrc, 1.0, 1.0)
elseif GAMEMODE.Config.NamePlates:TintTeam() then
color = team.GetColor(v:Team())
end
local pos = v:GetPos() + v:GetViewOffset() + Vector(0, 0, GAMEMODE.Config.NamePlates:Height())
local ang = Angle(0, LocalPlayer():EyeAngles().y - 90, 90 - LocalPlayer():EyeAngles().x)
cam.Start3D2D(pos, ang, scale)
draw.DrawText(v:GetName(), "RobotoBoldCondensed160", 0, -draw.GetFontHeight("RobotoBoldCondensed160") / 2, color, TEXT_ALIGN_CENTER)
cam.End3D2D()
if (player_manager.GetPlayerClass(v) != "Spectator") then
local color = HSVToColor(GAMEMODE.Config.NamePlates:TintHue(),
GAMEMODE.Config.NamePlates:TintSaturation(),
GAMEMODE.Config.NamePlates:TintValue())
if GAMEMODE.Config.NamePlates:TintHealth() then
local healthPrc = v:Health() / v:GetMaxHealth()
color = HSVToColor(120 * healthPrc, 1.0, 1.0)
elseif GAMEMODE.Config.NamePlates:TintTeam() then
color = team.GetColor(v:Team())
end
local pos = v:GetPos() + v:GetViewOffset() + Vector(0, 0, GAMEMODE.Config.NamePlates:Height())
local ang = Angle(0, LocalPlayer():EyeAngles().y - 90, 90 - LocalPlayer():EyeAngles().x)
cam.Start3D2D(pos, ang, scale)
draw.DrawText(v:GetName(), "RobotoBoldCondensed160", 0, -draw.GetFontHeight("RobotoBoldCondensed160") / 2, color, TEXT_ALIGN_CENTER)
cam.End3D2D()
end
end
end
end
hook.Add("PostDrawTranslucentRenderables", "PHDrawNamePlates", DrawNamePlates)
function DrawSelectionHalo(bDrawingDepth, bDrawingSkybox)
if (!GAMEMODE.Config.SelectionHalo:Enabled()) then return end
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
hook.Add("PostDrawEffects", "PHDrawSelectionHalo", DrawSelectionHalo)
-- ------------------------------------------------------------------------- --
--! 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)
]]
@@ -40,10 +40,7 @@ function CompatTauntPackLoader()
if (ty == "string") then
Taunts[#Taunts+1] = t
elseif (ty == "table") then
Taunts[#Taunts+1] = t[2]
-- for j,snd in ipairs(t) do
-- HiderTaunts[#HiderTaunts+1] = snd
-- end
Taunts[#Taunts+1] = t[1]
end
end
GAMEMODE.Config.Taunt.HidersCacheStatic = Taunts
@@ -53,10 +50,7 @@ function CompatTauntPackLoader()
if (ty == "string") then
Taunts[#Taunts+1] = t
elseif (ty == "table") then
Taunts[#Taunts+1] = t[2]
-- for j,snd in ipairs(t) do
-- SeekerTaunts[#SeekerTaunts+1] = snd
-- end
Taunts[#Taunts+1] = t[1]
end
end
GAMEMODE.Config.Taunt.SeekersCacheStatic = Taunts
@@ -27,6 +27,7 @@
-- ------------------------------------------------------------------------- --
-- Shared
AddCSLuaFile("sh_init.lua")
AddCSLuaFile("meta/player.lua")
AddCSLuaFile("sh_config.lua")
AddCSLuaFile("player_class/class_default.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
-- ------------------------------------------------------------------------- --
-- Spawn
function CLASS:InitialSpawn() end
function CLASS:InitialSpawn()
self.Player.Data = {}
self.Player.Data.SelectionHaloTime = CurTime()
end
function CLASS:Spawn() end
function CLASS:Loadout() end
@@ -122,6 +125,7 @@ function CLASS:ShowSpare2() end
-- ------------------------------------------------------------------------- --
function CLASS:PostThink() end
function CLASS:Tick(mv) end
function CLASS:FindUseEntity(defEnt) return defEnt end
-- ------------------------------------------------------------------------- --
--! Client-Side
@@ -179,6 +179,32 @@ end
-- ------------------------------------------------------------------------- --
--! 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
@@ -85,7 +85,7 @@ function GM.Config.Round:Time()
end
-- For how many seconds are the Seekers blinded? (Seconds)
GM.Config.Round.ConVars.BlindTime = CreateConVarIfNotExists("ph_round_blindtime", "-30", FCVAR_REPLICATED, "Round Manager: Blind Time for Seekers (in Seconds, positive takes away from ph_round_timelimit, negative adds extra time to ph_round_timelimit")
GM.Config.Round.ConVars.BlindTime = CreateConVarIfNotExists("ph_round_blindtime", "-30", FCVAR_REPLICATED, "Round Manager: Blind Time for Seekers (in Seconds, positive takes away from ph_round_timelimit, negative adds extra time to ph_round_timelimit)")
function GM.Config.Round:BlindTime()
return self.ConVars.BlindTime:GetFloat()
end
@@ -97,7 +97,7 @@ GM.Config.Teams = {}
GM.Config.Teams.ConVars = {}
-- Should teams be ranomized each round?
GM.Config.Teams.ConVars.Randomize = CreateConVarIfNotExists("ph_teams_randomize", "0", FCVAR_REPLICATED, "Teams: Randomize Each Round")
GM.Config.Teams.ConVars.Randomize = CreateConVarIfNotExists("ph_teams_randomize", "0", FCVAR_REPLICATED, "Teams: Randomize Teams instead of swapping each round")
function GM.Config.Teams:Randomize()
return self.ConVars.Randomize:GetBool()
end
@@ -462,3 +462,79 @@ if CLIENT then
return self.ConVars.TintTeam:GetBool()
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)
end
function GM:FindUseEntity(ply, defaultEnt)
return player_manager.RunClass(ply, "FindUseEntity", defaultEnt)
end
-- ------------------------------------------------------------------------- --
--! Gamemode Functionality
-- ------------------------------------------------------------------------- --
@@ -126,6 +130,10 @@ end
-- ------------------------------------------------------------------------- --
--! Includes
-- ------------------------------------------------------------------------- --
-- Meta
include "meta/player.lua"
-- Configuration
include "sh_config.lua"
-- 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
@@ -15,6 +15,7 @@
"text" "Enable Debug Mode"
"type" "CheckBox"
"default" "0"
"help" "Prop Hunt: Enable Debug Mode"
}
2
@@ -23,221 +24,378 @@
"text" "Enable Debug Logging"
"type" "CheckBox"
"default" "1"
"help" "Prop Hunt: Enable Debug Logging"
}
// Basic Settings
11
100
{
"name" "ph_gametype"
"text" "Game Type to use"
"type" "Numeric"
"default" "0"
"help" "Prop Hunt: Which Game Type should be played?"
}
12
101
{
"name" "mp_timelimit"
"text" "Map Time Limit"
"type" "Numeric"
"default" "0"
"help" "Map Time Limit (in Minutes)"
}
13
102
{
"name" "ph_sprinting"
"text" "Enable Sprinting"
"type" "CheckBox"
"name" "mp_friendlyfire"
"text" "Friendly fire"
"type" "Numeric"
"default" "0"
"help" "Allow friendly fire? (0 = No, 1 = Yes, 2 = Reflect)"
}
// Round Settings
21
200
{
"name" "ph_round_limit"
"text" "Maximum Rounds Played"
"type" "Numeric"
"default" "10"
}
22
"help" "Round Manager: Maximum Rounds to Play on a single Map"
}
201
{
"name" "ph_round_timelimit"
"text" "Time Limit per Round"
"type" "Numeric"
"default" "180"
}
23
"help" "Round Manager: Time Limit per Round (in Seconds)"
}
202
{
"name" "ph_round_blindtime"
"text" "Seeker Blind time per Round"
"type" "Numeric"
"default" "-30"
"help" "Round Manager: Blind Time for Seekers (in Seconds, positive takes away from ph_round_timelimit, negative adds extra time to ph_round_timelimit)"
}
// Team Settings
31
300
{
"name" "ph_teams_randomize"
"text" "Randomize Teams"
"type" "CheckBox"
"default" "1"
}
32
"help" "Teams: Randomize Teams instead of swapping each round"
}
301
{
"name" "ph_teams_weighted"
"text" "Randomize with weighted Score"
"type" "CheckBox"
"default" "1"
}
33
"help" "Teams: Use Weighted Randomization"
}
302
{
"name" "ph_teams_seekerpct"
"text" "Pct of Pl. becoming Seeker"
"type" "Numeric"
"default" "25"
"help" "Teams: Initial percentage of Seekers in Dead Hunt Game Type"
}
// Seeker Settings
41
400
{
"name" "ph_seeker_health"
"text" "Seeker Health"
"type" "Numeric"
"default" "100"
"help" "Seekers: Initial Health"
}
42
401
{
"name" "ph_seeker_health_max"
"text" "Seeker Max Health"
"type" "Numeric"
"default" "100"
"help" "Seekers: Maximum Health"
}
43
402
{
"name" "ph_seeker_health_bonus"
"text" "Seeker Health Kill-Bonus"
"type" "Numeric"
"default" "20"
"help" "Seekers: Health Bonus per Kill"
}
44
403
{
"name" "ph_seeker_health_penalty"
"text" "Seeker Health Penalty"
"type" "Numeric"
"default" "5"
"help" "Seekers: Health Penalty per wrong Shot"
}
45
404
{
"name" "ph_seeker_weapons"
"text" "Seeker Weapons"
"type" "Text"
"default" "weapon_crowbar,weapon_pistol,weapon_ph_smg,weapon_shotgun"
"help" "Seekers: Initial Weapons (Weapon,Weapon,...)"
}
46
405
{
"name" "ph_seeker_ammo"
"text" "Seeker Ammo"
"type" "Text"
"default" "Pistol:100,SMG1:300,SMG1_Grenade:1,Buckshot:64"
"help" "Seekers: Initial Ammo (Ammo:Amount,Ammo:Amount,...)"
}
406
{
"name" "ph_seeker_walk_speed"
"text" "Seeker Walk Speed"
"type" "Numeric"
"default" "250"
"help" "Seekers: Walk Speed"
}
407
{
"name" "ph_seeker_sprint"
"text" "Seeker Sprint Allowed"
"type" "CheckBox"
"default" "1"
"help" "Seekers: Allow Sprinting"
}
408
{
"name" "ph_seeker_sprint_speed"
"text" "Seeker Sprint Speed"
"type" "Numeric"
"default" "500"
"help" "Seekers: Sprint Speed"
}
409
{
"name" "ph_seeker_jump_power"
"text" "Seeker Jump Power"
"type" "Numeric"
"default" "200"
"help" "Seekers: Jump Power"
}
// Hider Settings
51
500
{
"name" "ph_hider_health"
"text" "Hider Health"
"type" "Numeric"
"default" "100"
"help" "Hiders: Initial Health"
}
52
501
{
"name" "ph_hider_health_max"
"text" "Hider Max Health"
"type" "Numeric"
"default" "100"
"help" "Hiders: Maximum Health"
}
53
502
{
"name" "ph_hider_health_scaling"
"text" "Hider Enable Health Scaling"
"type" "CheckBox"
"default" "1"
"help" "Hiders: Enable Health Scaling"
}
54
503
{
"name" "ph_hider_health_scaling_max"
"text" "Hider Scaled Max Health"
"type" "Numeric"
"default" "200"
"help" "Hiders: Maximum scaled Health"
}
55
504
{
"name" "ph_hider_allow_full_rotation"
"text" "Hider 3-Dimensional Rotation"
"type" "CheckBox"
"default" "0"
"help" "Hiders: Enable full 3D Rotation"
}
505
{
"name" "ph_hider_walk_speed"
"text" "Hider Walk Speed"
"type" "Numeric"
"default" "250"
"help" "Hiders: Walk Speed"
}
506
{
"name" "ph_hider_sprint"
"text" "Hider Sprint Allowed"
"type" "CheckBox"
"default" "0"
"help" "Hiders: Allow Sprinting"
}
507
{
"name" "ph_hider_sprint_speed"
"text" "Hider Sprint Speed"
"type" "Numeric"
"default" "500"
"help" "Hiders: Sprint Speed"
}
507
{
"name" "ph_hider_jump_power"
"text" "Hider Jump Power"
"type" "Numeric"
"default" "200"
"help" "Hiders: Jump Power"
}
// Whitelist & Blacklist
61
600
{
"name" "ph_list_class_whitelist"
"text" "Allowed Entity Classes"
"type" "Text"
"default" "ph_prop,prop_physics,prop_physics_multiplayer,prop_physics_respawnable"
}
62
"help" "Anti-Cheat: Whitelisted Hider Classes"
}
601
{
"name" "ph_list_abuse_blacklist"
"text" "Abuse Blacklist"
"type" "Text"
"default" "func_button,func_door,func_door_rotation,prop_door_rotation,func_tracktrain,func_tanktrain,func_breakable"
}
63
"help" "Anti-Cheat: Entity Abuse Blacklist"
}
602
{
"name" "ph_list_model_blacklist"
"text" "Model Blacklist"
"type" "Text"
"default" "models/props/cs_assault/dollar.mdl,models/props/cs_assault/money.mdl,models/props/cs_office/snowman_arm.mdl,models/props/cs_office/projector_remote.mdl"
"help" "Anti-Cheat: Model Abuse Blacklist"
}
// Taunts
71
700
{
"name" "ph_taunt_cooldown"
"text" "Cooldown for Taunts"
"type" "Numeric"
"default" "5"
"help" "Prop Hunt: Cooldown between Taunts"
}
72
701
{
"name" "ph_taunt_seekers"
"text" "Seeker Taunts"
"type" "Text"
"default" "bot/a_bunch_of_them.wav,bot/come_out_and_fight_like_a_man.wav,bot/come_out_wherever_you_are.wav,bot/come_to_papa.wav,bot/dont_worry_hell_get_it.wav,bot/hang_on_i_heard_something.wav,bot/hang_on_im_coming.wav,bot/i_dont_think_so.wav,bot/i_have_the_hostages.wav,bot/i_see_our_target.wav,bot/im_waiting_here.wav,bot/keeping_an_eye_on_the_hostages.wav,bot/nnno_sir.wav,bot/spotted_the_delivery_boy.wav,bot/target_acquired.wav,bot/target_spotted.wav,bot/you_heard_the_man_lets_go.wav"
"help" "Prop Hunt: Seeker Taunts"
}
73
702
{
"name" "ph_taunt_hiders"
"text" "Hider Taunts"
"type" "Text"
"default" "ambient/alarms/apc_alarm_pass1.wav,ambient/alarms/manhack_alert_pass1.wav,ambient/alarms/razortrain_horn1.wav,ambient/alarms/scanner_alert_pass1.wav,ambient/alarms/train_horn2.wav,ambient/alarms/train_horn_distant1.wav,ambient/alarms/warningbell1.wav,ambient/energy/whiteflash.wav,ambient/intro/alyxremove.wav,ambient/intro/logosfx.wav,ambient/levels/launch/1stfiringwarning.wav,ambient/levels/launch/rockettakeoffblast.wav,ambient/misc/ambulance1.wav,ambient/misc/carhonk1.wav,ambient/misc/carhonk2.wav,ambient/misc/carhonk3.wav,ambient/outro/gunshipcrash.wav,ambient/3dmeagle.wav,beams/beamstart5.wav,buttons/bell1.wav,buttons/weapon_cant_buy.wav,common/bass.wav,common/bugreporter_failed.wav,common/warning.wav,doors/door_squeek1.wav,friends/friend_join.wav,friends/friend_online.wav,friends/message.wav,hostage/hunuse/comeback.wav,hostage/hunuse/dontleaveme.wav,hostage/hunuse/yeahillstay.wav,items/gift_drop.wav,music/radio1.mp3,phx/eggcrack.wav,plats/elevbell1.wav,player/headshot1.wav,player/headshot2.wav,player/sprayer.wav,radio/enemydown.wav,radio/go.wav,radio/locknload.wav,radio/negative.wav,radio/rounddraw.wav,radio/takepoint.wav,resource/warning.wav,ui/achievement_earned.wav,ui/freeze_cam.wav,vehicles/junker/radar_ping_friendly1.wav,weapons/c4/c4_beep1.wav,weapons/c4/c4_click.wav,weapons/awp/awp1.wav,vo/canals/female01/gunboat_giveemhell.wav,vo/canals/female01/gunboat_justintime.wav,vo/canals/female01/stn6_incoming.wav,vo/canals/male01/gunboat_giveemhell.wav,vo/canals/male01/gunboat_justintime.wav,vo/canals/male01/stn6_incoming.wav,vo/canals/al_radio_stn6.wav,vo/canals/arrest_getgoing.wav,vo/canals/arrest_helpme.wav,vo/canals/arrest_lookingforyou.wav,vo/canals/boxcar_lethimhelp.wav,vo/canals/matt_closecall.wav,vo/canals/premassacre.wav,vo/ravenholm/aimforhead.wav,vo/ravenholm/bucket_patience.wav,vo/ravenholm/madlaugh01.wav,vo/ravenholm/madlaugh02.wav,vo/ravenholm/madlaugh03.wav,vo/ravenholm/madlaugh04.wav,weapons/strider_buster/ol12_stickybombcreator.wav,weapons/c4/c4_explode1.wav,weapons/357/357_fire2.wav,weapons/357/357_fire3.wav,weapons/scout/scout_fire-1.wav,weapons/smokegrenade/sg_explode.wav,weapons/grenade_launcher1.wav,weapons/explode3.wav,weapons/underwater_explode3.wav,items/nvg_on.wav,hostage/huse/letsdoit.wav,hostage/huse/illfollow.wav,hostage/huse/getouttahere.wav,doors/door_screen_move1.wav,doors/heavy_metal_stop1.wav,doors/default_move.wav,common/stuck2.wav,ambient/water_splash1.wav,ambient/water_splash2.wav,ambient/water_splash3.wav,ambient/weather/thunder1.wav,ambient/weather/thunder2.wav,ambient/weather/thunder3.wav,ambient/weather/thunder4.wav,ambient/weather/thunder5.wav,ambient/weather/thunder6.wav,ambient/outro/thunder7.wav,ambient/voices/crying_loop1.wav,ambient/voices/playground_memory.wav,ambient/voices/f_scream1.wav,ambient/voices/m_scream1.wav,ambient/voices/cough1.wav,ambient/voices/cough2.wav,ambient/voices/cough3.wav,ambient/voices/cough4.wav,ambient/overhead/plane1.wav,ambient/overhead/plane2.wav,ambient/overhead/plane3.wav,ambient/overhead/hel1.wav,ambient/overhead/hel2.wav,ambient/misc/truck_backup1.wav,ambient/misc/truck_drive1.wav,ambient/misc/truck_drive2.wav,ambient/machines/pneumatic_drill_1.wav,ambient/machines/pneumatic_drill_2.wav,ambient/machines/pneumatic_drill_3.wav,ambient/machines/pneumatic_drill_4.wav,ambient/machines/station_train_squeel.wav,ambient/machines/ticktock.wav,ambient/creatures/teddy.wav,ambient/creatures/town_child_scream1.wav,ambient/creatures/town_moan1.wav,ambient/creatures/town_muffled_cry1.wav,ambient/creatures/town_scared_breathing1.wav,ambient/creatures/town_scared_breathing2.wav,ambient/creatures/town_scared_sob1.wav,ambient/creatures/town_scared_sob2.wav,ambient/creatures/town_zombie_call1.wav"
"help" "Prop Hunt: Hider Taunts"
}
// Camera
800
{
"name" "ph_camera_allow_noclip"
"text" "Camera Noclip Allowed"
"type" "CheckBox"
"default" "0"
"help" "Camera: Allow clients to disable camera collision"
}
801
{
"name" "ph_camera_distance_max"
"text" "Camera Distance Max."
"type" "Numeric"
"default" "150"
"help" "Camera: Maximum allowed distance to player."
}
802
{
"name" "ph_camera_distance_min"
"text" "Camera Distance Min."
"type" "Numeric"
"default" "30"
"help" "Camera: Minimum allowed distance to player."
}
803
{
"name" "ph_camera_distance_right_range"
"text" "Camera Horizontal Offset Range"
"type" "Numeric"
"default" "20"
"help" "Camera: Horizontal allowed camera distance range."
}
803
{
"name" "ph_camera_distance_up_range"
"text" "Camera Vertical Offset Range"
"type" "Numeric"
"default" "20"
"help" "Camera: Vertical allowed camera distance range."
}
803
{
"name" "ph_camera_lag_min"
"text" "Camera Lag Min."
"type" "Numeric"
"default" "0"
"help" "Camera: Minimum Camera Lag."
}
803
{
"name" "ph_camera_lag_max"
"text" "Camera Lag Max."
"type" "Numeric"
"default" "0.95"
"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."
}
}
}