mirror of
https://github.com/metrostroi-repo/MetrostroiAddon.git
synced 2026-05-02 00:42:29 +00:00
Simulate air pressure drop while the typhoon is engaged
This commit is contained in:
@@ -670,7 +670,7 @@ function ENT:Think()
|
||||
else
|
||||
self:SetPackedRatio("BLPressure", Pneumatic.BrakeLinePressure/16.0)
|
||||
end
|
||||
self:SetPackedRatio("TLPressure", Pneumatic.TrainLinePressure/16.0)
|
||||
self:SetPackedRatio("TLPressure", Pneumatic.AuxiliaryLinePressure/16.0)
|
||||
self:SetPackedRatio("BCPressure", Pneumatic.BrakeCylinderPressure/6.0)
|
||||
self:SetPackedRatio("EnginesVoltage", self.Electric.Aux750V/1000.0)
|
||||
self:SetPackedRatio("EnginesCurrent2", 0.5 + 0.5*(self.Electric.I13/500.0))
|
||||
|
||||
@@ -1097,7 +1097,9 @@ function ENT:Think()
|
||||
|
||||
if i==1 then
|
||||
local no1 = ntbl.loop and ntbl.loop==0
|
||||
local endt = (ntbl.loop and snd:GetTime() > ntbl.loop or snd:GetTime()/snd:GetLength() >= 0.8) or no1
|
||||
--Any use of endt local was commented out to avoid unexpected interruption of the horn sound being played during air pressure reduction
|
||||
--(seems like it doesn't affect other sounds but still need to be repeatedly tested)
|
||||
--local endt = (ntbl.loop and snd:GetTime() > ntbl.loop or snd:GetTime()/snd:GetLength() >= 0.8) or no1
|
||||
if stbl.state and stbl.volume < v.volume and not no1 then
|
||||
if snd:GetState() ~= GMOD_CHANNEL_PLAYING then
|
||||
snd:Play()
|
||||
@@ -1118,7 +1120,7 @@ function ENT:Think()
|
||||
end
|
||||
stbl.time = nil
|
||||
end
|
||||
if stbl.state and endt then
|
||||
if stbl.state then --and endt then
|
||||
stbl.state = false
|
||||
if no1 then
|
||||
stbl.time = true
|
||||
|
||||
@@ -36,6 +36,8 @@ function TRAIN_SYSTEM:Initialize(parameters)
|
||||
-- Pressure in trains brake line
|
||||
self.BrakeLinePressure = 0.0 -- atm
|
||||
self.EPKPressure = 0.0 -- atm
|
||||
-- Pressure in train's auxiliary line
|
||||
self.AuxiliaryLinePressure = 8.0 -- atm
|
||||
-- Pressure in brake cylinder
|
||||
self.BrakeCylinderPressure = 0.0 -- atm
|
||||
-- Pressure in the door line
|
||||
@@ -155,7 +157,7 @@ end
|
||||
|
||||
function TRAIN_SYSTEM:Outputs()
|
||||
return { "BrakeLinePressure", "BrakeCylinderPressure", "DriverValvePosition",
|
||||
"ReservoirPressure", "TrainLinePressure", "DoorLinePressure", "WeightLoadRatio", "WorkingChamberPressure" }
|
||||
"ReservoirPressure", "TrainLinePressure", "DoorLinePressure", "WeightLoadRatio", "WorkingChamberPressure", "AuxiliaryLinePressure" }
|
||||
end
|
||||
|
||||
function TRAIN_SYSTEM:TriggerInput(name,value)
|
||||
@@ -324,6 +326,7 @@ function TRAIN_SYSTEM:Think(dT)
|
||||
self.BrakeCylinderPressure_dPdT = 0.0
|
||||
self.ParkingBrakePressure_dPdT = 0.0
|
||||
self.WorkingChamberPressure_dPdT = 0.0
|
||||
self.AuxiliaryLinePressure_dPdT = 0.0
|
||||
|
||||
local rnd = math.random(1,10)
|
||||
local offs = 0.1
|
||||
@@ -593,6 +596,10 @@ function TRAIN_SYSTEM:Think(dT)
|
||||
-- Simulate cross-feed between different wagons
|
||||
self:UpdatePressures(Train,dT)
|
||||
|
||||
-- Simulate air pressure drop while the horn is engaged
|
||||
local horny = self.Train:GetNW2Bool("HornState",false)
|
||||
self:equalizePressure(dT,"AuxiliaryLinePressure", horny and math.max(0,self.TrainLinePressure - 0.3) or self.TrainLinePressure, 22) --was 12
|
||||
self.TrainLinePressure = self.TrainLinePressure - (horny and 0.012 or 0)
|
||||
----------------------------------------------------------------------------
|
||||
-- Simulate compressor operation and train line depletion
|
||||
self.Compressor = Train.KK.Value * (Train.Electric.Aux750V > 550 and 1 or 0)
|
||||
|
||||
Reference in New Issue
Block a user