From 57df2595ecc9622bc7804a97966b3cf2f264e3a4 Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Wed, 12 Jan 2022 02:32:11 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B0=20=D1=81?= =?UTF-8?q?=D1=82=D0=B8=D0=BB=D0=B8=D1=81=D1=82=D0=B8=D0=BA=D0=B8=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=B4=D0=B0=20=D0=B2=20=D1=81=D0=BE=D0=BE=D1=82=D0=B2?= =?UTF-8?q?=D0=B5=D1=82=D1=81=D1=82=D0=B2=D0=B8=D0=B8=20=D1=81=20=D0=B7?= =?UTF-8?q?=D0=B0=D0=BC=D0=B5=D1=87=D0=B0=D0=BD=D0=B8=D1=8F=D0=BC=D0=B8=20?= =?UTF-8?q?=D1=80=D0=B5=D0=B2=D1=8C=D1=8E=D0=B5=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/entities/gmod_subway_81-717_mvm/init.lua | 10 ++++++++-- lua/entities/gmod_subway_81-717_mvm/shared.lua | 2 +- lua/entities/gmod_subway_81-717_mvm_custom.lua | 4 ++-- lua/metrostroi/systems/sys_81_714_electric.lua | 2 +- lua/metrostroi/systems/sys_81_717_electric.lua | 8 +------- lua/metrostroi/systems/sys_81_717_pneumatic.lua | 10 +++++----- lua/metrostroi/systems/sys_yar_13b.lua | 5 +++-- 7 files changed, 21 insertions(+), 20 deletions(-) diff --git a/lua/entities/gmod_subway_81-717_mvm/init.lua b/lua/entities/gmod_subway_81-717_mvm/init.lua index eadf909..412fc78 100644 --- a/lua/entities/gmod_subway_81-717_mvm/init.lua +++ b/lua/entities/gmod_subway_81-717_mvm/init.lua @@ -561,7 +561,7 @@ function ENT:Think() local power = Panel.V1 > -1.5 local brightness = math.min(1,Panel.Headlights1)*0.60 + math.min(1,Panel.Headlights2)*0.40 - + local T = {} self:SetPackedBool("Headlights1",Panel.Headlights1 > 0) self:SetPackedBool("Headlights2",Panel.Headlights2 > 0) @@ -588,7 +588,13 @@ function ENT:Think() self:SetPackedBool("lightsActive"..i,false) end end - + + -- "" 54 + T[4] = self:ReadTrainWire(4) + T[5] = self:ReadTrainWire(5) + if T[4]*T[5] > 0 then + self.A54:TriggerInput("Set",0) + end -- Door button lights self:SetPackedBool("DoorsLeftL",Panel.DoorsLeft > 0.5) diff --git a/lua/entities/gmod_subway_81-717_mvm/shared.lua b/lua/entities/gmod_subway_81-717_mvm/shared.lua index 77d7823..3b92104 100644 --- a/lua/entities/gmod_subway_81-717_mvm/shared.lua +++ b/lua/entities/gmod_subway_81-717_mvm/shared.lua @@ -978,7 +978,7 @@ ENT.Spawner = { ent.L_3:TriggerInput("Set",val==1 and 1 or 0) ent.L_4:TriggerInput("Set",val==1 and 1 or 0) ent.EPK:TriggerInput("Set",(ent.Plombs.RC1 and val==1) and 1 or 0) - ent.DriverValveDisconnect:TriggerInput("Set",(val==4 and first) and 1 or 0) + ent.DriverValveDisconnect:TriggerInput("Set",(val==4 and first) and 1 or 0) _LastSpawner=CurTime() ent.CabinDoor = val==4 and first ent.PassengerDoor = val==4 diff --git a/lua/entities/gmod_subway_81-717_mvm_custom.lua b/lua/entities/gmod_subway_81-717_mvm_custom.lua index bdfba15..843d2be 100644 --- a/lua/entities/gmod_subway_81-717_mvm_custom.lua +++ b/lua/entities/gmod_subway_81-717_mvm_custom.lua @@ -92,7 +92,7 @@ ENT.Spawner = { ent.L_3:TriggerInput("Set",val==1 and 1 or 0) ent.L_4:TriggerInput("Set",val==1 and 1 or 0) ent.EPK:TriggerInput("Set",(ent.Plombs.RC1 and val==1) and 1 or 0) - ent.DriverValveDisconnect:TriggerInput("Set",(val==4 and first) and 1 or 0) + ent.DriverValveDisconnect:TriggerInput("Set",(val==4 and first) and 1 or 0) _LastSpawner=CurTime() ent.CabinDoor = val==4 and first ent.PassengerDoor = val==4 @@ -111,7 +111,7 @@ ENT.Spawner = { ent._SpawnerStarted = val end ent.Pneumatic.TrainLinePressure = val==3 and math.random()*4 or val==2 and 4.5+math.random()*3 or 7.6+math.random()*0.6 - ent.Pneumatic.BrakeLinePressure = val == 4 and 5.2 or val == 1 and 2.3 or math.min(ent.Pneumatic.TrainLinePressure+0.25,math.random()*4) + ent.Pneumatic.BrakeLinePressure = val == 4 and 5.2 or val == 1 and 2.3 or math.min(ent.Pneumatic.TrainLinePressure+0.25,math.random()*4) ent.Pneumatic.WorkingChamberPressure = val==3 and math.random()*1.0 or val==2 and 4.0+math.random()*1.0 or 5.2 end}, } diff --git a/lua/metrostroi/systems/sys_81_714_electric.lua b/lua/metrostroi/systems/sys_81_714_electric.lua index b597ac3..696fd1e 100644 --- a/lua/metrostroi/systems/sys_81_714_electric.lua +++ b/lua/metrostroi/systems/sys_81_714_electric.lua @@ -78,7 +78,7 @@ function TRAIN_SYSTEM:SolveAllInternalCircuits(Train,dT,firstIter) if isMVM then Train:WriteTrainWire(71,S["33D"]*Train.OtklBV.Value) end - Train.RPvozvrat.VozRpPressed = T[17]~=0 + Train.RPvozvrat.VozRpPressed = T[17] --Вагонная часть S["10A"] = BO*Train.A30.Value S["ZR"] = (1-Train.RRP.Value)+(B*Train.A39.Value*(1-Train.RPvozvrat.Value)*Train.RRP.Value)*-1 diff --git a/lua/metrostroi/systems/sys_81_717_electric.lua b/lua/metrostroi/systems/sys_81_717_electric.lua index c1bcce0..c3e7644 100644 --- a/lua/metrostroi/systems/sys_81_717_electric.lua +++ b/lua/metrostroi/systems/sys_81_717_electric.lua @@ -89,11 +89,6 @@ function TRAIN_SYSTEM:SolveAllInternalCircuits(Train,dT,firstIter) Train:WriteTrainWire(5,S["10AK"]*KV["10AK-5"] + KRU["5/3-ZM31"]*-10) Train:WriteTrainWire(4,S["10AK"]*KV["10AK-4"] + --[[max(0,min(1,T[4])*KV["4-0"]*-10)]]KV["4-0"]*-10) - if T[4]*KV["4-0"] ~= 0 then - Train.A54:TriggerInput("Set",0) - Train:WriteTrainWire(5,0) - end - --Train:WriteTrainWire(4,S["10AK"]*KV["10AK-4"]*(1-T[4]*KV["4-0"]*-10)) Panel.LST = T[6]*Train.A40.Value Panel.LhRK = (T[2]+T[-2])*Train.A57.Value @@ -455,8 +450,7 @@ function TRAIN_SYSTEM:SolveAllInternalCircuits(Train,dT,firstIter) Panel.L1 = T[57] end Panel.M8 = S["V2"]*Train.PVK.Value - Train.RPvozvrat.VozRpPressed = T[17]~=0 - + Train.RPvozvrat.VozRpPressed = T[17] Train.C1:TriggerInput("Set", T[1]) Panel.IST = Train.C1.Value*Train.VKST.Value*T[64] diff --git a/lua/metrostroi/systems/sys_81_717_pneumatic.lua b/lua/metrostroi/systems/sys_81_717_pneumatic.lua index 40c3a98..f7579c9 100644 --- a/lua/metrostroi/systems/sys_81_717_pneumatic.lua +++ b/lua/metrostroi/systems/sys_81_717_pneumatic.lua @@ -323,7 +323,7 @@ function TRAIN_SYSTEM:Think(dT) self.ReservoirPressure_dPdT = 0.0 self.BrakeCylinderPressure_dPdT = 0.0 self.ParkingBrakePressure_dPdT = 0.0 - self.WorkingChamberPressure_dPdT = 0.0 + self.WorkingChamberPressure_dPdT = 0.0 local rnd = math.random(1,10) local offs = 0.1 @@ -400,7 +400,7 @@ function TRAIN_SYSTEM:Think(dT) local TLDisconnect = self.DisconnectType and Train.DriverValveTLDisconnect.Value > 0 or Train.DriverValveDisconnect.Value > 0 -- 013: 1 Overcharge if (self.RealDriverValvePosition == 1) and BLDisconnect and (TLDisconnect or self.BrakeLinePressure > self.TrainLinePressure) then - self:equalizePressure(dT,"BrakeLinePressure", math.min(6.4,self.TrainLinePressure), pr_speed,pr_speed*0.35, nil, 1.0) + self:equalizePressure(dT,"BrakeLinePressure", math.min(6.4,self.TrainLinePressure), pr_speed,pr_speed*0.35, nil, 1.0) end -- 013: 2 Normal pressure @@ -468,13 +468,13 @@ 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 + Train.autosaid=false end self.OldBrakeLinePressure = self.BrakeLinePressure local leak = 0 --math.log(80*self.BrakeLinePressure - 200,3) if self.EmergencyValve then --math.log(self.BrakeLinePressure,1.25) - 2.5 --local leakst = BLDisconnect and math.max(0.3,math.log(self.BrakeLinePressure,1.2) - 2.5) or 1.1*(Train:GetWagonCount())*math.Clamp(self.BrakeLinePressure/4,0,1) - local leakst = BLDisconnect and math.max(0.3,math.log(self.BrakeLinePressure,1.2) - 2.5) or math.max(1.6,math.log(0.63*self.BrakeLinePressure,1.15)) + local leakst = BLDisconnect and math.max(0.3,math.log(self.BrakeLinePressure,1.2) - 2.5) or math.max(1.6,math.log(0.63*self.BrakeLinePressure,1.15)) leak = self:equalizePressure(dT,"BrakeLinePressure", 0.0,leakst*wagc/6)--,false,false,10) if Train.UAVA.Value > 0 or (self.BrakeLinePressure < 1.8 and Train.AutostopValve.Value == 0) then --пока держим ЛКМ нажатой, срывной клапан открыт self.EmergencyValveDisable = true @@ -518,7 +518,7 @@ function TRAIN_SYSTEM:Think(dT) if self.WCChargeValve == true then self:equalizePressure(dT,"WorkingChamberPressure",self.BrakeLinePressure,0.187,nil,nil,1.0) --simulate 0.8mm hole btw BL and working chambers end - self.AirDistributorReady = self.WorkingChamberPressure >= 2.2 + self.AirDistributorReady = self.WorkingChamberPressure >= 2.2 self.WCChargeValve = not ((self.WorkingChamberPressure - self.BrakeLinePressure) > 0.2 and (self.WorkingChamberPressure - self.BrakeLinePressure) < 2.5) self.OverchargeReleaseValve = self.WorkingChamberPressure > 5.2 and not self.WCChargeValve if self.OverchargeReleaseValve then diff --git a/lua/metrostroi/systems/sys_yar_13b.lua b/lua/metrostroi/systems/sys_yar_13b.lua index 82da9b9..2a6c0fa 100644 --- a/lua/metrostroi/systems/sys_yar_13b.lua +++ b/lua/metrostroi/systems/sys_yar_13b.lua @@ -30,7 +30,7 @@ function TRAIN_SYSTEM:Initialize() latched = true, -- RPvozvrat latches into place power_open = "None", -- Power source for the open signal power_close = "Mechanical", -- Power source for the close signal - VozRpPressed = false, -- Added to override the blocking action of the energized RP relays on RPVozvrat + VozRpPressed = false, -- Added to override the blocking action of the energized RP relays on RPVozvrat }) -- Реле времени РВ1 @@ -94,7 +94,8 @@ function TRAIN_SYSTEM:Think() end --self.RUTTarget = 250 + 150*self.Train.Pneumatic.WeightLoadRatio -- RPvozvrat operation - Train.RPvozvrat:TriggerInput("Close", not Train.RPvozvrat.VozRpPressed and + local A = Train.RPvozvrat.VozRpPressed ~= 0 + Train.RPvozvrat:TriggerInput("Close", not A and ((Train.DR1.Value == 1.0) or (Train.DR2.Value == 1.0) or (Train.RPL.Value == 1.0) or