mirror of
https://github.com/CapsAdmin/pac3.git
synced 2025-03-04 03:03:01 -05:00
Improve pac editor networking logic (#1250)
* Dont send editor data when editor isn't open * Add ratelimit logic
This commit is contained in:
parent
ce9f378911
commit
3f7def5f09
@ -361,6 +361,7 @@ do
|
||||
local lastViewPos, lastViewAngle, lastTargetPos
|
||||
|
||||
timer.Create("pac_in_editor", 0.25, 0, function()
|
||||
if not pace.Active then return end
|
||||
if not pace.current_part:IsValid() then return end
|
||||
local pos, ang = pace.GetViewPos(), pace.GetViewAngles()
|
||||
local target_pos = pace.mctrl.GetWorldPosition()
|
||||
@ -380,7 +381,7 @@ do
|
||||
|
||||
net.Receive("pac_in_editor_posang", function()
|
||||
local ply = net.ReadEntity()
|
||||
if not ply:IsValid() then return end
|
||||
if not IsValid( ply ) then return end
|
||||
|
||||
local pos = net.ReadVector()
|
||||
local ang = net.ReadAngle()
|
||||
|
@ -69,6 +69,12 @@ do
|
||||
util.AddNetworkString("pac_in_editor_posang")
|
||||
|
||||
net.Receive("pac_in_editor_posang", function(_, ply)
|
||||
if not ply.pac_last_editor_message then
|
||||
ply.pac_last_editor_message = 0
|
||||
end
|
||||
if ply.pac_last_editor_message > CurTime() then return end
|
||||
ply.pac_last_editor_message = CurTime() + 0.2
|
||||
|
||||
local pos = net.ReadVector()
|
||||
local ang = net.ReadAngle()
|
||||
local part_pos = net.ReadVector()
|
||||
@ -85,4 +91,4 @@ end
|
||||
|
||||
CreateConVar("has_pac3_editor", "1", {FCVAR_NOTIFY})
|
||||
|
||||
resource.AddSingleFile("materials/icon64/pac3.png")
|
||||
resource.AddSingleFile("materials/icon64/pac3.png")
|
||||
|
Loading…
Reference in New Issue
Block a user