1
0
mirror of https://github.com/metrostroi-repo/MetrostroiAddon.git synced 2026-05-02 00:42:29 +00:00

release branch init

This commit is contained in:
g_brzhezinskiy
2021-01-02 15:32:05 +03:00
parent 1d05caf866
commit 09566ce158
398 changed files with 8389 additions and 77275 deletions

View File

@@ -69,8 +69,12 @@ function TRAIN_SYSTEM:Think(dT)
self.NoFreq = 0
self.NoFreqTimer = 0
end
-- Speed check and update speed data
if CurTime() - (self.LastSpeedCheck or 0) > 0.5 then
self.LastSpeedCheck = CurTime()
end
self.Speed = (Train.Speed or 0)
self.Acceleration = math.Round(Train.Acceleration or 0,1)
self.Acceleration = math.Round(Train.Acceleration,1)
self.SpeedSign = Train.SpeedSign or 1
local autostop = haveautostop and Train.SpeedSign > 0 and Train.Speed > 0.1
@@ -110,8 +114,6 @@ function TRAIN_SYSTEM:Think(dT)
end
end
self.Signal = ars
if self.Enabled > 0 and IsValid(ars) then
if not ars:GetARS(1,Train) then
self.F1 = ars:GetARS(8,force1_5,force2_6) and 1 or 0
@@ -159,13 +161,10 @@ function TRAIN_SYSTEM:Think(dT)
self.F5 = CurTime()%2 < 1 and 1 or 0
end
end
else
self.Signal = nil
end
local freqCount = self.F6+self.F5+self.F4+self.F3+self.F2+self.F1
self.NoneFreq =freqCount==0 and 1 or 0
self.OneFreq = freqCount==1 and 1 or 0
self.TwoFreq = freqCount==2 and 1 or 0
self.BadFreq = freqCount>2 and 1 or 0
self.NoFreq = math.min(1,self.NoFreq+self.NoneFreq*self.Enabled)
end