From 3249ff5fac1ba456a096406adfca49ff27edea88 Mon Sep 17 00:00:00 2001 From: Mka0207 Date: Sun, 17 Mar 2019 23:31:18 -0400 Subject: [PATCH 1/4] ZombieVision moved to clientside. remove lag when people with high ping toggle zvision. --- .../zombiesurvival/gamemode/cl_postprocess.lua | 13 ++++++++++--- gamemodes/zombiesurvival/gamemode/init.lua | 6 ------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/gamemodes/zombiesurvival/gamemode/cl_postprocess.lua b/gamemodes/zombiesurvival/gamemode/cl_postprocess.lua index e5efad4..0d07ce9 100644 --- a/gamemodes/zombiesurvival/gamemode/cl_postprocess.lua +++ b/gamemodes/zombiesurvival/gamemode/cl_postprocess.lua @@ -260,9 +260,16 @@ function GM:ToggleZombieVision(onoff) end end -net.Receive("zs_togglezvision", function(length) - gamemode.Call("ToggleZombieVision") -end) +function GM:PlayerButtonDown( ply, button ) + if not IsFirstTimePredicted() then return end + if not IsValid( ply ) or ply != MySelf then return end + + if ply:Team() == TEAM_UNDEAD and ply:Alive() then + if button == KEY_F then + self:ToggleZombieVision() + end + end +end local CModWhiteOut = { ["$pp_colour_addr"] = 0, diff --git a/gamemodes/zombiesurvival/gamemode/init.lua b/gamemodes/zombiesurvival/gamemode/init.lua index e034c7f..6904402 100644 --- a/gamemodes/zombiesurvival/gamemode/init.lua +++ b/gamemodes/zombiesurvival/gamemode/init.lua @@ -474,7 +474,6 @@ function GM:AddNetworkStrings() util.AddNetworkString("zs_deployableout") util.AddNetworkString("zs_trinketconsumed") util.AddNetworkString("zs_nailremoved") - util.AddNetworkString("zs_togglezvision") util.AddNetworkString("zs_remantlercontent") util.AddNetworkString("zs_classunlockstate") util.AddNetworkString("zs_changeclass") @@ -4314,11 +4313,6 @@ end function GM:PlayerSwitchFlashlight(pl, newstate) if pl:Team() == TEAM_UNDEAD then - if newstate then - net.Start("zs_togglezvision") - net.Send(pl) - end - return false end From e881e4e5881481f8a8ba29751f0b6c901c3e39e1 Mon Sep 17 00:00:00 2001 From: Mka0207 Date: Mon, 18 Mar 2019 15:07:36 -0400 Subject: [PATCH 2/4] ZombieVision now based on bind. --- gamemodes/zombiesurvival/gamemode/cl_init.lua | 8 ++++++++ gamemodes/zombiesurvival/gamemode/cl_postprocess.lua | 11 ----------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/gamemodes/zombiesurvival/gamemode/cl_init.lua b/gamemodes/zombiesurvival/gamemode/cl_init.lua index cf234e3..3c883de 100644 --- a/gamemodes/zombiesurvival/gamemode/cl_init.lua +++ b/gamemodes/zombiesurvival/gamemode/cl_init.lua @@ -2240,3 +2240,11 @@ end function PlayMenuCloseSound() MySelf:EmitSound("buttons/lightswitch2.wav", 100, 20) end + +function GM:PlayerBindPress(ply, bind, pressed) + if IsValid( ply ) and ply:Team() == TEAM_UNDEAD and ply:Alive() and not IsFirstTimePredicted() then + if (bind == "impulse 100") then + self:ToggleZombieVision() + end + end +end \ No newline at end of file diff --git a/gamemodes/zombiesurvival/gamemode/cl_postprocess.lua b/gamemodes/zombiesurvival/gamemode/cl_postprocess.lua index 0d07ce9..4813893 100644 --- a/gamemodes/zombiesurvival/gamemode/cl_postprocess.lua +++ b/gamemodes/zombiesurvival/gamemode/cl_postprocess.lua @@ -260,17 +260,6 @@ function GM:ToggleZombieVision(onoff) end end -function GM:PlayerButtonDown( ply, button ) - if not IsFirstTimePredicted() then return end - if not IsValid( ply ) or ply != MySelf then return end - - if ply:Team() == TEAM_UNDEAD and ply:Alive() then - if button == KEY_F then - self:ToggleZombieVision() - end - end -end - local CModWhiteOut = { ["$pp_colour_addr"] = 0, ["$pp_colour_addg"] = 0, From f79846b7adf7639c149ebae40b2c0df1e5fc6baa Mon Sep 17 00:00:00 2001 From: Mka0207 Date: Mon, 18 Mar 2019 15:18:49 -0400 Subject: [PATCH 3/4] Merged bindpress funcs. --- gamemodes/zombiesurvival/gamemode/cl_init.lua | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/gamemodes/zombiesurvival/gamemode/cl_init.lua b/gamemodes/zombiesurvival/gamemode/cl_init.lua index 3c883de..38fbf01 100644 --- a/gamemodes/zombiesurvival/gamemode/cl_init.lua +++ b/gamemodes/zombiesurvival/gamemode/cl_init.lua @@ -1780,6 +1780,10 @@ function GM:PlayerBindPress(pl, bind, wasin) elseif P_Team(pl) == TEAM_HUMAN then self:ToggleOTSCamera() end + elseif bind == "impulse 100" then + if P_Team(pl) == TEAM_UNDEAD and pl:Alive() then + self:ToggleZombieVision() + end end end @@ -2239,12 +2243,4 @@ end function PlayMenuCloseSound() MySelf:EmitSound("buttons/lightswitch2.wav", 100, 20) -end - -function GM:PlayerBindPress(ply, bind, pressed) - if IsValid( ply ) and ply:Team() == TEAM_UNDEAD and ply:Alive() and not IsFirstTimePredicted() then - if (bind == "impulse 100") then - self:ToggleZombieVision() - end - end end \ No newline at end of file From c63f0155ff6f88c11e0f375ee79b358aa2b0d45c Mon Sep 17 00:00:00 2001 From: Mka0207 Date: Mon, 18 Mar 2019 18:30:04 -0400 Subject: [PATCH 4/4] Fixed indentation --- gamemodes/zombiesurvival/gamemode/cl_init.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gamemodes/zombiesurvival/gamemode/cl_init.lua b/gamemodes/zombiesurvival/gamemode/cl_init.lua index 38fbf01..6dee1be 100644 --- a/gamemodes/zombiesurvival/gamemode/cl_init.lua +++ b/gamemodes/zombiesurvival/gamemode/cl_init.lua @@ -1780,10 +1780,10 @@ function GM:PlayerBindPress(pl, bind, wasin) elseif P_Team(pl) == TEAM_HUMAN then self:ToggleOTSCamera() end - elseif bind == "impulse 100" then + elseif bind == "impulse 100" then if P_Team(pl) == TEAM_UNDEAD and pl:Alive() then - self:ToggleZombieVision() - end + self:ToggleZombieVision() + end end end @@ -2243,4 +2243,4 @@ end function PlayMenuCloseSound() MySelf:EmitSound("buttons/lightswitch2.wav", 100, 20) -end \ No newline at end of file +end