Files
wnsrc/lua/arccw/shared/sh_controls.lua
lifestorm 94063e4369 Upload
2024-08-04 22:55:00 +03:00

57 lines
1.6 KiB
Lua

--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
net.Receive("arccw_firemode", function(len, ply)
local wpn = ply:GetActiveWeapon()
if !wpn.ArcCW then return end
wpn:ChangeFiremode()
end)
net.Receive("arccw_ubgl", function(len, ply)
local on = net.ReadBool()
local wpn = ply:GetActiveWeapon()
if !wpn.ArcCW then return end
if on then
wpn:SelectUBGL()
else
wpn:DeselectUBGL()
end
end)
if CLIENT then
net.Receive("arccw_togglecustomize", function()
if !LocalPlayer():GetActiveWeapon() or !LocalPlayer():GetActiveWeapon().ArcCW then return end
LocalPlayer():GetActiveWeapon():ToggleCustomizeHUD(net.ReadBool())
end)
elseif SERVER then
net.Receive("arccw_togglecustomize", function(len, ply)
local wpn = ply:GetActiveWeapon()
local onoff = net.ReadBool()
if !wpn.ArcCW then return end
wpn:ToggleCustomizeHUD(onoff)
end)
end
hook.Add("EntityTakeDamage", "ArcCW_CloseOnHurt", function(ply, dmg)
if ply:IsPlayer() and ply:GetActiveWeapon() and ply:GetActiveWeapon().ArcCW
and tobool(ply:GetInfo("arccw_attinv_closeonhurt"))
and ply:GetActiveWeapon():GetState() == ArcCW.STATE_CUSTOMIZE then
net.Start("arccw_togglecustomize")
net.WriteBool(false)
net.Send(ply)
ply:GetActiveWeapon():ToggleCustomizeHUD(false)
end
end)