From b5cd8a7745fa32caa4b0427ce32e59f0dbeb11ad Mon Sep 17 00:00:00 2001 From: Hellss Date: Wed, 13 Jul 2022 17:43:49 +0300 Subject: [PATCH] FIX pass (math.min instead %) --- lua/entities/gmod_track_platform/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/entities/gmod_track_platform/init.lua b/lua/entities/gmod_track_platform/init.lua index 5552280..9cd935c 100644 --- a/lua/entities/gmod_track_platform/init.lua +++ b/lua/entities/gmod_track_platform/init.lua @@ -553,7 +553,7 @@ function ENT:Think() if target <= 0 then self.WindowEnd = self.WindowStart - else + elseif self.WindowEnd < self:PoolSize() then local growthDelta = math.max(0,(target-self:PopulationCount())*0.005) if growthDelta < 1.0 then -- Accumulate fractional rate self.GrowthAccumulation = (self.GrowthAccumulation or 0) + growthDelta @@ -562,7 +562,7 @@ function ENT:Think() self.GrowthAccumulation = self.GrowthAccumulation - 1.0 end end - self.WindowEnd = (self.WindowEnd + math.floor(growthDelta+0.5)) % self:PoolSize() + self.WindowEnd = math.min(self:PoolSize(), self.WindowEnd + math.floor(growthDelta+0.5)) end end