mirror of
https://github.com/metrostroi-repo/MetrostroiAddon.git
synced 2026-05-02 00:42:29 +00:00
init
This commit is contained in:
995
lua/entities/_obsolete/gmod_subway_em/cl_init.lua
Normal file
995
lua/entities/_obsolete/gmod_subway_em/cl_init.lua
Normal file
@@ -0,0 +1,995 @@
|
||||
include("shared.lua")
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
ENT.ClientProps = {}
|
||||
ENT.ButtonMap = {}
|
||||
|
||||
-- Main panel
|
||||
ENT.ButtonMap["Main"] = {
|
||||
pos = Vector(460.968903,-32.25375,0.064331),
|
||||
ang = Angle(0,-90,90-27),
|
||||
width = 315,
|
||||
height = 240,
|
||||
scale = 0.0588,
|
||||
|
||||
buttons = {
|
||||
{ID = "DIPonSet", x=35 + 48.3*0, y=96, radius=20, tooltip="КУ4:Включение ДИП и освещения\nTurn DIP and interior lights on"},
|
||||
{ID = "DIPoffSet", x=35 + 48.3*1, y=96, radius=20, tooltip="КУ5:Отключение ДИП и освещения\nTurn DIP and interior lights off"},
|
||||
{ID = "VozvratRPSet", x=35 + 48.3*2, y=96, radius=20, tooltip="КУ9:Возврат РП\nReset overload relay"},
|
||||
{ID = "KSNSet", x=35 + 48.3*3, y=96, radius=20, tooltip="КУ8:Принудительное срабатывание РП на неисправном вагоне (сигнализация неисправности)\nKSN: Failure indication button"},
|
||||
{ID = "KDPSet", x=35 + 48.3*5, y=96, radius=20, tooltip="КДП:Правые двери\nKDP: Right doors open"},
|
||||
----Down Panel
|
||||
{ID = "KU1Toggle", x=16,y=129,w=45,h=90, tooltip="КУ1:Включение мотор-компрессора\nTurn motor-compressor on"},
|
||||
{ID = "VUD1Toggle", x=248,y=129,w=45,h=90, tooltip="КУ2: Закрытие дверей\nVUD: Door control toggle (close doors)"},
|
||||
----Lamps
|
||||
--{ID = "Lamp1", x=42, y=30, radius=20, tooltip="ЛВД: Лампа включения двигателей\nLVD: Engines engaged"},
|
||||
--{ID = "Lamp6", x=86, y=30, radius=20, tooltip="ЛСТ: Лампа сигнализации торможения\nLST: Brakes engaged"},
|
||||
--{ID = "Lamp2", x=134, y=30, radius=20, tooltip="Красная лампа РК (Вращение Реостатного контроллера)\nRK: Rheostat controller motion "},
|
||||
--{ID = "DoorsWag", x=134, y=30, radius=20, tooltip="Синяя лампа СД: Сигнализация дверей вагона\nBlue door state light (doors on wagon are closed)"},
|
||||
{ID = "RedRP", x=177, y=30, radius=20, tooltip="Красная РП: Красная лампа реле перегрузки\nRP: Red overload relay (power circuits failed to assemble)"},
|
||||
{ID = "GreenRP", x=223, y=30, radius=20, tooltip="Зеленая РП: Зелёная лампа реле перегрузки (Сигнализация перегрузки)\nRP: Green overload relay (overload relay open on current train)"},
|
||||
{ID = "DoorsWag", x=265, y=30, radius=20, tooltip="Белая лампа СД: Сигнализация дверей поезда\nWhite door state light (doors on train are closed)"},
|
||||
|
||||
{ID = "KDLSet", x=92, y=169, radius=20, tooltip="КУ12: Кнопка левых дверей\nKDL: Left doors open"},
|
||||
{ID = "KRZDSet", x=212, y=169, radius=20, tooltip="КУ10: Кнопка резервного закрытия дверей\nKRZD: Emergency door closing"},
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Metrostroi.ClientPropForButton("GreenRP",{
|
||||
panel = "Main",
|
||||
button = "GreenRP",
|
||||
model = "models/metrostroi_train/e/lampgreen.mdl",
|
||||
z = 6,
|
||||
ang = 90,
|
||||
staylabel = true,
|
||||
})
|
||||
Metrostroi.ClientPropForButton("RedRP",{
|
||||
panel = "Main",
|
||||
button = "RedRP",
|
||||
model = "models/metrostroi_train/e/lampred1.mdl",
|
||||
z = 6,
|
||||
ang = 90,
|
||||
staylabel = true,
|
||||
})
|
||||
Metrostroi.ClientPropForButton("DoorsWag",{
|
||||
panel = "Main",
|
||||
button = "DoorsWag",
|
||||
model = "models/metrostroi_train/e/lampblue.mdl",
|
||||
z = 6,
|
||||
ang = 90,
|
||||
staylabel = true,
|
||||
})
|
||||
|
||||
|
||||
Metrostroi.ClientPropForButton("DIPon",{
|
||||
panel = "Main",
|
||||
button = "DIPonSet",
|
||||
model = "models/metrostroi_train/em/buttonred.mdl",
|
||||
ang = 90,
|
||||
z = 0,
|
||||
})
|
||||
Metrostroi.ClientPropForButton("DIPoff",{
|
||||
panel = "Main",
|
||||
button = "DIPoffSet",
|
||||
model = "models/metrostroi_train/em/buttonblack.mdl",
|
||||
ang = 90,
|
||||
z = 0,
|
||||
})
|
||||
Metrostroi.ClientPropForButton("VozvratRP",{
|
||||
panel = "Main",
|
||||
button = "VozvratRPSet",
|
||||
model = "models/metrostroi_train/em/buttonblack.mdl",
|
||||
ang = 90,
|
||||
z = 0,
|
||||
})
|
||||
|
||||
Metrostroi.ClientPropForButton("KSN",{
|
||||
panel = "Main",
|
||||
button = "KSNSet",
|
||||
model = "models/metrostroi_train/em/buttonred.mdl",
|
||||
ang = 90,
|
||||
z = 0,
|
||||
})
|
||||
Metrostroi.ClientPropForButton("KDP",{
|
||||
panel = "Main",
|
||||
button = "KDPSet",
|
||||
model = "models/metrostroi_train/em/buttonred.mdl",
|
||||
ang = 90,
|
||||
z = 0,
|
||||
})
|
||||
|
||||
Metrostroi.ClientPropForButton("KDL",{
|
||||
panel = "Main",
|
||||
button = "KDLSet",
|
||||
model = "models/metrostroi_train/em/buttonred.mdl",
|
||||
ang = 90,
|
||||
z = 0,
|
||||
})
|
||||
Metrostroi.ClientPropForButton("KRZD",{
|
||||
panel = "Main",
|
||||
button = "KRZDSet",
|
||||
model = "models/metrostroi_train/em/buttonblack.mdl",
|
||||
ang = 90,
|
||||
z = 0,
|
||||
})
|
||||
|
||||
Metrostroi.ClientPropForButton("VUD",{
|
||||
panel = "Main",
|
||||
button = "VUD1Toggle",
|
||||
model = "models/metrostroi_train/switches/vudwhite.mdl",
|
||||
z=-20,
|
||||
})
|
||||
Metrostroi.ClientPropForButton("KU1",{
|
||||
panel = "Main",
|
||||
button = "KU1Toggle",
|
||||
model = "models/metrostroi_train/switches/vudbrown.mdl",
|
||||
z=-20,
|
||||
})
|
||||
|
||||
ENT.ButtonMap["RezMK"] = {
|
||||
pos = Vector(469.0,-19.75,37),
|
||||
ang = Angle(0,270,90),
|
||||
width = 50,
|
||||
height = 80,
|
||||
scale = 0.0625,
|
||||
|
||||
buttons = {
|
||||
{ID = "RezMKSet", x=0, y=0, w=50, h=80, tooltip="КУ15:Резервное включение мотор-компрессора\nRezMKSet"},
|
||||
}
|
||||
}
|
||||
Metrostroi.ClientPropForButton("RezMK",{
|
||||
panel = "RezMK",
|
||||
button = "RezMKSet",
|
||||
model = "models/metrostroi_train/switches/vudblack.mdl",
|
||||
})
|
||||
|
||||
ENT.ButtonMap["AVMain"] = {
|
||||
pos = Vector(408.06,40.8,56),
|
||||
ang = Angle(0,90,90),
|
||||
width = 335,
|
||||
height = 380,
|
||||
scale = 0.0625,
|
||||
|
||||
buttons = {
|
||||
{ID = "AV8BToggle", x=0, y=0, w=300, h=380, tooltip="АВ-8Б: Автоматическй выключатель (Вспомогательные цепи высокого напряжения)\n"},
|
||||
}
|
||||
}
|
||||
Metrostroi.ClientPropForButton("AV8B",{
|
||||
panel = "AVMain",
|
||||
button = "AV8BToggle",
|
||||
model = "models/metrostroi_train/switches/automain.mdl",
|
||||
z=43,
|
||||
})
|
||||
|
||||
---AV1 Panel
|
||||
ENT.ButtonMap["AV1"] = {
|
||||
pos = Vector(408.06,41,30),
|
||||
ang = Angle(0,90,90),
|
||||
width = 290+0,
|
||||
height = 155,
|
||||
scale = 0.0625,
|
||||
|
||||
buttons = {
|
||||
{ID = "VU3Toggle", x=0, y=0, w=100, h=140, tooltip="ВУ3: Освещение кабины\n"},
|
||||
{ID = "VU2Toggle", x=100, y=0, w=100, h=140, tooltip="ВУ2: Аварийное освещение 25В\n"},
|
||||
{ID = "VU1Toggle", x=200, y=0, w=100, h=140, tooltip="ВУ1: Печь отопления кабины ПТ-6\n"},
|
||||
}
|
||||
}
|
||||
for k,v in pairs(ENT.ButtonMap["AV1"].buttons) do
|
||||
if not v.ID then continue end
|
||||
Metrostroi.ClientPropForButton(v.ID:sub(0,-7),{
|
||||
panel = "AV1",
|
||||
button = v.ID,
|
||||
model = "models/metrostroi_train/switches/autobl.mdl",
|
||||
z=10,
|
||||
})
|
||||
end
|
||||
-- Battery panel
|
||||
ENT.ButtonMap["Battery"] = {
|
||||
pos = Vector(408.98,20.24,30.5),
|
||||
ang = Angle(0,90,90),
|
||||
width = 250,
|
||||
height = 136,
|
||||
scale = 0.0625,
|
||||
|
||||
buttons = {
|
||||
{ID = "VBToggle", x=0, y=0, w=250, h=136, tooltip="АБ: Выключатель аккумуляторной батареи (Вспомогательные цепи низкого напряжения)\nVB: Battery on/off"},
|
||||
}
|
||||
}
|
||||
Metrostroi.ClientPropForButton("VB",{
|
||||
panel = "Battery",
|
||||
button = "VBToggle",
|
||||
model = "models/metrostroi_train/switches/autobl2.mdl",
|
||||
z=15,
|
||||
})
|
||||
|
||||
--VU Panel
|
||||
ENT.ButtonMap["VU"] = {
|
||||
pos = Vector(469.5,-18.5,20),
|
||||
ang = Angle(0,270,90),
|
||||
width = 90,
|
||||
height = 120,
|
||||
scale = 0.0625,
|
||||
|
||||
buttons = {
|
||||
{ID = "VUToggle", x=0, y=0, w=90, h=120, tooltip="ВУ: Выключатель Управления\nVUToggle"},
|
||||
{ID = "VUPl", x=0, y=70, w=90, h=50, tooltip="Пломба ВУ\nVU plomb"},
|
||||
}
|
||||
}
|
||||
Metrostroi.ClientPropForButton("VU",{
|
||||
panel = "VU",
|
||||
button = "VUToggle",
|
||||
model = "models/metrostroi_train/switches/autobl.mdl",
|
||||
z=20,
|
||||
})
|
||||
|
||||
Metrostroi.ClientPropForButton("VUPl",{
|
||||
panel = "VU",
|
||||
button = "VUToggle",
|
||||
model = "models/metrostroi_train/switches/autoplombr.mdl",
|
||||
z=19,
|
||||
propname = false,
|
||||
ang=0,
|
||||
})
|
||||
--[[
|
||||
Metrostroi.ClientPropForButton("AVVB",{
|
||||
panel = "BatteryAV",
|
||||
button = "AVVBToggle",
|
||||
model = "models/metrostroi_train/switches/autobl2.mdl",
|
||||
z=15,
|
||||
})
|
||||
]]
|
||||
|
||||
-- Parking brake panel
|
||||
ENT.ButtonMap["ParkingBrake"] = {
|
||||
pos = Vector(460,49.0,6.0),
|
||||
ang = Angle(0,-82,90),
|
||||
width = 400,
|
||||
height = 400,
|
||||
scale = 0.0625,
|
||||
|
||||
buttons = {
|
||||
{ID = "ParkingBrakeLeft",x=0, y=0, w=200, h=400, tooltip="Поворот колеса ручного тормоза"},
|
||||
{ID = "ParkingBrakeRight",x=200, y=0, w=200, h=400, tooltip="Поворот колеса ручного тормоза"},
|
||||
}
|
||||
}
|
||||
|
||||
-- Train driver helpers panel
|
||||
ENT.ButtonMap["HelperPanel"] = {
|
||||
pos = Vector(455.13,58.99,24.44),
|
||||
ang = Angle(0,-17.5,90),
|
||||
width = 60,
|
||||
height = 188,
|
||||
scale = 0.0625,
|
||||
|
||||
buttons = {
|
||||
{ID = "VDLSet", x=30, y=42, radius=30, tooltip="ВДЛ: Выключатель левых дверей\nVDL: Left doors open"},
|
||||
{ID = "VUD2LToggle", x=0, y=110, w=60,h=20, tooltip="Блокировка ВУД2\nVUD2 lock"},
|
||||
{ID = "VUD2Toggle", x=30, y=138, radius=30, tooltip="ВУД2: Выключатель управления дверьми\nVUD2: Door control toggle (close doors)"},
|
||||
}
|
||||
}
|
||||
Metrostroi.ClientPropForButton("VUD2",{
|
||||
panel = "HelperPanel",
|
||||
button = "VUD2Toggle",
|
||||
model = "models/metrostroi_train/switches/vudwhite.mdl",
|
||||
z = 0,
|
||||
})
|
||||
Metrostroi.ClientPropForButton("VUD2l",{
|
||||
panel = "HelperPanel",
|
||||
button = "VUD2Toggle",
|
||||
model = "models/metrostroi_train/switches/vudlock.mdl",
|
||||
z = 0,
|
||||
})
|
||||
Metrostroi.ClientPropForButton("VDL",{
|
||||
panel = "HelperPanel",
|
||||
button = "VDLSet",
|
||||
model = "models/metrostroi_train/switches/vudblack.mdl",
|
||||
z = 0,
|
||||
})
|
||||
|
||||
-- Pneumatic instrument panel 2
|
||||
ENT.ButtonMap["PneumaticManometer"] = {
|
||||
pos = Vector(459.247131,-54.307846,16.197767),
|
||||
ang = Angle(0,-90-51,90),
|
||||
|
||||
width = 70,
|
||||
height = 70,
|
||||
scale = 0.0625,
|
||||
|
||||
buttons = {
|
||||
{x=35,y=35,radius=35,tooltip="Давление в магистралях (красная: тормозной, чёрная: напорной)\nPressure in pneumatic lines (red: brake line, black: train line)"},
|
||||
}
|
||||
}
|
||||
-- Pneumatic instrument panel
|
||||
ENT.ButtonMap["PneumaticPanels"] = {
|
||||
pos = Vector(463.281189,-53.228256,11.310288),
|
||||
ang = Angle(0,-90-44,90),
|
||||
|
||||
width = 70,
|
||||
height = 70,
|
||||
scale = 0.0625,
|
||||
|
||||
buttons = {
|
||||
{x=35,y=35,radius=35,tooltip="Тормозной манометр: Давление в тормозных цилиндрах (ТЦ)\nBrake cylinder pressure"},
|
||||
}
|
||||
}
|
||||
ENT.ButtonMap["DriverValveBLDisconnect"] = {
|
||||
pos = Vector(453.57,-54.37,-27.61),
|
||||
ang = Angle(-90,0,0),
|
||||
width = 200,
|
||||
height = 90,
|
||||
scale = 0.0625,
|
||||
|
||||
buttons = {
|
||||
{ID = "DriverValveBLDisconnectToggle", x=0, y=0, w=200, h=90, tooltip="Кран двойной тяги тормозной магистрали\nTrain line disconnect valve"},
|
||||
}
|
||||
}
|
||||
ENT.ButtonMap["DriverValveTLDisconnect"] = {
|
||||
pos = Vector(455.482483,-54,-15),
|
||||
ang = Angle(90,180-11.79,0),
|
||||
width = 200,
|
||||
height = 90,
|
||||
scale = 0.0625,
|
||||
|
||||
buttons = {
|
||||
{ID = "DriverValveTLDisconnectToggle", x=0, y=0, w=200, h=90, tooltip="Кран двойной тяги напорной магистрали\nBrake line disconnect valve"},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ENT.ButtonMap["Meters"] = {
|
||||
pos = Vector(461.65213,-56.696617,37.528275),
|
||||
ang = Angle(0,-148,90),
|
||||
width = 73,
|
||||
height = 140,
|
||||
scale = 0.0625,
|
||||
|
||||
buttons = {
|
||||
{x=13, y=22, w=60, h=50, tooltip="Вольтметр высокого напряжения (кВ)\nHV voltmeter (kV)"},
|
||||
{x=13, y=81, w=60, h=50, tooltip="Амперметр (А)\nTotal ampermeter (A)"},
|
||||
}
|
||||
}
|
||||
ENT.ButtonMap["Speedometer"] = {
|
||||
pos = Vector(459.649109,-53.19582,26.624441),
|
||||
ang = Angle(0,-149,97),
|
||||
width = 110,
|
||||
height = 110,
|
||||
scale = 0.0625,
|
||||
|
||||
buttons = {
|
||||
{x=0, y=0, w=110, h=110, tooltip="Скоростемер"},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
--These values should be identical to those drawing the schedule
|
||||
local col1w = 80 -- 1st Column width
|
||||
local col2w = 32 -- The other column widths
|
||||
local rowtall = 30 -- Row height, includes -only- the usable space and not any lines
|
||||
|
||||
local rowamount = 16 -- How many rows to show (total)
|
||||
--[[ENT.ButtonMap["Schedule"] = {
|
||||
pos = Vector(442.1,-60.7,26),
|
||||
ang = Angle(0,-110,90),
|
||||
width = (col1w + 2 + (1 + col2w) * 3),
|
||||
height = (rowtall+1)*rowamount+1,
|
||||
scale = 0.0625/2,
|
||||
|
||||
buttons = {
|
||||
{x=1, y=1, w=col1w, h=rowtall, tooltip="М №\nRoute number"},
|
||||
{x=1, y=rowtall*2+3, w=col1w, h=rowtall, tooltip="П №\nPath number"},
|
||||
|
||||
{x=col1w+2, y=1, w=col2w*3+2, h=rowtall, tooltip="ВРЕМЯ ХОДА\nTotal schedule time"},
|
||||
{x=col1w+2, y=rowtall+2, w=col2w*3+2, h=rowtall, tooltip="ИНТ\nTrain interval"},
|
||||
|
||||
{x=col1w+2, y=rowtall*2+3, w=col2w, h=rowtall, tooltip="ЧАС\nHour"},
|
||||
{x=col1w+col2w+3, y=rowtall*2+3, w=col2w, h=rowtall, tooltip="МИН\nMinute"},
|
||||
{x=col1w+col2w*2+4, y=rowtall*2+3, w=col2w, h=rowtall, tooltip="СЕК\nSecond"},
|
||||
{x=col1w+2, y=rowtall*3+4, w=col2w*3+2, h=(rowtall+1)*(rowamount-3)-1, tooltip="Arrival times"}, -- NEEDS TRANSLATING
|
||||
|
||||
{x=1, y=rowtall*3+4, w=col1w, h=(rowtall+1)*(rowamount-3)-1, tooltip="Station name"}, -- NEEDS TRANSLATING
|
||||
}
|
||||
}]]
|
||||
|
||||
-- Temporary panels (possibly temporary)
|
||||
ENT.ButtonMap["FrontPneumatic"] = {
|
||||
pos = Vector(475,-45.0,-50.0),
|
||||
ang = Angle(0,90,90),
|
||||
width = 900,
|
||||
height = 100,
|
||||
scale = 0.1,
|
||||
buttons = {
|
||||
{ID = "FrontBrakeLineIsolationToggle",x=150, y=50, radius=32, tooltip="Концевой кран тормозной магистрали"},
|
||||
{ID = "FrontTrainLineIsolationToggle",x=750, y=50, radius=32, tooltip="Концевой кран напорной магистрали"},
|
||||
}
|
||||
}
|
||||
ENT.ButtonMap["RearPneumatic"] = {
|
||||
pos = Vector(-475,45.0,-50.0),
|
||||
ang = Angle(0,270,90),
|
||||
width = 900,
|
||||
height = 100,
|
||||
scale = 0.1,
|
||||
buttons = {
|
||||
{ID = "RearTrainLineIsolationToggle",x=150, y=50, radius=32, tooltip="Концевой кран напорной магистрали"},
|
||||
{ID = "RearBrakeLineIsolationToggle",x=750, y=50, radius=32, tooltip="Концевой кран тормозной магистрали"},
|
||||
}
|
||||
}
|
||||
ENT.ButtonMap["GV"] = {
|
||||
pos = Vector(139,66,-54),
|
||||
ang = Angle(0,180,90),
|
||||
width = 170,
|
||||
height = 170,
|
||||
scale = 0.1,
|
||||
buttons = {
|
||||
{ID = "GVToggle",x=0, y=0, w= 170,h = 150, tooltip="Главный выключатель", model = {
|
||||
var="GV",sndid = "gv",
|
||||
sndvol = 0.8,sndmin = 80, sndmax = 1e3/3, sndang = Angle(-90,0,0),
|
||||
snd = function(val) return val and "gv_f" or "gv_b" end,
|
||||
}},
|
||||
}
|
||||
}
|
||||
ENT.ButtonMap["AirDistributor"] = {
|
||||
pos = Vector(-168,68.6,-50),
|
||||
ang = Angle(0,180,90),
|
||||
width = 170,
|
||||
height = 80,
|
||||
scale = 0.1,
|
||||
buttons = {
|
||||
{ID = "AirDistributorDisconnectToggle",x=0, y=0, w= 170,h = 80, tooltip="Выключение воздухораспределителя"},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-- UAVA
|
||||
ENT.ButtonMap["UAVAPanel"] = {
|
||||
pos = Vector(450,52,-20),
|
||||
ang = Angle(0,-70,90),
|
||||
width = 230,
|
||||
height = 170,
|
||||
scale = 0.0625,
|
||||
|
||||
buttons = {
|
||||
{ID = "UAVAToggle",x=230/2, y=0, w=230/2, h=170, tooltip="УАВА: Универсальный Автоматический Выключатель Автостопа\nUAVA: Universal Automatic Autostop Disabler"},
|
||||
{ID = "UAVAContactSet",x=0, y=0, w=230/2, h=170, tooltip="УАВА: Универсальный Автоматический Выключатель Автостопа (восстановление контактов)\nUAVA: Universal Automatic Autostop Disabler(contacts reset)"},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
-- Wagon numbers
|
||||
ENT.ButtonMap["TrainNumber1"] = {
|
||||
pos = Vector(-440,-68,-11),
|
||||
ang = Angle(0,0,90),
|
||||
width = 130,
|
||||
height = 55,
|
||||
scale = 0.20,
|
||||
}
|
||||
ENT.ButtonMap["TrainNumber2"] = {
|
||||
pos = Vector(416,68,-11),
|
||||
ang = Angle(0,180,90),
|
||||
width = 130,
|
||||
height = 55,
|
||||
scale = 0.20,
|
||||
}
|
||||
|
||||
|
||||
ENT.ButtonMap["FrontDoor"] = {
|
||||
pos = Vector(472,16,43.4),
|
||||
ang = Angle(0,-90,90),
|
||||
width = 650,
|
||||
height = 1780,
|
||||
scale = 0.1/2,
|
||||
buttons = {
|
||||
{ID = "FrontDoor",x=0,y=0,w=650,h=1780, tooltip="Передняя дверь\nFront door"},
|
||||
}
|
||||
}
|
||||
|
||||
ENT.ButtonMap["CabinDoor"] = {
|
||||
pos = Vector(420,64,43.4),
|
||||
ang = Angle(0,0,90),
|
||||
width = 642,
|
||||
height = 1780,
|
||||
scale = 0.1/2,
|
||||
buttons = {
|
||||
{ID = "CabinDoor1",x=0,y=0,w=642,h=1780, tooltip="Дверь в кабину машиниста\nCabin door"},
|
||||
}
|
||||
}
|
||||
|
||||
ENT.ButtonMap["PassengerDoor"] = {
|
||||
pos = Vector(384,-16,43.4),
|
||||
ang = Angle(0,90,90),
|
||||
width = 642,
|
||||
height = 1900,
|
||||
scale = 0.1/2,
|
||||
buttons = {
|
||||
{ID = "PassengerDoor",x=0,y=0,w=642,h=1900, tooltip="Дверь из салона\nPassenger door"},
|
||||
}
|
||||
}
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
ENT.ClientPropsInitialized = false
|
||||
ENT.ClientProps["brake"] = {
|
||||
model = "models/metrostroi_train/81/334cran.mdl",
|
||||
pos = Vector(460.11,-53.7,3.7),
|
||||
ang = Angle(0,34,0)
|
||||
}
|
||||
ENT.ClientProps["controller"] = {
|
||||
model = "models/metrostroi_train/em/kv.mdl",
|
||||
pos = Vector(461.65,-24.63,3.9),
|
||||
ang = Angle(0,-32,0)
|
||||
}
|
||||
ENT.ClientProps["reverser"] = {
|
||||
model = "models/metrostroi/81-717/reverser.mdl",
|
||||
pos = Vector(461.65,-24.63,3.2),
|
||||
ang = Angle(0,45,90)
|
||||
}
|
||||
ENT.ClientProps["brake_disconnect"] = {
|
||||
model = "models/metrostroi/81-717/uava.mdl",
|
||||
pos = Vector(452.9,-57.33,-25.61),
|
||||
ang = Angle(0,-90,0),
|
||||
color = Color(144,74,0),
|
||||
}
|
||||
ENT.ClientProps["train_disconnect"] = {
|
||||
model = "models/metrostroi/81-717/uava.mdl",
|
||||
pos = Vector(455.482483,-52.546734,-19.333017),
|
||||
ang = Angle(0.000000,-101.794258,0.000000),
|
||||
color = Color(0,212,255),
|
||||
}
|
||||
|
||||
ENT.ClientProps["parking_brake"] = {
|
||||
model = "models/metrostroi/81-717/ezh_koleso.mdl",
|
||||
pos = Vector(460.316742,37.144958,-6.000000),
|
||||
ang = Angle(-90.000000,8.000000,0.000000),
|
||||
}
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
ENT.ClientProps["train_line"] = {
|
||||
model = "models/metrostroi_train/e/small_pneumo_needle.mdl",
|
||||
pos = Vector(457.722778,-56.060150,13.877457),
|
||||
ang = Angle(314.669312,40.953403,-90.000000),
|
||||
}
|
||||
ENT.ClientProps["brake_line"] = {
|
||||
model = "models/metrostroi_train/e/small_pneumo_needle.mdl",
|
||||
pos = Vector(457.688568,-56.020660,13.877457),
|
||||
ang = Angle(314.669312,40.953403,-90.000000),
|
||||
color = Color(255,120,120),
|
||||
}
|
||||
|
||||
ENT.ClientProps["brake_cylinder"] = {
|
||||
model = "models/metrostroi_train/e/small_pneumo_needle.mdl",
|
||||
pos = Vector(462.104797,-55.268986,9.050000),
|
||||
ang = Angle(313.335266,48.532555,-90.000000),
|
||||
}
|
||||
----------------------------------------------------------------
|
||||
ENT.ClientProps["voltmeter"] = {
|
||||
model = "models/metrostroi_train/e/volt_needle.mdl",
|
||||
pos = Vector(460.647858,-58.177208,35.553993),
|
||||
ang = Angle(237.732468,23.827326,270.135559),
|
||||
}
|
||||
|
||||
ENT.ClientProps["ampermeter"] = {
|
||||
model = "models/metrostroi_train/e/volt_needle.mdl",
|
||||
pos = Vector(460.647858,-58.177208,32.055382),
|
||||
ang = Angle(222.645691,23.000584,270.135559),
|
||||
}
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
ENT.ClientProps["gv"] = {
|
||||
model = "models/metrostroi/81-717/gv.mdl",
|
||||
pos = Vector(130,62.5,-65),
|
||||
ang = Angle(-90,0,-90)
|
||||
}
|
||||
ENT.ClientProps["gv_wrench"] = {
|
||||
model = "models/metrostroi/81-717/reverser.mdl",
|
||||
pos = Vector(130,62.5,-65),
|
||||
ang = Angle(0,0,0)
|
||||
}
|
||||
|
||||
ENT.ClientProps["Em_salon"] = {
|
||||
model = "models/metrostroi_train/em/em_salon.mdl",
|
||||
pos = Vector(0,0,0),
|
||||
ang = Angle(0,0,0)
|
||||
}
|
||||
ENT.ClientProps["Em_salon2"] = {
|
||||
model = "models/metrostroi_train/em/em_salon2.mdl",
|
||||
pos = Vector(0,0,0),
|
||||
ang = Angle(0,0,0)
|
||||
}
|
||||
ENT.ClientProps["Lamps_emer"] = {
|
||||
model = "models/metrostroi_train/em/lamps_emer.mdl",
|
||||
pos = Vector(0,0,0),
|
||||
ang = Angle(0,0,0)
|
||||
}
|
||||
ENT.ClientProps["Lamps_full"] = {
|
||||
model = "models/metrostroi_train/em/lamps_full.mdl",
|
||||
pos = Vector(0,0,0),
|
||||
ang = Angle(0,0,0)
|
||||
}
|
||||
|
||||
ENT.ClientProps["Lamps_full2"] = {
|
||||
model = "models/metrostroi_train/em/lamps_full_em.mdl",
|
||||
pos = Vector(0.007439,0,0),
|
||||
ang = Angle(0,0,0)
|
||||
}
|
||||
|
||||
ENT.ClientProps["Lamps_cab_em"] = {
|
||||
model = "models/metrostroi_train/em/lamps_cab_em.mdl",
|
||||
pos = Vector(0.007439,0,0),
|
||||
ang = Angle(0,0,0)
|
||||
}
|
||||
|
||||
ENT.ClientProps["FrontBrake"] = {--
|
||||
model = "models/metrostroi_train/81/tmiso.mdl",
|
||||
pos = Vector(460, -30, -55),
|
||||
ang = Angle(0,-90,0)
|
||||
}
|
||||
ENT.ClientProps["FrontTrain"] = {--
|
||||
model = "models/metrostroi_train/81/nmsio.mdl",
|
||||
pos = Vector(460, 30, -55),
|
||||
ang = Angle(0,-90,0)
|
||||
}
|
||||
ENT.ClientProps["RearBrake"] = {--
|
||||
model = "models/metrostroi_train/81/tmiso.mdl",
|
||||
pos = Vector(-460, -30, -55),
|
||||
ang = Angle(0,90,0)
|
||||
}
|
||||
ENT.ClientProps["RearTrain"] = {--
|
||||
model = "models/metrostroi_train/81/nmsio.mdl",
|
||||
pos = Vector(-460, 30, -55),
|
||||
ang = Angle(0,90,0)
|
||||
}
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Add doors
|
||||
local function GetDoorPosition(i,k,j)
|
||||
if j == 0
|
||||
then return Vector(383.0 - 67.49*k - 233.4*i,-64.56*(1-2*k),1)
|
||||
else return Vector(383.0 - 67.49*(1-k) - 233.4*i,-64.56*(1-2*k),1)
|
||||
end
|
||||
end
|
||||
for i=0,3 do
|
||||
for k=0,1 do
|
||||
ENT.ClientProps["door"..i.."x"..k.."a"] = {
|
||||
model = "models/metrostroi_train/em/doorright.mdl",
|
||||
pos = GetDoorPosition(i,k,0),
|
||||
ang = Angle(0,90 + 180*k,0)
|
||||
}
|
||||
ENT.ClientProps["door"..i.."x"..k.."b"] = {
|
||||
model = "models/metrostroi_train/em/doorleft.mdl",
|
||||
pos = GetDoorPosition(i,k,1),
|
||||
ang = Angle(0,90 + 180*k,0)
|
||||
}
|
||||
end
|
||||
end
|
||||
ENT.ClientProps["door1"] = {
|
||||
model = "models/metrostroi_train/em/doorfront.mdl",
|
||||
pos = Vector(471.71,-17.1,-1),
|
||||
ang = Angle(0,-90,0)
|
||||
}
|
||||
ENT.ClientProps["door2"] = {
|
||||
model = "models/metrostroi_train/em/doorback.mdl",
|
||||
pos = Vector(-471.24,17.19,-1),
|
||||
ang = Angle(0,-90,0)
|
||||
}
|
||||
ENT.ClientProps["door3"] = {
|
||||
model = "models/metrostroi_train/em/doorpass.mdl",
|
||||
pos = Vector(403.69,16.95,-2.2),
|
||||
ang = Angle(0,-90,0)
|
||||
}
|
||||
ENT.ClientProps["door4"] = {
|
||||
model = "models/metrostroi_train/em/doorcab.mdl",
|
||||
pos = Vector(420.75,64.26,1.5),
|
||||
ang = Angle(0,-90,0)
|
||||
}
|
||||
--[[ENT.ClientProps["UAVA"] = {
|
||||
model = "models/metrostroi/81-717/uava_body.mdl",
|
||||
pos = Vector(400,61,-8),--Vector(415.0,-58.5,-18.2),
|
||||
ang = Angle(0,0,0)
|
||||
}
|
||||
ENT.ClientProps["UAVALever"] = {
|
||||
model = "models/metrostroi_train/81/uavalever.mdl",
|
||||
pos = Vector(452.84598,51,-21.813349),
|
||||
ang = Angle(0,90,90)
|
||||
}
|
||||
]]
|
||||
ENT.ClientProps["RedLights"] = {
|
||||
model = "models/metrostroi_train/Em/redlights.mdl",
|
||||
pos = Vector(474.674042,-0.885458,55.695278),
|
||||
ang = Angle(90.000000,-0.212120,0.000000),
|
||||
}
|
||||
ENT.ClientProps["DistantLights"] = {
|
||||
model = "models/metrostroi_train/Em/distantlights.mdl",
|
||||
pos = Vector(471.731842,-0.651488,54.413082),
|
||||
ang = Angle(90.000000,0.000000,0.000000),
|
||||
}
|
||||
ENT.ClientProps["WhiteLights"] = {
|
||||
model = "models/metrostroi_train/Em/whitelights.mdl",
|
||||
pos = Vector(475.597565,-0.525079,-29.160791),
|
||||
ang = Angle(90.267662,0.000000,0.000000),
|
||||
}
|
||||
|
||||
ENT.Texture = "7"
|
||||
ENT.OldTexture = nil
|
||||
--local X = Material( "metrostroi_skins/81-717/6.png")
|
||||
|
||||
function ENT:UpdateTextures()
|
||||
local texture = Metrostroi.Skins["train"][self:GetNW2String("texture")]
|
||||
local passtexture = Metrostroi.Skins["pass"][self:GetNW2String("passtexture")]
|
||||
local cabintexture = Metrostroi.Skins["cab"][self:GetNW2String("cabtexture")]
|
||||
for _,self in pairs(self.ClientEnts) do
|
||||
if not IsValid(self) then continue end
|
||||
for k,v in pairs(self:GetMaterials()) do
|
||||
local tex = string.Explode("/",v)
|
||||
tex = tex[#tex]
|
||||
if cabintexture and cabintexture.textures[tex] then
|
||||
self:SetSubMaterial(k-1,cabintexture.textures[tex])
|
||||
end
|
||||
if passtexture and passtexture.textures[tex] then
|
||||
self:SetSubMaterial(k-1,passtexture.textures[tex])
|
||||
end
|
||||
if texture and texture.textures[tex] then
|
||||
self:SetSubMaterial(k-1,texture.textures[tex])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
--------------------------------------------------------------------------------
|
||||
function ENT:Think()
|
||||
self.BaseClass.Think(self)
|
||||
if self.Texture ~= self:GetNW2String("texture") then
|
||||
self.Texture = self:GetNW2String("texture")
|
||||
self:UpdateTextures()
|
||||
end
|
||||
if self.PassTexture ~= self:GetNW2String("passtexture") then
|
||||
self.PassTexture = self:GetNW2String("passtexture")
|
||||
self:UpdateTextures()
|
||||
end
|
||||
if self.CabinTexture ~= self:GetNW2String("cabtexture") then
|
||||
self.CabinTexture = self:GetNW2String("cabtexture")
|
||||
self:UpdateTextures()
|
||||
end
|
||||
--print(self.FrontDoor,self:GetPackedBool(114))
|
||||
--print(self.RearDoor,self:GetPackedBool(156))
|
||||
local transient = (self.Transient or 0)*0.05
|
||||
if (self.Transient or 0) ~= 0.0 then self.Transient = 0.0 end
|
||||
|
||||
-- Parking brake animation
|
||||
self.ParkingBrakeAngle = self.ParkingBrakeAngle or 0
|
||||
self.TrueBrakeAngle = self.TrueBrakeAngle or 0
|
||||
self.TrueBrakeAngle = self.TrueBrakeAngle + (self.ParkingBrakeAngle - self.TrueBrakeAngle)*2.0*(self.DeltaTime or 0)
|
||||
if self.ClientEnts and self.ClientEnts["parking_brake"] then
|
||||
self.ClientEnts["parking_brake"]:SetPoseParameter("position",1.0-((self.TrueBrakeAngle % 360)/360))
|
||||
end
|
||||
|
||||
local Lamps = self:GetPackedBool(20) and 0.6 or 1
|
||||
self:ShowHideSmooth("Lamps_emer",self:Animate("lamps_emer",self:GetPackedBool("Lamps_emer") and Lamps or 0,0,1,6,false))
|
||||
self:ShowHideSmooth("Lamps_full",self:Animate("lamps_full",self:GetPackedBool("Lamps_full") and Lamps or 0,0,1,6,false))
|
||||
self:ShowHideSmooth("Lamps_cab_em",self.Anims["lamps_full"].val)
|
||||
self:ShowHideSmooth("Lamps_full2",self.Anims["lamps_full"].val)
|
||||
|
||||
--self:ShowHideSmooth("Lamp2",self:Animate("Lamp2_hs",self:GetPackedBool("Lamp2") and 1 or 0,0,1,5,false))
|
||||
--self:ShowHideSmooth("Lamp1",self:Animate("Lamp1_hs",self:GetPackedBool("Lamp1") and 1 or 0,0,1,5,false))
|
||||
--self:ShowHideSmooth("Lamp6",self:Animate("Lamp6_hs",self:GetPackedBool("Lamp6") and 1 or 0,0,1,5,false))
|
||||
--self:ShowHideSmooth("Doors",self:Animate("Doors_hs",self:GetPackedBool(40) and 1 or 0,0,1,5,false))
|
||||
self:ShowHideSmooth("DoorsWag",self:Animate("DoorsWag_hs",self:GetPackedBool("DoorsWag") and 1 or 0,0,1,5,false))
|
||||
self:ShowHideSmooth("GreenRP",self:Animate("GreenRP_hs",self:GetPackedBool(36) and 1 or 0,0,1,5,false))
|
||||
self:ShowHideSmooth("RedRP",self:Animate("RedRP_hs",self:GetPackedBool(35) and 1 or 0,0,1,5,false) + self:Animate("RedLSN_hs",self:GetPackedBool(131) and 1 or 0,0,0.4,5,false))
|
||||
|
||||
|
||||
self:Animate("AV8B",self:GetPackedBool("AV8B") and 1 or 0, 0,1, 8, false)
|
||||
|
||||
self:Animate("VU1",self:GetPackedBool("VU1") and 0 or 1, 0,1, 12, false)
|
||||
self:Animate("VU3",self:GetPackedBool("VU3") and 0 or 1, 0,1, 12, false)
|
||||
self:Animate("VU2",self:GetPackedBool("VU2") and 0 or 1, 0,1, 12, false)
|
||||
|
||||
self:Animate("VU",self:GetPackedBool("VU") and 0 or 1, 0,1, 12, false)
|
||||
self:Animate("RezMK",self:GetPackedBool("RezMK") and 1 or 0, 0,1, 7, false)
|
||||
|
||||
self:HideButton("VUToggle",self:GetPackedBool("VUPl"))
|
||||
self:HideButton("VUPl",not self:GetPackedBool("VUPl"))
|
||||
|
||||
self:SetCSBodygroup("VUPl",1,self:GetPackedBool("VUPl") and 0 or 1)
|
||||
|
||||
|
||||
self:Animate("VB",self:GetPackedBool("VB") and 0 or 1, 0,1, 8, false)
|
||||
|
||||
|
||||
self:Animate("KRZD",self:GetPackedBool("KRZD") and 1 or 0, 0,1, 12, false)
|
||||
|
||||
self:ShowHideSmooth("RedLights",self:Animate("redlights",self:GetPackedBool("RedLight") and 1 or 0,0,1,5,false))
|
||||
self:ShowHideSmooth("WhiteLights",self:Animate("whitelights",self:GetPackedBool("HeadLights2") and 1 or 0,0,1,5,false))
|
||||
self:ShowHideSmooth("DistantLights",self:Animate("distantlights",self:GetPackedBool("HeadLights1") and 1 or 0,0,1,5,false))
|
||||
|
||||
self:Animate("KDL",self:GetPackedBool("KDL") and 1 or 0, 0,1, 12, false)
|
||||
self:Animate("DIPon",self:GetPackedBool("DIPon") and 1 or 0, 0,1, 12, false)
|
||||
self:Animate("DIPoff",self:GetPackedBool("DIPoff") and 1 or 0, 0,1, 12, false)
|
||||
self:Animate("VozvratRP",self:GetPackedBool("VozvratRP") and 1 or 0, 0,1, 12, false)
|
||||
self:Animate("KSN",self:GetPackedBool("KSN") and 1 or 0, 0,1, 12, false)
|
||||
self:Animate("KDP",self:GetPackedBool("KDP") and 1 or 0, 0,1, 12, false)
|
||||
|
||||
self:Animate("KU1",self:GetPackedBool("KU1") and 1 or 0, 0,1, 7, false)
|
||||
self:Animate("VUD",self:GetPackedBool("VUD1") and 1 or 0, 0,1, 7, false)
|
||||
|
||||
|
||||
-- self:Animate("VDL",self:GetPackedBool("VDL") and 1 or 0, 0,1, 7, false)
|
||||
|
||||
self:Animate("VUD2",self:GetPackedBool("VUD2") and 0 or 1, 0,1, 7, false)
|
||||
self:Animate("VUD2l",self:GetPackedBool("VUD2L") and 1 or 0, 0,1, 7, false)
|
||||
|
||||
self:Animate("brake_disconnect",self:GetPackedBool("DriverValveBLDisconnect") and 1 or 0,0,0.5, 3,false)
|
||||
self:Animate("train_disconnect",self:GetPackedBool("DriverValveTLDisconnect") and 1 or 0,0,0.5, 3,false)
|
||||
|
||||
-- DIP sound
|
||||
--self:SetSoundState("bpsn2",self:GetPackedBool(52) and 1 or 0,1.0)
|
||||
|
||||
-- Simulate pressure gauges getting stuck a little
|
||||
self:Animate("brake", 1-self:GetPackedRatio(0), 0.00, 0.65, 256,24)
|
||||
self:Animate("controller", self:GetPackedRatio(1), 0, 0.31, 2,false)
|
||||
self:Animate("reverser", self:GetPackedRatio(2), 0.26, 0.35, 4,false)
|
||||
self:ShowHide("reverser", self:GetPackedBool(0))
|
||||
|
||||
self:Animate("brake_line", self:GetPackedRatio(4), 0, 0.725, 256,2)--,,0.01)
|
||||
self:Animate("train_line", self:GetPackedRatio(5)-transient, 0, 0.725, 256,2)--,,0.01)
|
||||
self:Animate("brake_cylinder", self:GetPackedRatio(6), 0, 0.721, 256,2)--,,0.03)
|
||||
self:Animate("voltmeter", self:GetPackedRatio(7), 0.014, 0.298,256,2)
|
||||
self:Animate("ampermeter", self:GetPackedRatio(8), 0, 0.248,256,2)
|
||||
--self:Animate("volt2", 0, 0.38, 0.63)
|
||||
----
|
||||
self:Animate("door1", self:GetPackedBool(157) and (self.Door1 or 0.99) or 0,0,0.22, 1024, 1)
|
||||
self:Animate("door3", self:GetPackedBool(158) and (self.Door2 or 0.99) or 0,0,0.25, 1024, 1)
|
||||
self:Animate("door2", self:GetPackedBool(156) and (self.Door3 or 0.99) or 0,0,0.25, 1024, 1)
|
||||
self:Animate("door4", self:GetPackedBool(159) and (self.Door2 or 0.99) or 0,1,0.77, 1024, 1)
|
||||
|
||||
self:Animate("FrontBrake", self:GetNW2Bool("FbI") and 0 or 1,0,0.35, 3, false)
|
||||
self:Animate("FrontTrain", self:GetNW2Bool("FtI") and 0 or 1,0,0.35, 3, false)
|
||||
self:Animate("RearBrake", self:GetNW2Bool("RbI") and 1 or 0,0,0.35, 3, false)
|
||||
self:Animate("RearTrain", self:GetNW2Bool("RtI") and 1 or 0,0,0.35, 3, false)
|
||||
|
||||
-- Main switch
|
||||
if self.LastValue ~= self:GetPackedBool(5) then
|
||||
self.ResetTime = CurTime()+1.5
|
||||
self.LastValue = self:GetPackedBool(5)
|
||||
end
|
||||
self:Animate("gv_wrench", (self:GetPackedBool(5) and 1 or 0), 0,0.51, 128, 1,false)
|
||||
self:ShowHide("gv_wrench", CurTime() < self.ResetTime)
|
||||
|
||||
-- Animate doors
|
||||
for i=0,4 do
|
||||
for k=0,1 do
|
||||
local n_l = "door"..i.."x"..k.."a"
|
||||
local n_r = "door"..i.."x"..k.."b"
|
||||
self:Animate(n_l,self:GetPackedBool(21+(1-k)*4) and 1 or 0,0.11,0.93, 0.8 + (-0.2+0.4*math.random()),0)
|
||||
self:Animate(n_r,self:GetPackedBool(21+(1-k)*4) and 1 or 0,0.11,0.93, 0.8 + (-0.2+0.4*math.random()),0)
|
||||
end
|
||||
end
|
||||
|
||||
-- Brake-related sounds
|
||||
local brakeLinedPdT = self:GetPackedRatio(9)
|
||||
local dT = self.DeltaTime
|
||||
self.BrakeLineRamp1 = self.BrakeLineRamp1 or 0
|
||||
|
||||
if (brakeLinedPdT > -0.001)
|
||||
then self.BrakeLineRamp1 = self.BrakeLineRamp1 + 4.0*(0-self.BrakeLineRamp1)*dT
|
||||
else self.BrakeLineRamp1 = self.BrakeLineRamp1 + 4.0*((-0.6*brakeLinedPdT)-self.BrakeLineRamp1)*dT
|
||||
end
|
||||
self.BrakeLineRamp1 = math.Clamp(self.BrakeLineRamp1,0,1)
|
||||
self:SetSoundState("release2",self.BrakeLineRamp1^1.65,1.0)
|
||||
|
||||
self.BrakeLineRamp2 = self.BrakeLineRamp2 or 0
|
||||
if (brakeLinedPdT < 0.001)
|
||||
then self.BrakeLineRamp2 = self.BrakeLineRamp2 + 4.0*(0-self.BrakeLineRamp2)*dT
|
||||
else self.BrakeLineRamp2 = self.BrakeLineRamp2 + 8.0*(0.1*brakeLinedPdT-self.BrakeLineRamp2)*dT
|
||||
end
|
||||
self.BrakeLineRamp2 = math.Clamp(self.BrakeLineRamp2,0,1)
|
||||
self:SetSoundState("release3",self.BrakeLineRamp2 + math.max(0,self.BrakeLineRamp1/2-0.15),1.0)
|
||||
|
||||
self:SetSoundState("cran1",math.min(1,self:GetPackedRatio(4)/50*(self:GetPackedBool(6) and 1 or 0)),1.0)
|
||||
|
||||
-- Compressor
|
||||
local state = self:GetPackedBool(20)
|
||||
self.PreviousCompressorState = self.PreviousCompressorState or false
|
||||
if self.PreviousCompressorState ~= state then
|
||||
self.PreviousCompressorState = state
|
||||
if state then
|
||||
self:SetSoundState("compressor_ezh",1,1)
|
||||
else
|
||||
self:SetSoundState("compressor_ezh",0,1)
|
||||
self:SetSoundState("compressor_ezh_end",0,1)
|
||||
self:SetSoundState("compressor_ezh_end",1,1)
|
||||
--self:PlayOnce("compressor_e_end",nil,1,nil,true)
|
||||
end
|
||||
end
|
||||
|
||||
-- ARS/ringer alert
|
||||
local state = self:GetPackedBool(39)
|
||||
self.PreviousAlertState = self.PreviousAlertState or false
|
||||
if self.PreviousAlertState ~= state then
|
||||
self.PreviousAlertState = state
|
||||
if state then
|
||||
self:SetSoundState("ring4",1,1)
|
||||
else
|
||||
self:SetSoundState("ring4",0,0)
|
||||
self:SetSoundState("ring4_end",0,1)
|
||||
self:SetSoundState("ring4_end",1,1)
|
||||
--self:PlayOnce("ring4_end","cabin",0,101)
|
||||
end
|
||||
end
|
||||
|
||||
-- RK rotation
|
||||
if self:GetPackedBool(112) then self.RKTimer = CurTime() end
|
||||
local state = (CurTime() - (self.RKTimer or 0)) < 0.2
|
||||
self.PreviousRKState = self.PreviousRKState or false
|
||||
if self.PreviousRKState ~= state then
|
||||
self.PreviousRKState = state
|
||||
if state then
|
||||
self:SetSoundState("rk_spin",0.7,1,nil,0.75)
|
||||
else
|
||||
self:SetSoundState("rk_spin",0,0,nil,0.75)
|
||||
self:SetSoundState("rk_stop",0,1,nil,0.75)
|
||||
self:SetSoundState("rk_stop",0.7,1,nil,0.75)
|
||||
end
|
||||
end
|
||||
|
||||
--DIP sound
|
||||
--self:SetSoundState("bpsn2",self:GetPackedBool(32) and 1 or 0,1.0)
|
||||
end
|
||||
|
||||
function ENT:Draw()
|
||||
self.BaseClass.Draw(self)
|
||||
end
|
||||
|
||||
function ENT:DrawPost()
|
||||
|
||||
self:DrawOnPanel("FrontPneumatic",function()
|
||||
draw.DrawText(self:GetNW2Bool("FbI") and "Isolated" or "Open","Trebuchet24",150,0,Color(0,0,0,255))
|
||||
draw.DrawText(self:GetNW2Bool("FtI") and "Isolated" or "Open","Trebuchet24",670,0,Color(0,0,0,255))
|
||||
end)
|
||||
self:DrawOnPanel("RearPneumatic",function()
|
||||
draw.DrawText(self:GetNW2Bool("RbI") and "Isolated" or "Open","Trebuchet24",150,0,Color(0,0,0,255))
|
||||
draw.DrawText(self:GetNW2Bool("RtI") and "Isolated" or "Open","Trebuchet24",670,0,Color(0,0,0,255))
|
||||
end)
|
||||
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)
|
||||
|
||||
-- Draw train numbers
|
||||
local dc = render.GetLightColor(self:GetPos())
|
||||
self:DrawOnPanel("TrainNumber1",function()
|
||||
draw.DrawText(Format("%04d",self:EntIndex()),"MetrostroiSubway_LargeText3",0,0,Color(255*dc.x,255*dc.y,255*dc.z,255))
|
||||
end)
|
||||
self:DrawOnPanel("TrainNumber2",function()
|
||||
draw.DrawText(Format("%04d",self:EntIndex()),"MetrostroiSubway_LargeText3",0,0,Color(255*dc.x,255*dc.y,255*dc.z,255))
|
||||
end)
|
||||
end
|
||||
|
||||
function ENT:OnButtonPressed(button)
|
||||
if button == "ShowHelp" then
|
||||
RunConsoleCommand("metrostroi_train_manual")
|
||||
end
|
||||
local bp_press = self:GetPackedRatio(6)
|
||||
local blocked_l = self:GetPackedBool(132) and 0 or 1
|
||||
local blocked_r = self:GetPackedBool(133) and 0 or 1
|
||||
if button == "ParkingBrakeLeft" then
|
||||
self.ParkingBrakeAngle = (self.ParkingBrakeAngle or 0) - blocked_l*45
|
||||
end
|
||||
if button == "ParkingBrakeRight" then
|
||||
self.ParkingBrakeAngle = (self.ParkingBrakeAngle or 0) + blocked_r*45
|
||||
end
|
||||
if button == "ShowHelp" then
|
||||
RunConsoleCommand("metrostroi_train_manual")
|
||||
end
|
||||
|
||||
if button == "PrevSign" then
|
||||
self.InfoTableTimeout = CurTime() + 2.0
|
||||
end
|
||||
if button == "NextSign" then
|
||||
self.InfoTableTimeout = CurTime() + 2.0
|
||||
end
|
||||
|
||||
if button and button:sub(1,3) == "Num" then
|
||||
self.InfoTableTimeout = CurTime() + 2.0
|
||||
end
|
||||
end
|
||||
896
lua/entities/_obsolete/gmod_subway_em/init.lua
Normal file
896
lua/entities/_obsolete/gmod_subway_em/init.lua
Normal file
@@ -0,0 +1,896 @@
|
||||
AddCSLuaFile("cl_init.lua")
|
||||
AddCSLuaFile("shared.lua")
|
||||
include("shared.lua")
|
||||
|
||||
ENT.BogeyDistance = 650 -- Needed for gm trainspawner
|
||||
|
||||
---------------------------------------------------
|
||||
-- Defined train information
|
||||
-- Types of wagon(for wagon limit system):
|
||||
-- 0 = Head or intherim
|
||||
-- 1 = Only head
|
||||
-- 2 = Only intherim
|
||||
---------------------------------------------------
|
||||
ENT.SubwayTrain = {
|
||||
Type = "E",
|
||||
Name = "Em",
|
||||
WagType = 0,
|
||||
ARS = {
|
||||
HaveASNP = false,
|
||||
}
|
||||
}
|
||||
function ENT:Initialize()
|
||||
-- Set model and initialize
|
||||
self:SetModel("models/metrostroi_train/em/em.mdl")
|
||||
self.BaseClass.Initialize(self)
|
||||
self:SetPos(self:GetPos() + Vector(0,0,140))
|
||||
|
||||
-- Create seat entities
|
||||
self.DriverSeat = self:CreateSeat("driver",Vector(430,-39,-21.5),Angle(0,0,0))
|
||||
self.InstructorsSeat = self:CreateSeat("instructor",Vector(430,40,-48+6+2.5),Angle(0,90,0),"models/vehicles/prisoner_pod_inner.mdl")
|
||||
self.ExtraSeat1 = self:CreateSeat("instructor",Vector(443,0,-48+6+2.5),Angle(0,90,0),"models/vehicles/prisoner_pod_inner.mdl")
|
||||
self.ExtraSeat2 = self:CreateSeat("instructor",Vector(420,-20,-48+6),Angle(0,90,0),"models/vehicles/prisoner_pod_inner.mdl")
|
||||
|
||||
-- Hide seats
|
||||
self.DriverSeat:SetColor(Color(0,0,0,0))
|
||||
self.DriverSeat:SetRenderMode(RENDERMODE_TRANSALPHA)
|
||||
self.InstructorsSeat:SetColor(Color(0,0,0,0))
|
||||
self.InstructorsSeat:SetRenderMode(RENDERMODE_TRANSALPHA)
|
||||
|
||||
self.ExtraSeat1:SetColor(Color(0,0,0,0))
|
||||
self.ExtraSeat1:SetRenderMode(RENDERMODE_TRANSALPHA)
|
||||
self.ExtraSeat2:SetColor(Color(0,0,0,0))
|
||||
self.ExtraSeat2:SetRenderMode(RENDERMODE_TRANSALPHA)
|
||||
|
||||
-- Create bogeys
|
||||
self.FrontBogey = self:CreateBogey(Vector( 320,0,-80),Angle(0,180,0),true)
|
||||
self.RearBogey = self:CreateBogey(Vector(-320,0,-80),Angle(0,0,0),false)
|
||||
local pneumoPow = 0.8+(math.random()^0.4)*0.3
|
||||
self.FrontBogey.PneumaticPow = pneumoPow
|
||||
self.RearBogey.PneumaticPow = pneumoPow
|
||||
|
||||
-- Initialize key mapping
|
||||
self.KeyMap = {
|
||||
[KEY_1] = "KVSetX1",
|
||||
--[KEY_2] = "KVSetX2",
|
||||
--[KEY_3] = "KVSetX3",
|
||||
[KEY_4] = "KVSet0",
|
||||
[KEY_5] = "KVSetT1",
|
||||
[KEY_6] = "KVSetT1AB",
|
||||
[KEY_7] = "KVSetT2",
|
||||
[KEY_8] = "KRP",
|
||||
|
||||
[KEY_G] = "VozvratRPSet",
|
||||
|
||||
[KEY_0] = "KVReverserUp",
|
||||
[KEY_9] = "KVReverserDown",
|
||||
[KEY_PAD_PLUS] = "KVReverserUp",
|
||||
[KEY_PAD_MINUS] = "KVReverserDown",
|
||||
[KEY_W] = "KVUp",
|
||||
[KEY_S] = "KVDown",
|
||||
[KEY_F] = "PneumaticBrakeUp",
|
||||
[KEY_R] = "PneumaticBrakeDown",
|
||||
|
||||
[KEY_A] = "KDL",
|
||||
[KEY_D] = "KDP",
|
||||
[KEY_V] = "VUD1Toggle",
|
||||
[KEY_L] = "HornEngage",
|
||||
[KEY_PAD_1] = "PneumaticBrakeSet1",
|
||||
[KEY_PAD_2] = "PneumaticBrakeSet2",
|
||||
[KEY_PAD_3] = "PneumaticBrakeSet3",
|
||||
[KEY_PAD_4] = "PneumaticBrakeSet4",
|
||||
[KEY_PAD_5] = "PneumaticBrakeSet5",
|
||||
|
||||
[KEY_BACKSPACE] = "EmergencyBrake",
|
||||
|
||||
[KEY_PAD_0] = "DriverValveDisconnect",
|
||||
[KEY_LSHIFT] = {
|
||||
[KEY_W] = "KVUp_Unlocked",
|
||||
[KEY_SPACE] = "KVTSet",
|
||||
|
||||
[KEY_1] = "DIPonSet",
|
||||
[KEY_2] = "DIPoffSet",
|
||||
[KEY_4] = "KVSet0Fast",
|
||||
[KEY_L] = "DriverValveDisconnect",
|
||||
|
||||
[KEY_7] = "KVWrenchNone",
|
||||
[KEY_8] = "KVWrenchKRU",
|
||||
[KEY_9] = "KVWrenchKV",
|
||||
[KEY_0] = "KVWrench0",
|
||||
[KEY_6] = "KVSetT1A",
|
||||
},
|
||||
|
||||
[KEY_RSHIFT] = {
|
||||
[KEY_7] = "KVWrenchNone",
|
||||
[KEY_8] = "KVWrenchKRU",
|
||||
[KEY_9] = "KVWrenchKV",
|
||||
[KEY_0] = "KVWrench0",
|
||||
[KEY_L] = "DriverValveDisconnect",
|
||||
},
|
||||
[KEY_LALT] = {
|
||||
[KEY_V] = "VUD1Toggle",
|
||||
},
|
||||
[KEY_RALT] = {
|
||||
},
|
||||
}
|
||||
|
||||
self.InteractionZones = {
|
||||
{ Pos = Vector(-471,-30,0),
|
||||
Radius = 28,
|
||||
ID = "RearDoor"
|
||||
},
|
||||
{ Pos = Vector(473,32,28),
|
||||
Radius = 28,
|
||||
ID = "FrontDoor1"
|
||||
},
|
||||
{ Pos = Vector(473,32,-28),
|
||||
Radius = 28,
|
||||
ID = "FrontDoor2"
|
||||
},
|
||||
{ Pos = Vector(383.02,31.85,2),
|
||||
Radius = 28,
|
||||
ID = "PassengerDoor1"
|
||||
},
|
||||
{ Pos = Vector(383.02,-31.85,2),
|
||||
Radius = 28,
|
||||
ID = "PassengerDoor2"
|
||||
},
|
||||
{ Pos = Vector(408.18,63.59,-26),
|
||||
Radius = 16,
|
||||
ID = "CabinDoor1"
|
||||
},
|
||||
{ Pos = Vector(408.18,63.59,6),
|
||||
Radius = 16,
|
||||
ID = "CabinDoor2"
|
||||
},
|
||||
{ Pos = Vector(408.18,63.59,38),
|
||||
Radius = 16,
|
||||
ID = "CabinDoor3"
|
||||
},
|
||||
{ Pos = Vector(458.18,63.59,-26),
|
||||
Radius = 16,
|
||||
ID = "CabinDoor4"
|
||||
},
|
||||
{ Pos = Vector(458.18,63.59,6),
|
||||
Radius = 16,
|
||||
ID = "CabinDoor5"
|
||||
},
|
||||
{ Pos = Vector(458.18,63.59,38),
|
||||
Radius = 16,
|
||||
ID = "CabinDoor6"
|
||||
},
|
||||
}
|
||||
|
||||
self.Lights = {
|
||||
-- Head
|
||||
[1] = { "headlight", Vector(475,0,-20), Angle(0,0,0), Color(216,161,92), fov = 100 },
|
||||
[2] = { "glow", Vector(469.4, 45.43,-30.7), Angle(0,0,0), Color(255,220,180), brightness = 1, scale = 1.0 },
|
||||
[3] = { "glow", Vector(469.4,-45.43,-30.7), Angle(0,0,0), Color(255,220,180), brightness = 1, scale = 1.0 },
|
||||
[4] = { "glow", Vector(458+9,-14.86, 58), Angle(0,0,0), Color(255,220,180), brightness = 1, scale = 0.5 },
|
||||
[5] = { "glow", Vector(458+9,0, 58), Angle(0,0,0), Color(255,220,180), brightness = 1, scale = 0.5 },
|
||||
[6] = { "glow", Vector(458+9, 14.86, 58), Angle(0,0,0), Color(255,220,180), brightness = 1, scale = 0.5 },
|
||||
|
||||
-- Reverse
|
||||
--[8] = { "light", Vector(458+11,-30.7, 54.2), Angle(0,0,0), Color(255,0,0), brightness = 10, scale = 1.0 },
|
||||
--[9] = { "light", Vector(458+11, 30.7, 54.2), Angle(0,0,0), Color(255,0,0), brightness = 10, scale = 1.0 },
|
||||
|
||||
-- Cabin
|
||||
[10] = { "dynamiclight", Vector(434,-32,18), Angle(0,-0,0), Color(255,107,50), brightness = 0.4, distance = 600, shadows = 1},
|
||||
|
||||
-- Interior
|
||||
[11] = { "dynamiclight", Vector( 250, 0, 0), Angle(0,0,0), Color(255,95,10), brightness = 5, distance = 300 , fov=180,farz = 128 },
|
||||
[12] = { "dynamiclight", Vector( 0, 0, 0), Angle(0,0,0), Color(255,95,10), brightness = 5, distance = 400, fov=180,farz = 128 },
|
||||
[13] = { "dynamiclight", Vector(-300, 0, 0), Angle(0,0,0), Color(255,95,10), brightness = 5, distance = 400 , fov=180,farz = 128 },
|
||||
|
||||
-- Side lights
|
||||
--//[14] = { "light", Vector(390+12.15, 69, 54), Angle(0,0,0), Color(255,0,0), brightness = 0.5, scale = 0.10, texture = "models/metrostroi_signals/signal_sprite_002.vmt" },
|
||||
--[15] = { "light", Vector(390+12.15, 69, 51), Angle(0,0,0), Color(150,255,255), brightness = 0.6, scale = 0.10, texture = "models/metrostroi_signals/signal_sprite_002.vmt" },
|
||||
--[16] = { "light", Vector(390+12.15, 69, 48), Angle(0,0,0), Color(50,255,0), brightness = 0.5, scale = 0.10, texture = "models/metrostroi_signals/signal_sprite_002.vmt" },
|
||||
--[17] = { "light", Vector(390+12.15, 69, 45), Angle(0,0,0), Color(255,255,0), brightness = 0.5, scale = 0.10, texture = "models/metrostroi_signals/signal_sprite_002.vmt" },
|
||||
|
||||
--[18] = { "light", Vector(390+12.15, -69, 54), Angle(0,0,0), Color(255,0,0), brightness = 0.5, scale = 0.10, texture = "models/metrostroi_signals/signal_sprite_002.vmt" },
|
||||
--[19] = { "light", Vector(390+12.15, -69, 51), Angle(0,0,0), Color(150,255,255), brightness = 0.6, scale = 0.10, texture = "models/metrostroi_signals/signal_sprite_002.vmt" },
|
||||
--[20] = { "light", Vector(390+12.15, -69, 48), Angle(0,0,0), Color(50,255,0), brightness = 0.5, scale = 0.10, texture = "models/metrostroi_signals/signal_sprite_002.vmt" },
|
||||
--[21] = { "light", Vector(390+12.15, -69, 45), Angle(0,0,0), Color(255,255,0), brightness = 0.5, scale = 0.10, texture = "models/metrostroi_signals/signal_sprite_002.vmt" },
|
||||
|
||||
[15] = { "light", Vector(402.202942,69.270073,44.79285), Angle(0,0,0), Color(150,255,255), brightness = 0.9, scale = 0.10, texture = "sprites/light_glow02.vmt" },
|
||||
[16] = { "light", Vector(402.202942,69.270073,41.509621), Angle(0,0,0), Color(50,255,0), brightness = 0.9, scale = 0.10, texture = "sprites/light_glow02.vmt" },
|
||||
[17] = { "light", Vector(402.202942,69.270073,37.3862), Angle(0,0,0), Color(255,255,0), brightness = 0.9, scale = 0.10, texture = "sprites/light_glow02.vmt" },
|
||||
|
||||
--[19] = { "light", Vector(15, -69, 58.3), Angle(0,0,0), Color(150,255,255), brightness = 0.9, scale = 0.10, texture = "sprites/light_glow02.vmt" },
|
||||
--[20] = { "light", Vector(12, -69, 58.3), Angle(0,0,0), Color(50,255,0), brightness = 0.9, scale = 0.10, texture = "sprites/light_glow02.vmt" },
|
||||
--[21] = { "light", Vector(9, -69, 58.3), Angle(0,0,0), Color(255,255,0), brightness = 0.9, scale = 0.10, texture = "sprites/light_glow02.vmt" },
|
||||
[32] = { "headlight", Vector(450.70,-56.3,28), Angle(-90,0,-45), Color(216,161,92), farz = 6, nearz = 4, shadows = 0, brightness = 2, fov = 77 },
|
||||
[33] = { "headlight", Vector(450.70,-56.3,32), Angle(-90,0,-45), Color(216,161,92), farz = 6, nearz = 4, shadows = 0, brightness = 2, fov = 77 },
|
||||
|
||||
[34] = { "headlight", Vector(448.65,-56.40,22.60), Angle(-30,0,-45), Color(216,161,92), farz = 6, nearz = 4, shadows = 0, brightness = 2, fov = 140 },
|
||||
|
||||
[35] = { "headlight", Vector(450.6,-55.84,12.73), Angle(-90,-90,-180), Color(216,161,92), farz = 7, nearz = 4, shadows = 0, brightness = 2, fov = 130 },
|
||||
|
||||
[36] = { "headlight", Vector(455.2,-53.2,5.35), Angle(-90,-90,-180), Color(216,161,92), farz = 4, nearz = 4, shadows = 0, brightness = 2, fov = 130 },
|
||||
|
||||
[37] = { "headlight", Vector(458.3,-20.32,19.6), Angle(-90,-120,-180), Color(216,161,92), farz = 4, nearz = 4, shadows = 0, brightness = 3, fov = 160 },
|
||||
|
||||
[38] = { "headlight", Vector( -20, 0, 30), Angle(90,0,90), Color(255,95,10), brightness = 1, distance = 999,fov=179, shadows = 0, farz = 500},
|
||||
[39] = { "headlight", Vector( -20, 0, 10), Angle(-90,0,90), Color(255,95,10), brightness = 1, distance = 999,fov=179, shadows = 0, farz = 500},
|
||||
[70 ] = { "headlight", Vector( 450, -60, -47), Angle(45,-90,0), Color(255,255,255), brightness = 0.5, distance = 400 , fov=120, shadows = 1 },
|
||||
|
||||
}
|
||||
self.NetworkSwitches = {
|
||||
"VB",
|
||||
"RezMK",
|
||||
"VU3","VU1","VU2","AV8B","VU",
|
||||
"VUD2","VUD2L","VDL",
|
||||
"KDL","DIPon","DIPoff","VozvratRP","KSN","KDP",
|
||||
"KU1","KRZD","VUD1",
|
||||
--[["VB","VBA",
|
||||
|
||||
"KVT","VZP","VZD","KRZD",
|
||||
|
||||
"KDL","DIPon","DIPoff","VozvratRP","KSN","KDP",
|
||||
|
||||
"KU1","Ring","VUS","KAK","VAutodrive","VUD1",
|
||||
|
||||
"RezMK",
|
||||
|
||||
"VUD2","VUD2L","VDL",
|
||||
|
||||
"VRU","VAH","VAD","OVT","KSD","DP","VKF",
|
||||
|
||||
"OtklAVU","KRP",
|
||||
|
||||
"RC1","RC2","VRD",
|
||||
|
||||
"PB","VU3","VU1","VU2","AV8B","VU","KDLK","VDLK","KDPK","KAHK","L_3","RST","VSOSD",]]
|
||||
}
|
||||
self.Plombs = {
|
||||
VU = true,
|
||||
--[[RST = true,
|
||||
VAH = true,
|
||||
VAD = true,
|
||||
OVT = true,
|
||||
RC1 = true,
|
||||
RC2 = true,]]
|
||||
Init = true,
|
||||
}
|
||||
-- Lights
|
||||
--[[
|
||||
for i = 1,23 do
|
||||
self.Lights[69+i] = { "light", Vector(-470 + 35*i, 0, 65), Angle(180,0,0), Color(255,220,180), brightness = 0.25, scale = 0.75}
|
||||
--self:SetLightPower(69+i,RealTime()%1*2>1)
|
||||
end]]
|
||||
|
||||
-- Cross connections in train wires
|
||||
self.TrainWireInverts = {
|
||||
[18] = true,
|
||||
[34] = true,
|
||||
}
|
||||
self.TrainWireCrossConnections = {
|
||||
[5] = 4, -- Reverser F<->B
|
||||
[31] = 32, -- Doors L<->R
|
||||
}
|
||||
|
||||
-- Setup door positions
|
||||
self.LeftDoorPositions = {}
|
||||
self.RightDoorPositions = {}
|
||||
for i=0,3 do
|
||||
table.insert(self.LeftDoorPositions,Vector(353.0 - 35*0.5 - 231*i,65,-1.8))
|
||||
table.insert(self.RightDoorPositions,Vector(353.0 - 35*0.5 - 231*i,-65,-1.8))
|
||||
end
|
||||
|
||||
-- KV wrench mode
|
||||
self.KVWrenchMode = 0
|
||||
|
||||
-- Parking brake ratio
|
||||
self.ManualBrake = 0.0
|
||||
self.RearDoor = false
|
||||
self.FrontDoor = false
|
||||
self.CabinDoor = false
|
||||
self.PassengerDoor = false
|
||||
-- self.A5:TriggerInput("Set",0)
|
||||
self:UpdateTextures()
|
||||
end
|
||||
|
||||
function ENT:UpdateTextures()
|
||||
local texture = Metrostroi.Skins["train"][self.Texture]
|
||||
local passtexture = Metrostroi.Skins["pass"][self.PassTexture]
|
||||
local cabintexture = Metrostroi.Skins["cab"][self.CabTexture]
|
||||
|
||||
for k,v in pairs(self:GetMaterials()) do
|
||||
self:SetSubMaterial(k-1,"")
|
||||
end
|
||||
for k,v in pairs(self:GetMaterials()) do
|
||||
if v == "models/metrostroi_train/81/int02" then
|
||||
if not Metrostroi.Skins["717_schemes"] or not Metrostroi.Skins["717_schemes"]["m"] then
|
||||
--self:SetSubMaterial(k-1,Metrostroi.Skins["717_schemes"][""])
|
||||
else
|
||||
if not self.Adverts or self.Adverts ~= 4 then
|
||||
--self:SetSubMaterial(k-1,Metrostroi.Skins["717_schemes"]["m"].adv)
|
||||
else
|
||||
--self:SetSubMaterial(k-1,Metrostroi.Skins["717_schemes"]["m"].clean)
|
||||
end
|
||||
end
|
||||
end
|
||||
local tex = string.Explode("/",v)
|
||||
tex = tex[#tex]
|
||||
if cabintexture and cabintexture.textures[tex] then
|
||||
self:SetSubMaterial(k-1,cabintexture.textures[tex])
|
||||
end
|
||||
if passtexture and passtexture.textures[tex] then
|
||||
self:SetSubMaterial(k-1,passtexture.textures[tex])
|
||||
end
|
||||
if texture and texture.textures[tex] then
|
||||
self:SetSubMaterial(k-1,texture.textures[tex])
|
||||
end
|
||||
end
|
||||
self:SetNW2String("texture",self.Texture)
|
||||
self:SetNW2String("passtexture",self.PassTexture)
|
||||
self:SetNW2String("cabtexture",self.CabTexture)
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function ENT:Think()
|
||||
self.RetVal = self.BaseClass.Think(self)
|
||||
|
||||
-- Check if wrench was pulled out
|
||||
if self.DriversWrenchPresent then
|
||||
self.KV:TriggerInput("Enabled",self:IsWrenchPresent() and 1 or 0)
|
||||
end
|
||||
self:SetLightPower(1, self.Panel["HeadLights3"] > 0.5,(math.min(1,self.Panel["HeadLights1"])*0.50 +
|
||||
math.min(1,self.Panel["HeadLights2"])*0.25 +
|
||||
math.min(1,self.Panel["HeadLights3"])*0.25)
|
||||
)
|
||||
--self:SetLightPower(2, self.Panel["HeadLights2"] > 0.5)
|
||||
--self:SetLightPower(3, self.Panel["HeadLights2"] > 0.5)
|
||||
--self:SetLightPower(4, self.Panel["HeadLights1"] > 0.5)
|
||||
--self:SetLightPower(5, self.Panel["HeadLights1"] > 0.5)
|
||||
--self:SetLightPower(6, self.Panel["HeadLights1"] > 0.5)
|
||||
--self:SetLightPower(7, self.Panel["HeadLights2"] > 0.5)
|
||||
-- Reverser lights
|
||||
--self:SetLightPower(8, self.Panel["RedLightRight"] > 0.5)
|
||||
--self:SetLightPower(9, self.Panel["RedLightLeft"] > 0.5)
|
||||
self:SetPackedBool("HeadLights1",self.Panel["HeadLights1"] > 0.5)
|
||||
self:SetPackedBool("HeadLights2",self.Panel["HeadLights2"] > 0.5)
|
||||
self:SetPackedBool("RedLight",((self.Panel["RedLightLeft"] > 0.5 or self.Panel["RedLightRight"] > 0.5 ) and IsValid(self.FrontTrain)))
|
||||
|
||||
local lightsActive2 = self.PowerSupply.XT3_4 > 65.0
|
||||
local lightsActive1 = self.Panel["EmergencyLight"] > 0.5 or lightsActive2
|
||||
self:SetPackedBool("Lamps_emer",lightsActive1)
|
||||
self:SetPackedBool("Lamps_full",lightsActive2)
|
||||
|
||||
-- Interior/cabin lights
|
||||
self:SetLightPower(10, lightsActive2, 0.8)--self.Panel["CabinLight"] > 0.5)
|
||||
--local I = math.Round((self.Electric.I24-150)/1000.0,1.5)
|
||||
if self.Pneumatic.Compressor == 1 then
|
||||
local Light = (lightsActive2 and 0.6 or 0.3)
|
||||
--[[
|
||||
if I > 0 then
|
||||
Light = Light*(1-math.abs(I*0.1))
|
||||
end
|
||||
]]
|
||||
self:SetLightPower(11, lightsActive1, Light)
|
||||
self:SetLightPower(12, lightsActive1, Light)
|
||||
self:SetLightPower(13, lightsActive1, Light)
|
||||
else
|
||||
local Light = (lightsActive2 and 0.8 or 0.4)
|
||||
--[[
|
||||
if I > 0 then
|
||||
Light = Light*(1-math.abs(I*0.1))
|
||||
end
|
||||
]]
|
||||
self:SetLightPower(11, lightsActive1, Light)
|
||||
self:SetLightPower(12, lightsActive1, Light)
|
||||
self:SetLightPower(13, lightsActive1, Light)
|
||||
end
|
||||
|
||||
--self:SetLightPower(12, lightsActive1,0.1 + ((self.PowerSupply.XT3_4 > 65.0) and 0.7 or 0))
|
||||
--self:SetLightPower(13, lightsActive2, 0.8)
|
||||
--for i = 1,23 do
|
||||
--self:SetLightPower(69+i,lightsActive2 and true or lightsActive1 and i%5==1 or false)
|
||||
--end
|
||||
--self:SetLightPower(12, self.Panel["EmergencyLight"] > 0.5)
|
||||
--self:SetLightPower(13, self.PowerSupply.XT3_4 > 65.0)
|
||||
|
||||
-- Side lights
|
||||
--self:SetLightPower(15, self.Panel["TrainDoors"] > 0.5)
|
||||
--self:SetLightPower(19, self.Panel["TrainDoors"] > 0.5)
|
||||
|
||||
--self:SetLightPower(16, self.Panel["GreenRP"] > 0.5)
|
||||
--self:SetLightPower(20, self.Panel["GreenRP"] > 0.5)
|
||||
|
||||
--self:SetLightPower(17, self.Panel["TrainBrakes"] > 0.5)
|
||||
--self:SetLightPower(21, self.Panel["TrainBrakes"] > 0.5)
|
||||
|
||||
-- Total temperature
|
||||
local IGLA_Temperature = math.max(self.Electric.T1,self.Electric.T2)
|
||||
|
||||
-- Switch and button states
|
||||
self:SetPackedBool(0,self:IsWrenchPresent())
|
||||
|
||||
-- Signal if doors are open or no to platform simulation
|
||||
self.LeftDoorsOpen =
|
||||
(self.Pneumatic.LeftDoorState[1] > 0.5) or
|
||||
(self.Pneumatic.LeftDoorState[2] > 0.5) or
|
||||
(self.Pneumatic.LeftDoorState[3] > 0.5) or
|
||||
(self.Pneumatic.LeftDoorState[4] > 0.5)
|
||||
self.RightDoorsOpen =
|
||||
(self.Pneumatic.RightDoorState[1] > 0.5) or
|
||||
(self.Pneumatic.RightDoorState[2] > 0.5) or
|
||||
(self.Pneumatic.RightDoorState[3] > 0.5) or
|
||||
(self.Pneumatic.RightDoorState[4] > 0.5)
|
||||
self:WriteTrainWire(35,(self.Pneumatic.BrakeCylinderPressure > 0.1) and 1 or 0)
|
||||
|
||||
-- DIP/power
|
||||
self:SetPackedBool(32,self.Panel["V1"] > 0.5)
|
||||
-- Red RP
|
||||
local TW18 = self:GetTrainWire18()
|
||||
if self:ReadTrainWire(20) == 0 or (self.Panel["V1"] < 0.5) then TW18 = 0 end--(self.KV.ControllerPositionAutodrive == 0 and self.KV.ControllerPosition == 0)
|
||||
self:SetPackedBool(35,TW18 > 0.5)
|
||||
self:SetPackedBool(131,TW18 > 0)
|
||||
-- Green RP
|
||||
self:SetPackedBool(36,self.Panel["GreenRP"] > 0.5)
|
||||
-- Cabin heating
|
||||
--self:SetPackedBool(37,self.Panel["KUP"] > 0.5)
|
||||
-- AVU
|
||||
--self:SetPackedBool(38,self.Panel["AVU"] > 0.5)
|
||||
-- Ring
|
||||
self:SetPackedBool(39,self.Panel["Ring"] > 0.5)
|
||||
-- SD
|
||||
--self:SetPackedBool(40,self.Panel["SD"] > 0.5)
|
||||
self:SetPackedBool("DriverValveBLDisconnect",self.DriverValveBLDisconnect.Value == 1.0)
|
||||
self:SetPackedBool("DriverValveTLDisconnect",self.DriverValveTLDisconnect.Value == 1.0)
|
||||
for i=1,#self.NetworkSwitches do
|
||||
local switch = self.NetworkSwitches[i]
|
||||
self:SetPackedBool(switch,self[switch].Value == 1.0)
|
||||
end
|
||||
--self:SetPackedBool("Lamp6",self:ReadTrainWire(6) > 0.5)
|
||||
--self:SetPackedBool("Lamp1",self:ReadTrainWire(1) > 0.5)
|
||||
--self:SetPackedBool("Lamp2",self:ReadTrainWire(2) > 0.5)
|
||||
self:SetPackedBool("DoorsWag",self.BD.Value == 0.0 and self.Panel["V1"] > 0.5)
|
||||
self:SetPackedBool(20,self.Pneumatic.Compressor == 1.0)
|
||||
self:SetPackedBool(21,self.Pneumatic.LeftDoorState[1] > 0.5)
|
||||
self:SetPackedBool(25,self.Pneumatic.RightDoorState[1] > 0.5)
|
||||
self:SetPackedBool(112,(self.RheostatController.Velocity ~= 0.0))
|
||||
self:SetPackedBool(156,self.RearDoor)
|
||||
self:SetPackedBool(157,self.FrontDoor)
|
||||
self:SetPackedBool(158,self.PassengerDoor)
|
||||
self:SetPackedBool(159,self.CabinDoor)
|
||||
if self.VUD2.Blocked > 0 and self.VUD2L.Value > 0.5 then
|
||||
self.VUD2:TriggerInput("Block",0)
|
||||
end
|
||||
if self.VUD2.Blocked == 0 and self.VUD2L.Value == 0 then
|
||||
self.VUD2:TriggerInput("Block",1)
|
||||
end
|
||||
if self.VUD2L.Blocked > 0 and self.VUD2.Value > 0 then
|
||||
self.VUD2L:TriggerInput("Block",0)
|
||||
end
|
||||
if self.VUD2L.Blocked == 0 and self.VUD2.Value == 0 then
|
||||
self.VUD2L:TriggerInput("Block",1)
|
||||
end
|
||||
self:SetPackedBool("VUD2Bl",self.VUD2.Blocked > 0)
|
||||
self:SetPackedBool("VUD2LBl",self.VUD2L.Blocked > 0)
|
||||
--[[
|
||||
-- LST
|
||||
self:SetPackedBool(49,self:ReadTrainWire(6) > 0.5)
|
||||
-- LVD
|
||||
self:SetPackedBool(50,self:ReadTrainWire(1) > 0.5)
|
||||
|
||||
self:SetPackedBool(165,self.PB.Value > 0)
|
||||
|
||||
-- AV states
|
||||
-- for i,v in ipairs(self.Panel.AVMap) do
|
||||
-- if tonumber(v)
|
||||
-- then self:SetPackedBool(64+(i-1),self["A"..v].Value == 1.0)
|
||||
-- elseif self[v] then self:SetPackedBool(64+(i-1),self[v].Value == 1.0)
|
||||
-- end
|
||||
-- end
|
||||
|
||||
self:SetPackedBool(62,self.L_3.Value > 0.5)
|
||||
self:SetPackedBool(64+19,self.VU1.Value > 0.5)
|
||||
self:SetPackedBool(64+12,self.VU.Value > 0.5)
|
||||
self:SetPackedBool(64+24,self.RST.Value > 0.5)
|
||||
self:SetPackedBool(64+7 ,self.AV8B.Value > 0.5)
|
||||
self:SetPackedBool(64+36,self.VU2.Value > 0.5)
|
||||
self:SetPackedBool(64+13,self.VU3.Value > 0.5)
|
||||
self:SetPackedBool("VPR",self.RST.Value == 1.0 and self.Panel["V1"])
|
||||
]]
|
||||
-- Feed packed floats
|
||||
self:SetPackedRatio(0, 1-self.Pneumatic.DriverValvePosition/7)
|
||||
self:SetPackedRatio(1, (self.KV.ControllerPosition+3)/7)
|
||||
self:SetPackedRatio(2, 1-(self.KV.ReverserPosition+1)/2)
|
||||
self:SetPackedRatio(4, self.Pneumatic.ReservoirPressure/16.0)
|
||||
self:SetPackedRatio(5, self.Pneumatic.TrainLinePressure/16.0)
|
||||
self:SetPackedRatio(6, math.min(2.7,self.Pneumatic.BrakeCylinderPressure + 4.0*self.ManualBrake)/6.0)
|
||||
self:SetPackedRatio(7, self.Electric.Power750V/1000.0)
|
||||
self:SetPackedRatio(8, math.abs(self.Electric.I24)/1000.0)
|
||||
--self:SetPackedRatio(9, self.Pneumatic.BrakeLinePressure_dPdT or 0)
|
||||
if self.Pneumatic.TrainLineOpen then
|
||||
self:SetPackedRatio(9, (-self.Pneumatic.TrainLinePressure_dPdT or 0)*6)
|
||||
else
|
||||
self:SetPackedRatio(9, self.Pneumatic.BrakeLinePressure_dPdT or 0)
|
||||
end
|
||||
self:SetPackedRatio(10,(self.Panel["V1"] * self.Battery.Voltage) / 82.0)
|
||||
self:SetPackedRatio(11,IGLA_Temperature)
|
||||
|
||||
-- Update ARS system
|
||||
self:SetPackedRatio(3, self.ALS_ARS.Speed/100.0)
|
||||
self:SetPackedRatio("Speed", self.Speed/120)
|
||||
if (self.ALS_ARS.Ring == true) then
|
||||
self:SetPackedBool(39,true)
|
||||
end
|
||||
|
||||
-- Exchange some parameters between engines, pneumatic system, and real world
|
||||
self.Engines:TriggerInput("Speed",self.Speed)
|
||||
if IsValid(self.FrontBogey) and IsValid(self.RearBogey) and not self.IgnoreEngine then
|
||||
local A = 2*self.Engines.BogeyMoment
|
||||
self.FrontBogey.MotorForce = 30300+25000*(A < 0 and 1 or 0)
|
||||
self.FrontBogey.Reversed = (self.RKR.Value > 0.5)
|
||||
self.RearBogey.MotorForce = 30300+25000*(A < 0 and 1 or 0)
|
||||
self.RearBogey.Reversed = (self.RKR.Value < 0.5)
|
||||
|
||||
-- These corrections are required to beat source engine friction at very low values of motor power
|
||||
local A = 2*self.Engines.BogeyMoment
|
||||
local P = math.max(0,0.04449 + 1.06879*math.abs(A) - 0.465729*A^2)
|
||||
if math.abs(A) > 0.4 then P = math.abs(A) end
|
||||
if math.abs(A) < 0.05 then P = 0 end
|
||||
if self.Speed < 10 then P = P*(1.0 + 0.5*(10.0-self.Speed)/10.0) end
|
||||
self.RearBogey.MotorPower = P*0.5*((A > 0) and 1 or -1)
|
||||
self.FrontBogey.MotorPower = P*0.5*((A > 0) and 1 or -1)
|
||||
|
||||
-- Apply brakes
|
||||
self.FrontBogey.PneumaticBrakeForce = 50000.0
|
||||
self.FrontBogey.BrakeCylinderPressure = self.Pneumatic.BrakeCylinderPressure + 7.0*self.ManualBrake
|
||||
self.FrontBogey.BrakeCylinderPressure_dPdT = -self.Pneumatic.BrakeCylinderPressure_dPdT
|
||||
self.FrontBogey.ParkingBrake = false
|
||||
self.RearBogey.PneumaticBrakeForce = 50000.0
|
||||
self.RearBogey.BrakeCylinderPressure = self.Pneumatic.BrakeCylinderPressure + 7.0*self.ManualBrake
|
||||
self.RearBogey.BrakeCylinderPressure_dPdT = -self.Pneumatic.BrakeCylinderPressure_dPdT
|
||||
--self.RearBogey.ParkingBrake = self.ManualBrake.Value > 0.5
|
||||
end
|
||||
|
||||
-- Generate bogey sounds
|
||||
local jerk = math.abs((self.Acceleration - (self.PrevAcceleration or 0)) / self.DeltaTime)
|
||||
self.PrevAcceleration = self.Acceleration
|
||||
|
||||
if jerk > (2.0 + self.Speed/15.0) then
|
||||
self.PrevTriggerTime1 = self.PrevTriggerTime1 or CurTime()
|
||||
self.PrevTriggerTime2 = self.PrevTriggerTime2 or CurTime()
|
||||
|
||||
if ((math.random() > 0.00) or (jerk > 10)) and (CurTime() - self.PrevTriggerTime1 > 1.5) then
|
||||
self.PrevTriggerTime1 = CurTime()
|
||||
self.FrontBogey:EmitSound("subway_trains/chassis_"..math.random(1,3)..".wav", 70, math.random(90,110))
|
||||
end
|
||||
if ((math.random() > 0.00) or (jerk > 10)) and (CurTime() - self.PrevTriggerTime2 > 1.5) then
|
||||
self.PrevTriggerTime2 = CurTime()
|
||||
self.RearBogey:EmitSound("subway_trains/chassis_"..math.random(1,3)..".wav", 70, math.random(90,110))
|
||||
end
|
||||
end
|
||||
|
||||
-- Temporary hacks
|
||||
--self:SetNW2Float("V",self.Speed)
|
||||
--self:SetNW2Float("A",self.Acceleration)
|
||||
|
||||
return self.RetVal
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function ENT:OnButtonPress(button,ply)
|
||||
-- Parking brake
|
||||
if button == "ParkingBrakeLeft" then
|
||||
self.ManualBrake = math.max(0.0,(self.ManualBrake or 0) - 0.008)
|
||||
if self.ManualBrake == 0.0 then return end
|
||||
--print(self.ManualBrake)
|
||||
end
|
||||
if button == "ParkingBrakeRight" then
|
||||
self.ManualBrake = math.min(1.0,(self.ManualBrake or 0) + 0.008)
|
||||
if self.ManualBrake == 1.0 then return end
|
||||
--print(self.ManualBrake)
|
||||
end
|
||||
if string.find(button,"PneumaticBrakeSet") then
|
||||
self.Pneumatic:TriggerInput("BrakeSet",tonumber(button:sub(-1,-1)))
|
||||
return
|
||||
end
|
||||
if button:find("FrontDoor") then
|
||||
self.FrontDoor = not self.FrontDoor
|
||||
if self.FrontDoor then self:PlayOnce("door_open_tor","cabin") else self:PlayOnce("door_close_tor","cabin") end
|
||||
end
|
||||
if button:find("RearDoor") then
|
||||
self.RearDoor = not self.RearDoor
|
||||
if self.RearDoor then self:PlayOnce("door_open_tor") else self:PlayOnce("door_close_tor") end
|
||||
end
|
||||
if button:find("PassengerDoor") then
|
||||
self.PassengerDoor = not self.PassengerDoor
|
||||
if self.PassengerDoor then self:PlayOnce("door_open_tor","cabin") else self:PlayOnce("door_close_tor","cabin") end
|
||||
end
|
||||
if button:find("CabinDoor") then
|
||||
self.CabinDoor = not self.CabinDoor
|
||||
if self.CabinDoor then self:PlayOnce("door_open_tor","cabin") else self:PlayOnce("door_close_tor","cabin") end
|
||||
end
|
||||
if button == "UAVAToggle" then
|
||||
local state = self.UAVA.TargetValue < 0.5 and "enabled" or "disabled"
|
||||
RunConsoleCommand("say",ply:GetName().." "..state.." UAVA!")
|
||||
end
|
||||
if button == "VRDToggle" then
|
||||
local state = self.VRD.TargetValue < 0.5 and "enabled" or "disabled"
|
||||
RunConsoleCommand("say",ply:GetName().." "..state.." VRD!")
|
||||
end
|
||||
if button == "NextSign" then
|
||||
self:PrepareSigns()
|
||||
self.SignsIndex = self.SignsIndex + 1
|
||||
if self.SignsIndex > #self.SignsList then self.SignsIndex = 1 end
|
||||
|
||||
self:SetNW2String("FrontText",self.SignsList[self.SignsIndex][2])
|
||||
end
|
||||
if button == "PrevSign" then
|
||||
self:PrepareSigns()
|
||||
self.SignsIndex = self.SignsIndex - 1
|
||||
if self.SignsIndex < 1 then self.SignsIndex = #self.SignsList end
|
||||
|
||||
self:SetNW2String("FrontText",self.SignsList[self.SignsIndex][2])
|
||||
end
|
||||
|
||||
if button == "Num1P" then
|
||||
if not self.RouteNumber then self.RouteNumber = "00" end
|
||||
local num = tonumber(self.RouteNumber[2])
|
||||
num = num + 1
|
||||
if num > 9 then num = 0 end
|
||||
self.RouteNumber = string.SetChar(self.RouteNumber,2, num)
|
||||
self:SetNW2String("RouteNumber",self.RouteNumber)
|
||||
local trn = self.WagonList[#self.WagonList]
|
||||
if IsValid(trn) and trn ~= self then
|
||||
trn.RouteNumber = self.RouteNumber
|
||||
trn:SetNW2String("RouteNumber",self.RouteNumber)
|
||||
end
|
||||
end
|
||||
if button == "Num1M" then
|
||||
if not self.RouteNumber then self.RouteNumber = "00" end
|
||||
local num = tonumber(self.RouteNumber[2])
|
||||
num = num - 1
|
||||
if num < 0 then num = 9 end
|
||||
self.RouteNumber = string.SetChar(self.RouteNumber,2, num)
|
||||
self:SetNW2String("RouteNumber",self.RouteNumber)
|
||||
local trn = self.WagonList[#self.WagonList]
|
||||
if IsValid(trn) and trn ~= self then
|
||||
trn.RouteNumber = self.RouteNumber
|
||||
trn:SetNW2String("RouteNumber",self.RouteNumber)
|
||||
end
|
||||
end
|
||||
if button == "Num2P" then
|
||||
if not self.RouteNumber then self.RouteNumber = "00" end
|
||||
local num = tonumber(self.RouteNumber[1])
|
||||
num = num + 1
|
||||
if num > 9 then num = 0 end
|
||||
self.RouteNumber = string.SetChar(self.RouteNumber,1, num)
|
||||
self:SetNW2String("RouteNumber",self.RouteNumber)
|
||||
local trn = self.WagonList[#self.WagonList]
|
||||
if IsValid(trn) and trn ~= self then
|
||||
trn.RouteNumber = self.RouteNumber
|
||||
trn:SetNW2String("RouteNumber",self.RouteNumber)
|
||||
end
|
||||
end
|
||||
if button == "Num2M" then
|
||||
if not self.RouteNumber then self.RouteNumber = "00" end
|
||||
local num = tonumber(self.RouteNumber[1])
|
||||
num = num - 1
|
||||
if num < 0 then num = 9 end
|
||||
self.RouteNumber = string.SetChar(self.RouteNumber,1, num)
|
||||
self:SetNW2String("RouteNumber",self.RouteNumber)
|
||||
local trn = self.WagonList[#self.WagonList]
|
||||
if IsValid(trn) and trn ~= self then
|
||||
trn.RouteNumber = self.RouteNumber
|
||||
trn:SetNW2String("RouteNumber",self.RouteNumber)
|
||||
end
|
||||
end
|
||||
|
||||
-- Parking brake
|
||||
if button == "ManualBrakeLeft" then
|
||||
self.ManualBrake = math.max(0.0,self.ManualBrake - 0.008)
|
||||
if self.ManualBrake == 0.0 then return end
|
||||
--print(self.ManualBrake)
|
||||
end
|
||||
if button == "ManualBrakeRight" then
|
||||
self.ManualBrake = math.min(1.0,self.ManualBrake + 0.008)
|
||||
if self.ManualBrake == 1.0 then return end
|
||||
--print(self.ManualBrake)
|
||||
end
|
||||
|
||||
if button == "KVUp" then
|
||||
if self.KV.ControllerPosition ~= -1 then
|
||||
self.KV:TriggerInput("ControllerUp",1.0)
|
||||
end
|
||||
end
|
||||
if button == "KVUp_Unlocked" then
|
||||
self.KV:TriggerInput("ControllerUp",1.0)
|
||||
end
|
||||
if button == "KVDown" then
|
||||
self.KV:TriggerInput("ControllerDown",1.0)
|
||||
end
|
||||
|
||||
-- KRU
|
||||
if (self.KVWrenchMode == 2) and (button == "KVReverserUp") then
|
||||
self.KRU:TriggerInput("Up",1)
|
||||
self:OnButtonPress("KRUUp")
|
||||
end
|
||||
if (self.KVWrenchMode == 2) and (button == "KVReverserDown") then
|
||||
self.KRU:TriggerInput("Down",1)
|
||||
self:OnButtonPress("KRUDown")
|
||||
end
|
||||
if (self.KVWrenchMode == 2) and (button == "KVSetX1") then
|
||||
self.KRU:TriggerInput("SetX1",1)
|
||||
self:OnButtonPress("KRUSetX1")
|
||||
end
|
||||
if (self.KVWrenchMode == 2) and (button == "KVSetX2") then
|
||||
self.KRU:TriggerInput("SetX2",1)
|
||||
self:OnButtonPress("KRUSetX2")
|
||||
end
|
||||
if (self.KVWrenchMode == 2) and (button == "KVSetX3") then
|
||||
self.KRU:TriggerInput("SetX3",1)
|
||||
self:OnButtonPress("KRUSetX3")
|
||||
end
|
||||
if (self.KVWrenchMode == 2) and (button == "KVSet0") then
|
||||
self.KRU:TriggerInput("Set0",1)
|
||||
self:OnButtonPress("KRUSet0")
|
||||
end
|
||||
|
||||
if button == "KVSetT1AB" then
|
||||
if self.KV.ControllerPosition == -2 then
|
||||
self.KV:TriggerInput("ControllerSet",-1)
|
||||
timer.Simple(0.20,function()
|
||||
self.KV:TriggerInput("ControllerSet",-2)
|
||||
end)
|
||||
else
|
||||
self.KV:TriggerInput("ControllerSet",-2)
|
||||
end
|
||||
end
|
||||
if button == "KVWrench0" then
|
||||
if self.KVWrenchMode == 3 or self.KVWrenchMode == 1 then
|
||||
if self.KVWrenchMode ~= 1 then
|
||||
self:PlayOnce("revers_in","cabin",0.7)
|
||||
end
|
||||
self.KVWrenchMode = 0
|
||||
self.DriversWrenchPresent = false
|
||||
self.DriversWrenchMissing = false
|
||||
self.KV:TriggerInput("Enabled",1)
|
||||
self.KRU:TriggerInput("Enabled",0)
|
||||
end
|
||||
end
|
||||
if button == "KVWrenchKV" then
|
||||
if self.KVWrenchMode == 3 or self.KVWrenchMode == 0 then
|
||||
if self.KVWrenchMode ~= 0 then
|
||||
self:PlayOnce("revers_in","cabin",0.7)
|
||||
end
|
||||
self.KVWrenchMode = 1
|
||||
self.DriversWrenchPresent = true
|
||||
self.DriversWrenchMissing = false
|
||||
self.KV:TriggerInput("Enabled",1)
|
||||
self.KRU:TriggerInput("Enabled",0)
|
||||
end
|
||||
end
|
||||
--THERE IS NO KRU IN THIS EZH MODEL
|
||||
--[[
|
||||
if button == "KVWrenchKRU" then
|
||||
if self.KVWrenchMode == 3 then
|
||||
self:PlayOnce("kru_in","cabin",0.7)
|
||||
self.KVWrenchMode = 2
|
||||
self.DriversWrenchPresent = false
|
||||
self.DriversWrenchMissing = true
|
||||
self.KV:TriggerInput("Enabled",0)
|
||||
self.KRU:TriggerInput("Enabled",1)
|
||||
self.KRU:TriggerInput("LockX3",1)
|
||||
end
|
||||
end]]
|
||||
if button == "KVWrenchNone" then
|
||||
if self.KVWrenchMode ~= 3 and self.KV.ReverserPosition == 0 then
|
||||
if self.KVWrenchMode == 2 then
|
||||
self:PlayOnce("kru_out","cabin",0.7)
|
||||
else
|
||||
self:PlayOnce("revers_out","cabin",0.7)
|
||||
end
|
||||
self.KVWrenchMode = 3
|
||||
self.DriversWrenchPresent = false
|
||||
self.DriversWrenchMissing = true
|
||||
self.KV:TriggerInput("Enabled",0)
|
||||
self.KRU:TriggerInput("Enabled",0)
|
||||
end
|
||||
end
|
||||
--if button == "KVT2Set" then self.KVT:TriggerInput("Close",1) end
|
||||
if button == "KDL" and self.VUD1.Value < 1 then self.KDL:TriggerInput("Close",1) self:OnButtonPress("KDLSet") end
|
||||
if button == "KDP" and self.VUD1.Value < 1 then self.KDP:TriggerInput("Close",1) self:OnButtonPress("KDPSet") end
|
||||
if button == "VDL" and self.VUD1.Value < 1 then self.VDL:TriggerInput("Close",1) self:OnButtonPress("VDLSet") end
|
||||
if button == "KRP" then
|
||||
self.KRP:TriggerInput("Set",1)
|
||||
self:OnButtonPress("KRPSet")
|
||||
end
|
||||
if button == "EmergencyBrake" then
|
||||
self.KV:TriggerInput("ControllerSet",-3)
|
||||
self.Pneumatic:TriggerInput("BrakeSet",7)
|
||||
self.DriverValveBLDisconnect:TriggerInput("Set",1)
|
||||
return
|
||||
end
|
||||
if button == "DriverValveDisconnect" then
|
||||
if self.DriverValveBLDisconnect.Value == 0 or self.DriverValveTLDisconnect.Value == 0 then
|
||||
self.DriverValveBLDisconnect:TriggerInput("Set",1)
|
||||
self.DriverValveTLDisconnect:TriggerInput("Set",1)
|
||||
else
|
||||
self.DriverValveBLDisconnect:TriggerInput("Set",0)
|
||||
self.DriverValveTLDisconnect:TriggerInput("Set",0)
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
-- Special logic
|
||||
if (button == "VDL") or (button == "KDL") or (button == "KDP") then
|
||||
--self.VUD1:TriggerInput("Open",1)
|
||||
end
|
||||
if (button == "KDP") then
|
||||
--self.DoorSelect:TriggerInput("Close",1)
|
||||
end
|
||||
if (button == "VUD1Set") or (button == "VUD1Toggle") or
|
||||
(button == "VUD2Set") or (button == "VUD2Toggle") then
|
||||
self.VDL:TriggerInput("Open",1)
|
||||
self.KDL:TriggerInput("Open",1)
|
||||
self.KDP:TriggerInput("Open",1)
|
||||
end
|
||||
|
||||
if button == "GVToggle" then
|
||||
if self.GV.Value > 0.5 then
|
||||
self:PlayOnce("revers_f",nil,0.7)
|
||||
else
|
||||
self:PlayOnce("revers_b",nil,0.7)
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
if (button == "UAVAToggle") then
|
||||
if self.UAVA then
|
||||
if self.UAVA.Value > 0.5 then
|
||||
self:PlayOnce("uava_off","cabin")
|
||||
else
|
||||
self:PlayOnce("uava_off","cabin")
|
||||
end
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:OnButtonRelease(button)
|
||||
if string.find(button,"PneumaticBrakeSet") then
|
||||
return
|
||||
end
|
||||
--if button == "KVT2Set" then self.KVT:TriggerInput("Open",1) end
|
||||
if button == "KDL" and self.VUD1.Value < 1 then self.KDL:TriggerInput("Open",1) self:OnButtonRelease("KDLSet") end
|
||||
if button == "KDP" and self.VUD1.Value < 1 then self.KDP:TriggerInput("Open",1) self:OnButtonRelease("KDPSet") end
|
||||
if button == "VDL" and self.VUD1.Value < 1 then self.VDL:TriggerInput("Open",1) self:OnButtonRelease("VDLSet") end
|
||||
if button == "KRP" then
|
||||
self.KRP:TriggerInput("Set",0)
|
||||
self:OnButtonRelease("KRPSet")
|
||||
end
|
||||
|
||||
--[[
|
||||
if (button == "PneumaticBrakeDown") and (self.Pneumatic.DriverValvePosition == 1) then
|
||||
self.Pneumatic:TriggerInput("BrakeSet",2)
|
||||
end
|
||||
if self.Pneumatic.ValveType == 1 then
|
||||
if (button == "PneumaticBrakeUp") and (self.Pneumatic.DriverValvePosition == 5) then
|
||||
self.Pneumatic:TriggerInput("BrakeSet",4)
|
||||
end
|
||||
end
|
||||
]]
|
||||
|
||||
if (not string.find(button,"KVT")) and string.find(button,"KV") then return end
|
||||
if string.find(button,"KRU") then return end
|
||||
end
|
||||
|
||||
function ENT:OnCouple(train,isfront)
|
||||
if isfront and self.FrontAutoCouple then
|
||||
self.FrontBrakeLineIsolation:TriggerInput("Open",1.0)
|
||||
self.FrontTrainLineIsolation:TriggerInput("Open",1.0)
|
||||
self.FrontAutoCouple = false
|
||||
elseif not isfront and self.RearAutoCouple then
|
||||
self.RearBrakeLineIsolation:TriggerInput("Open",1.0)
|
||||
self.RearTrainLineIsolation:TriggerInput("Open",1.0)
|
||||
self.RearAutoCouple = false
|
||||
end
|
||||
self.BaseClass.OnCouple(self,train,isfront)
|
||||
end
|
||||
91
lua/entities/_obsolete/gmod_subway_em/shared.lua
Normal file
91
lua/entities/_obsolete/gmod_subway_em/shared.lua
Normal file
@@ -0,0 +1,91 @@
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "gmod_subway_base"
|
||||
|
||||
ENT.PrintNameTranslated = "Entities.Em"
|
||||
ENT.Author = "Oldy"
|
||||
ENT.Contact = "oldy702@gmail.com"
|
||||
ENT.Purpose = ""
|
||||
ENT.Instructions = ""
|
||||
ENT.Category = "Metrostroi (trains)"
|
||||
|
||||
ENT.Spawnable = false --NOT FINISHED
|
||||
ENT.AdminSpawnable = false --NOT FINISHED
|
||||
|
||||
function ENT:PassengerCapacity()
|
||||
return 300
|
||||
end
|
||||
|
||||
function ENT:GetStandingArea()
|
||||
return Vector(-450,-30,-45),Vector(380,30,-45)
|
||||
end
|
||||
|
||||
function ENT:InitializeSounds()
|
||||
self.BaseClass.InitializeSounds(self)
|
||||
self.SoundNames["relay_close2"] = nil
|
||||
self.SoundNames["rvt_close"] = nil
|
||||
self.SoundNames["r1_5_close"] = nil
|
||||
self.SoundNames["rvt_open"] = nil
|
||||
self.SoundNames["r1_5_open"] = nil
|
||||
--[[self.SoundNames["relay_close4"] = {"subway_trains/new/relay_7.wav","subway_trains/new/lsd_4.wav"}
|
||||
self.SoundNames["pneumo_switch"] = {
|
||||
"subway_trains/pneumo_8.wav",
|
||||
"subway_trains/pneumo_9.wav",
|
||||
}
|
||||
self.SoundNames["rk_spin"] = "subway_trains/rk_3.wav"
|
||||
self.SoundNames["rk_stop"] = "subway_trains/rk_4.wav"
|
||||
]]
|
||||
end
|
||||
|
||||
function ENT:InitializeSystems()
|
||||
-- Электросистема 81-710
|
||||
self:LoadSystem("Electric","81_704_Electric")
|
||||
|
||||
-- Токоприёмник
|
||||
self:LoadSystem("TR","TR_3B")
|
||||
-- Электротяговые двигатели
|
||||
self:LoadSystem("Engines","DK_117DM")
|
||||
|
||||
-- Резисторы для реостата/пусковых сопротивлений
|
||||
self:LoadSystem("KF_47A","KF_47A")
|
||||
-- Резисторы для ослабления возбуждения
|
||||
self:LoadSystem("KF_50A")
|
||||
-- Ящик с предохранителями
|
||||
self:LoadSystem("YAP_57")
|
||||
|
||||
-- Резисторы для цепей управления
|
||||
--self:LoadSystem("YAS_44V")
|
||||
-- Реостатный контроллер для управления пусковыми сопротивления
|
||||
self:LoadSystem("RheostatController","EKG_17B")
|
||||
-- Групповой переключатель положений
|
||||
self:LoadSystem("PositionSwitch","EKG_18B")
|
||||
-- Кулачковый контроллер
|
||||
self:LoadSystem("KV","KV_70")--_lite")
|
||||
-- Контроллер резервного управления
|
||||
self:LoadSystem("KRU")
|
||||
|
||||
|
||||
-- Ящики с реле и контакторами
|
||||
self:LoadSystem("LK_755A")
|
||||
self:LoadSystem("YAR_13A")
|
||||
self:LoadSystem("YAR_27")
|
||||
self:LoadSystem("YAK_36")
|
||||
self:LoadSystem("YAK_37E")
|
||||
self:LoadSystem("YAS_44V")
|
||||
self:LoadSystem("YARD_2")
|
||||
self:LoadSystem("PR_14X_Panels")
|
||||
|
||||
-- Пневмосистема 81-710
|
||||
self:LoadSystem("Pneumatic","81_717_Pneumatic")
|
||||
self.Pneumatic.ValveType = 1
|
||||
-- Панель управления Е
|
||||
self:LoadSystem("Panel","81_704_Panel")
|
||||
-- Everything else
|
||||
self:LoadSystem("Battery")
|
||||
self:LoadSystem("PowerSupply","DIP_01K")
|
||||
self:LoadSystem("Horn")
|
||||
self:LoadSystem("Announcer")
|
||||
|
||||
self:LoadSystem("ADoorDisable","Relay")
|
||||
|
||||
self:LoadSystem("ALS_ARS","NoARS")
|
||||
end
|
||||
Reference in New Issue
Block a user