From b4d20fb3fa82c8b7703c72f2c3683fd2338fd638 Mon Sep 17 00:00:00 2001 From: AlmTech Software Date: Fri, 17 Jan 2020 23:20:01 +0100 Subject: [PATCH] Bug fixes & code cleanup for release --- entities/weapons/quantum_hands/shared.lua | 22 ++++++++++--------- .../engine/core/server/sv_player_init.lua | 4 ++-- gamemode/engine/lib/sh_effects.lua | 8 +++---- gamemode/engine/vars/sh_vars.lua | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/entities/weapons/quantum_hands/shared.lua b/entities/weapons/quantum_hands/shared.lua index 033eca5..ab0ebd9 100644 --- a/entities/weapons/quantum_hands/shared.lua +++ b/entities/weapons/quantum_hands/shared.lua @@ -32,16 +32,18 @@ if CLIENT then hook.Add( "PostDrawOpaqueRenderables", "Quantum_Client_DeveloperHands_HitPos", function() if( LocalPlayer():IsSuperAdmin() && !Quantum.Client.IsInMenu ) then - if( LocalPlayer():GetActiveWeapon():GetClass() == "quantum_hands" ) then - local trace = LocalPlayer():GetEyeTrace() - local angle = trace.HitNormal:Angle() - - render.SetMaterial( cubeMat ) - render.DrawBox( trace.HitPos, Angle( 0, 0, 0), Vector( 0, 0, 0 ), Vector( 2, 2, 2 ), Color( 255, 25, 25, 100 ) ) - - render.DrawLine( trace.HitPos, trace.HitPos + 12 * angle:Forward(), Color( 255, 0, 0 ), true ) - render.DrawLine( trace.HitPos, trace.HitPos + 12 * -angle:Right(), Color( 0, 255, 0 ), true ) - render.DrawLine( trace.HitPos, trace.HitPos + 12 * angle:Up(), Color( 0, 0, 255 ), true ) + if( IsValid( LocalPlayer():GetActiveWeapon() ) ) then + if( LocalPlayer():GetActiveWeapon():GetClass() == "quantum_hands" ) then + local trace = LocalPlayer():GetEyeTrace() + local angle = trace.HitNormal:Angle() + + render.SetMaterial( cubeMat ) + render.DrawBox( trace.HitPos, Angle( 0, 0, 0), Vector( 0, 0, 0 ), Vector( 2, 2, 2 ), Color( 255, 25, 25, 100 ) ) + + render.DrawLine( trace.HitPos, trace.HitPos + 12 * angle:Forward(), Color( 255, 0, 0 ), true ) + render.DrawLine( trace.HitPos, trace.HitPos + 12 * -angle:Right(), Color( 0, 255, 0 ), true ) + render.DrawLine( trace.HitPos, trace.HitPos + 12 * angle:Up(), Color( 0, 0, 255 ), true ) + end end end end) diff --git a/gamemode/engine/core/server/sv_player_init.lua b/gamemode/engine/core/server/sv_player_init.lua index 1a903e6..9a12be9 100644 --- a/gamemode/engine/core/server/sv_player_init.lua +++ b/gamemode/engine/core/server/sv_player_init.lua @@ -29,7 +29,7 @@ local function setUpPlayer( ply ) if( ply:GetModel() ~= nil ) then ply:SetupHands() else - Quantum.Error( tostring(ply) .. " doesn't have a valid model. Unable to set up hands!" ) + Quantum.Error( Quantum.PrintPlayer( ply ) .. " doesn't have a valid model. Unable to set up hands!" ) end local char = Quantum.Server.Char.GetCurrentCharacter( ply ) local charnametxt = " spawned." @@ -48,7 +48,7 @@ local function setUpPlayer( ply ) ply:Give( "quantum_hands" ) ply:SelectWeapon( "quantum_hands" ) - Quantum.Debug( Quantum.PrintPlayer( pl ) .. charnametxt ) + Quantum.Debug( Quantum.PrintPlayer( ply ) .. charnametxt ) end function GM:PlayerSpawn( ply ) diff --git a/gamemode/engine/lib/sh_effects.lua b/gamemode/engine/lib/sh_effects.lua index 6c0843f..0b4dfab 100644 --- a/gamemode/engine/lib/sh_effects.lua +++ b/gamemode/engine/lib/sh_effects.lua @@ -51,10 +51,8 @@ if SERVER then -- server only functions function Quantum.Effect.RemoveRuntimeFunction( pl, effectid, hookID ) hookID = hookID || "Quantum_Effects_RunTime_" .. tostring(pl:SteamID64()) .. "_" .. tostring(effectid) - --Quantum.Debug( "Removing runtime effect hook: " .. hookID ) if( pl.effecthooks != nil ) then - PrintTable( pl.effecthooks ) if( pl.effecthooks[hookID] != nil ) then pl.effecthooks[hookID] = nil end @@ -64,7 +62,7 @@ if SERVER then -- server only functions function Quantum.Effect.RemoveAllRuntimeFunctions( pl ) if( pl.effecthooks != nil ) then - Quantum.Debug( "Removing all runtime hooks for " .. tostring(pl) .. "." ) + Quantum.Debug( "Removing all runtime hooks for " .. Quantum.PrintPlayer( pl ) .. "." ) for n, hookid in pairs( pl.effecthooks ) do Quantum.Effect.RemoveRuntimeFunction( pl, nil, hookid ) end @@ -93,7 +91,7 @@ if SERVER then -- server only functions function Quantum.Effect.RemoveAll( pl ) local char = Quantum.Server.Char.GetCurrentCharacter( pl ) if( char.effects != nil ) then - Quantum.Debug( "Removing all " .. tostring(pl) .. " effects." ) + Quantum.Debug( "Removing all " .. Quantum.PrintPlayer( pl ) .. " effects." ) for i, effect in pairs( char.effects ) do Quantum.Effect.Remove( pl, effect, char ) -- remove the effect end @@ -107,7 +105,7 @@ if SERVER then -- server only functions if( effectTbl != nil ) then - Quantum.Debug( "Giving " .. tostring(pl) .. " the '" .. tostring(effectid) .. "' effect." ) + Quantum.Debug( "Giving " .. Quantum.PrintPlayer( pl ) .. " the '" .. tostring(effectid) .. "' effect." ) if( effectTbl.func.start != nil && effectTbl.func.start != Quantum.EmptyFunction ) then effectTbl.func.start( pl ) diff --git a/gamemode/engine/vars/sh_vars.lua b/gamemode/engine/vars/sh_vars.lua index 8db976e..bf32a47 100644 --- a/gamemode/engine/vars/sh_vars.lua +++ b/gamemode/engine/vars/sh_vars.lua @@ -54,5 +54,5 @@ function Quantum.WriteIntcode( intcode ) end function Quantum.PrintPlayer( pl ) - return pl:Nick() .. " | " .. pl:SteamID() + return "[" .. pl:Nick() .. "|" .. pl:SteamID() .. "]" end \ No newline at end of file