1
0
mirror of https://github.com/metrostroi-repo/MetrostroiAddon.git synced 2026-05-02 00:42:29 +00:00

manual door control for 81-717/714 added

This commit is contained in:
Moon Horse
2024-12-20 19:30:03 +03:00
parent 633a65c806
commit d084511350
35 changed files with 2856 additions and 276 deletions

View File

@@ -9,8 +9,8 @@ ENT.SyncTable = {
"A22","A30","A1","A2","A3","A4","A5","A6","A72","A38","A20",
"A25","A37","A55","A45","A66","A51","A65","A28","A70","AV2",
"AV3","AV4","AV5","A81","AV6","A80","A18",
"VB","GV",
"DriverValveBLDisconnect","DriverValveTLDisconnect","ParkingBrake",
"VB","GV","IDLK1","IDLK2","IDLK3","IDLK4","IDLK5","IDLK6","IDLK7","IDLK8",
"DriverValveBLDisconnect","DriverValveTLDisconnect","ParkingBrake","DVRDisconnect","DoorReleaseLeft","DoorReleaseRight",
"A84","BPSNon","ConverterProtection","L_1","OtklBV","Start","VozvratRP","EmergencyBrakeValve"
}
@@ -142,9 +142,25 @@ function ENT:Initialize()
[31] = 32, -- Doors L<->R
}
self.OldPedestrianCount = 0
self.Lamps = {
broken = {},
}
self.d_slow_speeds = {
{0.4, 0.8},
--{0.3, 0.4},
--{0.2, 0.3},
--{0.3, 0.4},
--{0.2, 0.3},
}
self.d_fast_speeds = {
{1.2, 1.8},
--{1.7, 1.8},
--{1.8, 1.9},
--{1.7, 1.8},
--{2.1, 2.2},
}
local rand = math.random() > 0.8 and 1 or math.random(0.95,0.99)
for i = 1,27 do
if math.random() > rand then self.Lamps.broken[i] = math.random() > 0.5 end
@@ -239,6 +255,9 @@ function ENT:TrainSpawnerUpdate()
self.CompressorEfficiency = math.random()*0.05 + 0.02
self.AirConsumeRatio = math.random()*0.04 + 0.06
self.AirLeakRatio = math.random()*0.002 + 0.001
self.DVRLag = math.random()*0.5
self.DVRHiss = math.random(2,5)
self.d_speeds = nil
if self.CustomSettings then
local dot5 = self:GetNW2Int("Type")==2
@@ -296,6 +315,9 @@ function ENT:TrainSpawnerUpdate()
self.Pneumatic.ValveType = self:GetNW2Int("Crane",1)
self.Announcer.AnnouncerType = self:GetNW2Int("Announcer",1)
self.DoorSpeedsDone = false
self.StuckSet = nil
self.WorkingLights = 6
self:SetPackedBool("Crane013",self.Pneumatic.ValveType == 2)
self:UpdateTextures()
@@ -356,6 +378,28 @@ function ENT:Think()
(Pneumatic.RightDoorState[3] > 0.5) or
(Pneumatic.RightDoorState[4] > 0.5)
if self.Speed > 1 and not self.LeftDoorsOpen and not self.RightDoorsOpen and not self.PedChecked then
self.OldPedestrianCount = self:GetNW2Float("PassengerCount")
self.PedChecked = true
self.left_side = nil
self.StuckSet = false
end
if not self.StuckSet then
local passenger_count = self:GetNW2Float("PassengerCount")
if self.Speed < 1 and math.abs(self.OldPedestrianCount - passenger_count) >= 1 and self.left_side == nil then
self.OldPedestrianCount = self:GetNW2Float("PassengerCount")
self.left_side = self.Pneumatic.DoorLeft or false
self.PedChecked = false
end
if self.left_side ~= nil then
if not (self.Pneumatic.DoorLeft or self.Pneumatic.DoorRight) then
local luava = math.random()
self["CanStuckPassenger"..(self.left_side and "Left" or "Right")] = (1-passenger_count/200) < luava and luava < 1 and 1--0.912 < luava and luava < 0.987
self.StuckSet = true
if self.CanStuckPassengerLeft or self.CanStuckPassengerRight then print(self,"passenger to be caught! :D") end
end
end
end
--self:SetPackedRatio("Crane", Pneumatic.RealDriverValvePosition)
--self:SetPackedRatio("Controller", (self.KV.ControllerPosition+3)/7)
if Pneumatic.ValveType == 1 then
@@ -485,7 +529,7 @@ function ENT:OnButtonPress(button,ply)
if self.CouchCap and self.Pneumatic.DriverValvePosition>2 then return end
self.CouchCap = not self.CouchCap
end
if not self.CouchCap and (not button:find("VB") and not button:find("GV") and not button:find("Isolation") and not button:find("Parking") and not button:find("Air")) then return true end
--if not self.CouchCap and (not button:find("VB") and not button:find("GV") and not button:find("Isolation") and not button:find("Parking") and not button:find("Air")) then return true end
if button == "DriverValveDisconnect" then
if self.DriverValveBLDisconnect.Value == 0 or self.DriverValveTLDisconnect.Value == 0 then