From 47ad07d50a8b863b56f4d3917889470867fd5c07 Mon Sep 17 00:00:00 2001 From: Hellss Date: Mon, 10 Jan 2022 01:47:51 +0300 Subject: [PATCH 1/2] Fix PackedRatio --- lua/entities/gmod_subway_base/shared.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/entities/gmod_subway_base/shared.lua b/lua/entities/gmod_subway_base/shared.lua index 79f85bf..8ba8a4c 100644 --- a/lua/entities/gmod_subway_base/shared.lua +++ b/lua/entities/gmod_subway_base/shared.lua @@ -589,12 +589,12 @@ end --------------------------------------------------------------------------------------- function ENT:SetPackedRatio(idx,value) --local idx = type(idx) == "number" and 999-idx or idx - if self._NetData[2][idx] ~= nil and self._NetData[2][idx] == math.floor(value*500) then return end - self:SetNW2Int(idx,math.floor(value*500)) + if self._NetData[2][idx] ~= nil and self._NetData[2][idx] == math.Round(value*1000) then return end + self:SetNW2Int(idx,math.Round(value*1000)) end function ENT:GetPackedRatio(idx) - return self:GetNW2Int(idx)/500 + return self:GetNW2Int(idx)/1000 end -------------------------------------------------------------------------------- From 3a8fd4c1942692471445e7f8c215fe5d973faf40 Mon Sep 17 00:00:00 2001 From: Hellss Date: Thu, 13 Jan 2022 22:26:57 +0300 Subject: [PATCH 2/2] fix round --- lua/entities/gmod_subway_base/shared.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/entities/gmod_subway_base/shared.lua b/lua/entities/gmod_subway_base/shared.lua index 8ba8a4c..4888aff 100644 --- a/lua/entities/gmod_subway_base/shared.lua +++ b/lua/entities/gmod_subway_base/shared.lua @@ -589,12 +589,12 @@ end --------------------------------------------------------------------------------------- function ENT:SetPackedRatio(idx,value) --local idx = type(idx) == "number" and 999-idx or idx - if self._NetData[2][idx] ~= nil and self._NetData[2][idx] == math.Round(value*1000) then return end - self:SetNW2Int(idx,math.Round(value*1000)) + if self._NetData[2][idx] ~= nil and self._NetData[2][idx] == math.floor(value*1000+0.5) then return end + self:SetNW2Int(idx,math.floor(value*1000+0.5)) end function ENT:GetPackedRatio(idx) - return self:GetNW2Int(idx)/1000 + return self:GetNW2Int(idx)*0.001 end --------------------------------------------------------------------------------