mirror of
https://github.com/metrostroi-repo/MetrostroiAddon.git
synced 2026-05-02 00:42:29 +00:00
Правка стилистики кода в соответствии с замечаниями ревьюера
This commit is contained in:
@@ -561,7 +561,7 @@ function ENT:Think()
|
|||||||
local power = Panel.V1 > -1.5
|
local power = Panel.V1 > -1.5
|
||||||
local brightness = math.min(1,Panel.Headlights1)*0.60 +
|
local brightness = math.min(1,Panel.Headlights1)*0.60 +
|
||||||
math.min(1,Panel.Headlights2)*0.40
|
math.min(1,Panel.Headlights2)*0.40
|
||||||
|
local T = {}
|
||||||
|
|
||||||
self:SetPackedBool("Headlights1",Panel.Headlights1 > 0)
|
self:SetPackedBool("Headlights1",Panel.Headlights1 > 0)
|
||||||
self:SetPackedBool("Headlights2",Panel.Headlights2 > 0)
|
self:SetPackedBool("Headlights2",Panel.Headlights2 > 0)
|
||||||
@@ -588,7 +588,13 @@ function ENT:Think()
|
|||||||
self:SetPackedBool("lightsActive"..i,false)
|
self:SetPackedBool("lightsActive"..i,false)
|
||||||
end
|
end
|
||||||
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
|
-- Door button lights
|
||||||
self:SetPackedBool("DoorsLeftL",Panel.DoorsLeft > 0.5)
|
self:SetPackedBool("DoorsLeftL",Panel.DoorsLeft > 0.5)
|
||||||
|
|||||||
@@ -978,7 +978,7 @@ ENT.Spawner = {
|
|||||||
ent.L_3:TriggerInput("Set",val==1 and 1 or 0)
|
ent.L_3:TriggerInput("Set",val==1 and 1 or 0)
|
||||||
ent.L_4: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.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()
|
_LastSpawner=CurTime()
|
||||||
ent.CabinDoor = val==4 and first
|
ent.CabinDoor = val==4 and first
|
||||||
ent.PassengerDoor = val==4
|
ent.PassengerDoor = val==4
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ ENT.Spawner = {
|
|||||||
ent.L_3:TriggerInput("Set",val==1 and 1 or 0)
|
ent.L_3:TriggerInput("Set",val==1 and 1 or 0)
|
||||||
ent.L_4: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.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()
|
_LastSpawner=CurTime()
|
||||||
ent.CabinDoor = val==4 and first
|
ent.CabinDoor = val==4 and first
|
||||||
ent.PassengerDoor = val==4
|
ent.PassengerDoor = val==4
|
||||||
@@ -111,7 +111,7 @@ ENT.Spawner = {
|
|||||||
ent._SpawnerStarted = val
|
ent._SpawnerStarted = val
|
||||||
end
|
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.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
|
ent.Pneumatic.WorkingChamberPressure = val==3 and math.random()*1.0 or val==2 and 4.0+math.random()*1.0 or 5.2
|
||||||
end},
|
end},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ function TRAIN_SYSTEM:SolveAllInternalCircuits(Train,dT,firstIter)
|
|||||||
if isMVM then
|
if isMVM then
|
||||||
Train:WriteTrainWire(71,S["33D"]*Train.OtklBV.Value)
|
Train:WriteTrainWire(71,S["33D"]*Train.OtklBV.Value)
|
||||||
end
|
end
|
||||||
Train.RPvozvrat.VozRpPressed = T[17]~=0
|
Train.RPvozvrat.VozRpPressed = T[17]
|
||||||
--Вагонная часть
|
--Вагонная часть
|
||||||
S["10A"] = BO*Train.A30.Value
|
S["10A"] = BO*Train.A30.Value
|
||||||
S["ZR"] = (1-Train.RRP.Value)+(B*Train.A39.Value*(1-Train.RPvozvrat.Value)*Train.RRP.Value)*-1
|
S["ZR"] = (1-Train.RRP.Value)+(B*Train.A39.Value*(1-Train.RPvozvrat.Value)*Train.RRP.Value)*-1
|
||||||
|
|||||||
@@ -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(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)
|
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.LST = T[6]*Train.A40.Value
|
||||||
Panel.LhRK = (T[2]+T[-2])*Train.A57.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]
|
Panel.L1 = T[57]
|
||||||
end
|
end
|
||||||
Panel.M8 = S["V2"]*Train.PVK.Value
|
Panel.M8 = S["V2"]*Train.PVK.Value
|
||||||
Train.RPvozvrat.VozRpPressed = T[17]~=0
|
Train.RPvozvrat.VozRpPressed = T[17]
|
||||||
|
|
||||||
|
|
||||||
Train.C1:TriggerInput("Set", T[1])
|
Train.C1:TriggerInput("Set", T[1])
|
||||||
Panel.IST = Train.C1.Value*Train.VKST.Value*T[64]
|
Panel.IST = Train.C1.Value*Train.VKST.Value*T[64]
|
||||||
|
|||||||
@@ -323,7 +323,7 @@ function TRAIN_SYSTEM:Think(dT)
|
|||||||
self.ReservoirPressure_dPdT = 0.0
|
self.ReservoirPressure_dPdT = 0.0
|
||||||
self.BrakeCylinderPressure_dPdT = 0.0
|
self.BrakeCylinderPressure_dPdT = 0.0
|
||||||
self.ParkingBrakePressure_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 rnd = math.random(1,10)
|
||||||
local offs = 0.1
|
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
|
local TLDisconnect = self.DisconnectType and Train.DriverValveTLDisconnect.Value > 0 or Train.DriverValveDisconnect.Value > 0
|
||||||
-- 013: 1 Overcharge
|
-- 013: 1 Overcharge
|
||||||
if (self.RealDriverValvePosition == 1) and BLDisconnect and (TLDisconnect or self.BrakeLinePressure > self.TrainLinePressure) then
|
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
|
end
|
||||||
|
|
||||||
-- 013: 2 Normal pressure
|
-- 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
|
if self.EmergencyValveDisable then--and (self.BrakeLinePressure-self.OldBrakeLinePressure)>0.01 then
|
||||||
self.EmergencyValveDisable=false
|
self.EmergencyValveDisable=false
|
||||||
self.EmergencyValve=false
|
self.EmergencyValve=false
|
||||||
Train.autosaid=false
|
Train.autosaid=false
|
||||||
end
|
end
|
||||||
self.OldBrakeLinePressure = self.BrakeLinePressure
|
self.OldBrakeLinePressure = self.BrakeLinePressure
|
||||||
local leak = 0 --math.log(80*self.BrakeLinePressure - 200,3)
|
local leak = 0 --math.log(80*self.BrakeLinePressure - 200,3)
|
||||||
if self.EmergencyValve then --math.log(self.BrakeLinePressure,1.25) - 2.5
|
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 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)
|
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 --пока держим ЛКМ нажатой, срывной клапан открыт
|
if Train.UAVA.Value > 0 or (self.BrakeLinePressure < 1.8 and Train.AutostopValve.Value == 0) then --пока держим ЛКМ нажатой, срывной клапан открыт
|
||||||
self.EmergencyValveDisable = true
|
self.EmergencyValveDisable = true
|
||||||
@@ -518,7 +518,7 @@ function TRAIN_SYSTEM:Think(dT)
|
|||||||
if self.WCChargeValve == true then
|
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
|
self:equalizePressure(dT,"WorkingChamberPressure",self.BrakeLinePressure,0.187,nil,nil,1.0) --simulate 0.8mm hole btw BL and working chambers
|
||||||
end
|
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.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
|
self.OverchargeReleaseValve = self.WorkingChamberPressure > 5.2 and not self.WCChargeValve
|
||||||
if self.OverchargeReleaseValve then
|
if self.OverchargeReleaseValve then
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ function TRAIN_SYSTEM:Initialize()
|
|||||||
latched = true, -- RPvozvrat latches into place
|
latched = true, -- RPvozvrat latches into place
|
||||||
power_open = "None", -- Power source for the open signal
|
power_open = "None", -- Power source for the open signal
|
||||||
power_close = "Mechanical", -- Power source for the close 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
|
-- Реле времени РВ1
|
||||||
@@ -94,7 +94,8 @@ function TRAIN_SYSTEM:Think()
|
|||||||
end
|
end
|
||||||
--self.RUTTarget = 250 + 150*self.Train.Pneumatic.WeightLoadRatio
|
--self.RUTTarget = 250 + 150*self.Train.Pneumatic.WeightLoadRatio
|
||||||
-- RPvozvrat operation
|
-- 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.DR1.Value == 1.0) or
|
||||||
(Train.DR2.Value == 1.0) or
|
(Train.DR2.Value == 1.0) or
|
||||||
(Train.RPL.Value == 1.0) or
|
(Train.RPL.Value == 1.0) or
|
||||||
|
|||||||
Reference in New Issue
Block a user