mirror of
https://github.com/metrostroi-repo/MetrostroiAddon.git
synced 2026-05-02 00:42:29 +00:00
Added previous pneumatics version for compatibility with 3rd party 81-717/714 train types
This commit is contained in:
@@ -34,11 +34,10 @@ function TRAIN_SYSTEM:Initialize(parameters)
|
||||
-- Pressure in trains feed line
|
||||
self.TrainLinePressure = 8.0 -- atm
|
||||
-- Pressure in trains brake line
|
||||
self.BrakeLinePressure = 0.0 -- atm
|
||||
self.BrakeLinePressure = 3.0 -- atm
|
||||
self.EPKPressure = 0.0 -- atm
|
||||
-- Pressure in brake cylinder
|
||||
self.BrakeCylinderPressure = 0.0 -- atm
|
||||
self.OldBrakeLinePressure = 0.0
|
||||
-- Pressure in the door line
|
||||
self.DoorLinePressure = 0.0 -- atm
|
||||
self._1stRightDoorCloseCylPressure = 0.0
|
||||
@@ -52,11 +51,11 @@ function TRAIN_SYSTEM:Initialize(parameters)
|
||||
self.OldBrakeLinePressure = 0.0
|
||||
self.BCPressure = 0
|
||||
-- Air distrubutor part
|
||||
self.WorkingChamberPressure = 0.0
|
||||
self.WorkingChamberPressure = 5.2
|
||||
-- Disconnected KM 334 vessels (trainline and brakeline parts between disconnect valve and KM itself) emulation
|
||||
self.TLDisconnectPressure = 0.0
|
||||
self.BLDisconnectPressure = 0.0
|
||||
self.WCChargeValve = true
|
||||
self.WCChargeValve = false
|
||||
self.PN1 = 0
|
||||
self.PN2 = 0
|
||||
self.cranPres = 0
|
||||
@@ -576,32 +575,32 @@ function TRAIN_SYSTEM:Think(dT)
|
||||
end
|
||||
|
||||
-- 013: 2 Normal pressure
|
||||
if (self.RealDriverValvePosition == 2) and self.BLDisconnect and (self.TLDisconnect or self.BrakeLinePressure > 1.01*math.min(self.KM013offset,self.TrainToBrakeReducedPressure)) then--was pr_speed*2
|
||||
self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(self.KM013offset+(self.km13_error2 or 0),self.TrainLinePressure), pr_speed, pz_speed, nil, 2.5)-- nil, 1.0)
|
||||
if (self.RealDriverValvePosition == 2) and self.BLDisconnect and (self.TLDisconnect or self.BrakeLinePressure > math.min(self.KM013offset,self.TrainToBrakeReducedPressure)) then--was pr_speed*2
|
||||
self:equalizePressure(dT,"BrakeLinePressure", math.min(self.KM013offset+(self.km13_error2 or 0),self.TrainLinePressure), pr_speed, pz_speed, nil, 2.5)-- nil, 1.0)
|
||||
if self.km13_error2 and self.BrakeLinePressure >= self.KM013offset+self.km13_error2-0.1 then
|
||||
self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(self.KM013offset,self.TrainToBrakeReducedPressure), 35, pz_speed, nil, 1)
|
||||
self:equalizePressure(dT,"BrakeLinePressure", math.min(self.KM013offset,self.TrainToBrakeReducedPressure), 35, pz_speed, nil, 1)
|
||||
self.km13_error2 = nil
|
||||
end
|
||||
end
|
||||
|
||||
-- 013: 3 4.3 Atm
|
||||
if (self.RealDriverValvePosition == 3) and self.BLDisconnect and (self.TLDisconnect or self.BrakeLinePressure > 1.01*math.min(4.3,self.TrainToBrakeReducedPressure)) then
|
||||
self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(4.3,self.TrainToBrakeReducedPressure), pr_speed,pz_speed, nil, 2.5)
|
||||
if (self.RealDriverValvePosition == 3) and self.BLDisconnect and (self.TLDisconnect or self.BrakeLinePressure > math.min(4.3,self.TrainToBrakeReducedPressure)) then
|
||||
self:equalizePressure(dT,"BrakeLinePressure", math.min(4.3,self.TrainToBrakeReducedPressure), pr_speed,pz_speed, nil, 2.5)
|
||||
end
|
||||
|
||||
-- 013: 4 4.0 Atm
|
||||
if (self.RealDriverValvePosition == 4) and self.BLDisconnect and (self.TLDisconnect or self.BrakeLinePressure > 1.01*math.min(4.0,self.TrainToBrakeReducedPressure)) then
|
||||
self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(4.0,self.TrainToBrakeReducedPressure), pr_speed,pz_speed, nil, 2.5)
|
||||
if (self.RealDriverValvePosition == 4) and self.BLDisconnect and (self.TLDisconnect or self.BrakeLinePressure > math.min(4.0,self.TrainToBrakeReducedPressure)) then
|
||||
self:equalizePressure(dT,"BrakeLinePressure", math.min(4.0,self.TrainToBrakeReducedPressure), pr_speed,pz_speed, nil, 2.5)
|
||||
end
|
||||
|
||||
-- 013: 5 3.7 Atm
|
||||
if (self.RealDriverValvePosition == 5) and self.BLDisconnect and (self.TLDisconnect or self.BrakeLinePressure > 1.01*math.min(3.7,self.TrainToBrakeReducedPressure)) then
|
||||
self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(3.7,self.TrainToBrakeReducedPressure), pr_speed,pz_speed, nil, 2.5)
|
||||
if (self.RealDriverValvePosition == 5) and self.BLDisconnect and (self.TLDisconnect or self.BrakeLinePressure > math.min(3.7,self.TrainToBrakeReducedPressure)) then
|
||||
self:equalizePressure(dT,"BrakeLinePressure", math.min(3.7,self.TrainToBrakeReducedPressure), pr_speed,pz_speed, nil, 2.5)
|
||||
end
|
||||
|
||||
-- 013: 6 3.0 Atm
|
||||
if (self.RealDriverValvePosition == 6) and self.BLDisconnect and (self.TLDisconnect or self.BrakeLinePressure > 1.01*math.min(3.0,self.TrainToBrakeReducedPressure)) then
|
||||
self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(3.0,self.TrainToBrakeReducedPressure), pr_speed,pz_speed, nil, 2.5)
|
||||
if (self.RealDriverValvePosition == 6) and self.BLDisconnect and (self.TLDisconnect or self.BrakeLinePressure > math.min(3.0,self.TrainToBrakeReducedPressure)) then
|
||||
self:equalizePressure(dT,"BrakeLinePressure", math.min(3.0,self.TrainToBrakeReducedPressure), pr_speed,pz_speed, nil, 2.5)
|
||||
end
|
||||
|
||||
-- 013: 7 0.0 Atm
|
||||
@@ -913,11 +912,15 @@ function TRAIN_SYSTEM:Think(dT)
|
||||
lmOpen = Train[m..tostring(9-i)].Value > 0
|
||||
rmClose = Train[n..i].Value > 0
|
||||
lmClose = Train[n..tostring(9-i)].Value > 0
|
||||
self.LeftDoorState[i] = math.Clamp(self.LeftDoorState[i] + (not llocked and ((lmOpen and 1.5 or lmClose and -1.5 or 0) +
|
||||
(self.DoorLinePressure > 1.0 and (math.Round(self.LeftDoorOpenCylPressure - self.LeftDoorCloseCylPressure,1))*0.36*(not (lmOpen or lmClose) and self.LeftDoorSpeed[i] or 1) or 0))*dT or 0),self.LeftDoorStuck[i] and 0.3 or 0,1)
|
||||
self.RightDoorState[i] = math.Clamp(self.RightDoorState[i] + (not rlocked and ((rmOpen and 1.5 or rmClose and -1.5 or 0) +
|
||||
(self.DoorLinePressure > 1.0 and (math.Round(self.RightDoorOpenCylPressure - (i == 1 and self._1stRightDoorCloseCylPressure or self.RightDoorCloseCylPressure),1))*0.36*(not (rmOpen or rmClose) and self.RightDoorSpeed[i] or 1) or 0))*dT or 0),self.RightDoorStuck[i] and 0.3 or 0,1)
|
||||
--self.LeftDoorState[i] = math.Clamp(self.LeftDoorState[i] + (not llocked and ((lmOpen and 1.5 or lmClose and -1.5 or 0) +
|
||||
-- (self.DoorLinePressure > 1.0 and (math.Round(self.LeftDoorOpenCylPressure - self.LeftDoorCloseCylPressure,1))*0.36*(not (lmOpen or lmClose) and self.LeftDoorSpeed[i] or 1) or 0))*dT or 0),self.LeftDoorStuck[i] and 0.3 or 0,1)
|
||||
--self.RightDoorState[i] = math.Clamp(self.RightDoorState[i] + (not rlocked and ((rmOpen and 1.5 or rmClose and -1.5 or 0) +
|
||||
-- (self.DoorLinePressure > 1.0 and (math.Round(self.RightDoorOpenCylPressure - (i == 1 and self._1stRightDoorCloseCylPressure or self.RightDoorCloseCylPressure),1))*0.36*(not (rmOpen or rmClose) and self.RightDoorSpeed[i] or 1) or 0))*dT or 0),self.RightDoorStuck[i] and 0.3 or 0,1)
|
||||
|
||||
self.LeftDoorState[i] = math.Clamp(self.LeftDoorState[i] + (not llocked and ((lmOpen and 1.5 or lmClose and -1.5 or 0) +
|
||||
(self.DoorLinePressure > 1.0 and (self.LeftDoorOpenCylPressure - self.LeftDoorCloseCylPressure)*0.36*(not (lmOpen or lmClose) and self.LeftDoorSpeed[i] or 1) or 0))*dT or 0),self.LeftDoorStuck[i] and 0.3 or 0,1)
|
||||
self.RightDoorState[i] = math.Clamp(self.RightDoorState[i] + (not rlocked and ((rmOpen and 1.5 or rmClose and -1.5 or 0) +
|
||||
(self.DoorLinePressure > 1.0 and (self.RightDoorOpenCylPressure - (i == 1 and self._1stRightDoorCloseCylPressure or self.RightDoorCloseCylPressure))*0.36*(not (rmOpen or rmClose) and self.RightDoorSpeed[i] or 1) or 0))*dT or 0),self.RightDoorStuck[i] and 0.3 or 0,1)
|
||||
if not Train.LeftDoorsOpen and self.LeftDoorState[i] > 0.02 then --was 0.06
|
||||
Train.LeftDoorsOpen = true
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user