mirror of
https://github.com/metrostroi-repo/MetrostroiAddon.git
synced 2026-05-02 00:42:29 +00:00
Добавил срывной клапан и увеличил громкость шипения воздуха при отпуске вентилей замещения
This commit is contained in:
@@ -2087,6 +2087,21 @@ ENT.ButtonMap["AirDistributor"] = {
|
||||
}
|
||||
}
|
||||
|
||||
ENT.ButtonMap["AutostopValve"] = {
|
||||
pos = Vector(365.8,-67.6,-56),
|
||||
ang = Angle(0,0,90),
|
||||
width = 130,
|
||||
height = 40,
|
||||
scale = 0.1,
|
||||
hideseat=0.1,
|
||||
hide=true,
|
||||
screenHide = true,
|
||||
|
||||
buttons = {
|
||||
{ID = "AutostopValveSet",x=0,y=0,w= 130,h = 40,tooltip="Сорвать срывной клапан"},
|
||||
}
|
||||
}
|
||||
|
||||
for i=0,4 do
|
||||
ENT.ClientProps["TrainNumberL"..i] = {
|
||||
model = "models/metrostroi_train/common/bort_numbers.mdl",
|
||||
@@ -3190,8 +3205,8 @@ function ENT:Think()
|
||||
--self:SetSoundState("rolling_medium1",0 or rol40*rollings,rol40p) --57
|
||||
self:SetSoundState("rolling_high2" ,rol70*rollings,rol70p) --70
|
||||
|
||||
self.ReleasedPdT = math.Clamp(self.ReleasedPdT + 2*(-self:GetPackedRatio("BrakeCylinderPressure_dPdT",0)-self.ReleasedPdT)*dT,0,1)
|
||||
local release1 = math.Clamp((self.ReleasedPdT-0.1)/0.8,0,1)^2
|
||||
self.ReleasedPdT = math.Clamp(self.ReleasedPdT + 2*(-self:GetPackedRatio("BrakeCylinderPressure_dPdT",0)-0.8*self.ReleasedPdT)*dT,0,1)
|
||||
local release1 = math.Clamp((1.1*self.ReleasedPdT-0.1)/0.32,0,8)^2
|
||||
self:SetSoundState("release1",release1,1)
|
||||
self:SetSoundState("release2",(math.Clamp(0.3-release1,0,0.3)/0.3)*(release1/0.3),1.0)
|
||||
local parking_brake = self:GetPackedRatio("ParkingBrakePressure_dPdT",0)
|
||||
@@ -3409,6 +3424,9 @@ function ENT:DrawPost()
|
||||
self:DrawOnPanel("AirDistributor",function()
|
||||
draw.DrawText(self:GetNW2Bool("AD") and "Air Distributor ON" or "Air Distributor OFF","Trebuchet24",0,0,Color(0,0,0,255))
|
||||
end)
|
||||
self:DrawOnPanel("AutostopValve",function()
|
||||
draw.DrawText("Autostop Valve", "Trebuchet24",0,6,Color(0,0,0,255))
|
||||
end)
|
||||
end
|
||||
|
||||
function ENT:OnButtonPressed(button)
|
||||
|
||||
@@ -200,6 +200,10 @@ function ENT:Initialize()
|
||||
ID = "AirDistributorDisconnectToggle",
|
||||
Pos = Vector(-177, -66, -50), Radius = 20,
|
||||
},
|
||||
{
|
||||
ID = "AutostopValveToggle",
|
||||
Pos = Vector(377, -66, -50), Radius = 20,
|
||||
},
|
||||
}
|
||||
|
||||
local vX = Angle(0,-90-0.2,56.3):Forward() -- For ARS panel
|
||||
|
||||
@@ -175,8 +175,13 @@ function TRAIN_SYSTEM:TriggerInput(name,value)
|
||||
local HaveUAVA = not self.Train.SubwayTrain or not self.Train.SubwayTrain.ARS or not self.Train.SubwayTrain.ARS.NoUAVA
|
||||
if HaveUAVA and self.Train.UAVA.Value == 0 then
|
||||
self.EmergencyValve = true
|
||||
self.Train.UAVAC:TriggerInput("Set",0)
|
||||
if value > 0 then RunConsoleCommand("say","Autostop braking",self.Train:GetDriverName()) end
|
||||
if value ~= 2 then
|
||||
self.Train.UAVAC:TriggerInput("Set",0)
|
||||
if not self.Train.autosaid then
|
||||
self.Train.autosaid = true
|
||||
RunConsoleCommand("say","Autostop braking",self.Train:GetDriverName())
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -317,7 +322,9 @@ function TRAIN_SYSTEM:Think(dT)
|
||||
self.ParkingBrakePressure_dPdT = 0.0
|
||||
self.WorkingChamberPressure_dPdT = 0.0
|
||||
|
||||
self.KM013offset = self.KM013offset or math.random()*0.2 + 5.0 --регулировочное давление
|
||||
local rnd = math.random(1,10)
|
||||
local offs = 0.1
|
||||
self.KM013offset = self.KM013offset or math.Clamp(5.1 + (rnd >= 3 and rnd <= 7 and offs or -offs),5.0,5.2)
|
||||
|
||||
-- Reduce pressure for brake line
|
||||
self.TrainToBrakeReducedPressure = math.min(self.KM013offset,self.TrainLinePressure) -- * 0.725)
|
||||
@@ -328,11 +335,10 @@ function TRAIN_SYSTEM:Think(dT)
|
||||
local HaveEPK = not Train.SubwayTrain or not Train.SubwayTrain.ARS or not Train.SubwayTrain.ARS.NoEPK
|
||||
|
||||
local BLDisconnect,pr_speed = true,1
|
||||
---[[ работа срывного клапана
|
||||
if Train.AutostopValve.Value ~= 0 then
|
||||
if self.BrakeLinePressure > 1.86 then self:TriggerInput("Autostop",1) end
|
||||
Train.AutostopValve.Value = 0
|
||||
end--]]
|
||||
-- работа срывного клапана
|
||||
if Train.AutostopValve.Value > 0 then
|
||||
self:TriggerInput("Autostop",self.BrakeLinePressure > 1.86 and 1 or 2) --value == 2 — просто открыть срывной клапан без размыкания контактов УАВА
|
||||
end
|
||||
|
||||
if self.ValveType == 1 then
|
||||
BLDisconnect = Train.DriverValveBLDisconnect.Value > 0
|
||||
@@ -459,13 +465,14 @@ function TRAIN_SYSTEM:Think(dT)
|
||||
if self.EmergencyValveDisable then--and (self.BrakeLinePressure-self.OldBrakeLinePressure)>0.01 then
|
||||
self.EmergencyValveDisable=false
|
||||
self.EmergencyValve=false
|
||||
Train.autosaid=false
|
||||
end
|
||||
self.OldBrakeLinePressure = self.BrakeLinePressure
|
||||
local leak = 0
|
||||
if self.EmergencyValve then
|
||||
local leakst = BLDisconnect and math.max(0.3,math.log(80*self.BrakeLinePressure - 200,3)) or 1.1*(Train:GetWagonCount())*math.Clamp(self.BrakeLinePressure/4,0,1)
|
||||
leak = self:equalizePressure(dT,"BrakeLinePressure", 0.0,leakst)--,false,false,10)
|
||||
if (self.BrakeLinePressure < 1.82 or Train.UAVA.Value > 0) then
|
||||
if Train.UAVA.Value > 0 or (self.BrakeLinePressure < 1.82 and Train.AutostopValve.Value == 0) then --пока держим ЛКМ нажатой, срывной клапан открыт
|
||||
self.EmergencyValveDisable = true
|
||||
end
|
||||
self.Leak = true
|
||||
|
||||
Reference in New Issue
Block a user