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

release branch init

This commit is contained in:
g_brzhezinskiy
2021-01-02 15:32:05 +03:00
parent 1d05caf866
commit 09566ce158
398 changed files with 8389 additions and 77275 deletions

View File

@@ -16,47 +16,7 @@ local TypesOfSignal = {"Inside","Outside big","Outside small"}
local TypesOfSign = {"NF","40","60","70","80","Station border","C(horn) Street","STOP Street","Dangerous","Deadlock",
"Stop marker","!(stop)","X","T Start","T End","T Sbor(engage)","Engines off","Engines on","C(horn)","T stop emer","Shod",
"Left doors","Phone▲","Phone▼","1up","STOP Street cyka","NF outside","35 outside","40 outside","60 outside","70 outside","80 outside",
"T Sbor(engage) outside","35","Dangerous 200","CR End","CR End(inv)","2up","3up","4up","5up","6up","X outside", "Metal","50","50 outside",
"Forward x2",
"Ted Off kn",
"Ted Off p1",
"Ted Off p2",
"Ted Off pn",
"Ted Off t1",
"Ted Off t2",
"Ted Off t3",
"Ted Off t4",
"Ted On kn",
"Ted On p1",
"Ted On p2",
"Ted On pn",
"Ted On t1",
"Ted On t2",
"Ted On t3",
"Ted On t4",
"Ted Off 722 10%",
"Ted Off 722 20%",
"Ted Off 722 30%",
"Ted Off 722 40%",
"Ted Off 722 50%",
"Ted Off 722 60%",
"Ted Off 722 70%",
"Ted Off 722 80%",
"Ted Off 722 90%",
"Ted Off 722 100%",
"Ted Off Outside",
"Ted On 722 10%",
"Ted On 722 20%",
"Ted On 722 30%",
"Ted On 722 40%",
"Ted On 722 50%",
"Ted On 722 60%",
"Ted On 722 70%",
"Ted On 722 80%",
"Ted On 722 90%",
"Ted On 722 100%",
"Ted On Outside",
}
"T Sbor(engage) outside","35","Dangerous 200","CR End","CR End(inv)","2up","3up","4up","5up","6up","X outside", "Metal","50","50 outside"}
local RouteTypes = {"Auto", "Manual","Repeater","Emerg"}
local TypesOfAuto = {
@@ -261,14 +221,14 @@ function TOOL:SpawnAutoPlate(ply,trace,param)
self.Auto.PAStationHorlift = ent.PAStationHorlift
end
elseif self.Auto.Type == METROSTROI_SBPPSENSOR and not ent.Linked then
self.Auto.SBPPType = ent.SBPPType
self.Auto.SBPPType = ent.Type
self.Auto.SBPPDeadlock = ent.IsDeadlock
self.Auto.SBPPStationPath = ent.StationPath
self.Auto.SBPPStationID = ent.StationID
self.Auto.SBPPDriveMode = ent.DriveMode
self.Auto.SBPPRightDoors = ent.RightDoors
self.Auto.SBPPWTime = ent.WTime or 0
self.Auto.SBPPRK = ent.RKPos or 1
self.Auto.SBPPWTime = ent.WTime
self.Auto.SBPPRK = ent.RKPos
self.Auto.LXp = ent.DistanceToOPV
end
self.Auto.LXp = ent.DistanceToOPV or ent.LXp or self.Auto.LXp
@@ -402,11 +362,11 @@ function TOOL:SpawnAutoPlate(ply,trace,param)
ent.PAType = self.Auto.PAType
ent.PAStationPath = tonumber(self.Auto.PAStationPath)
ent.PAStationID = tonumber(self.Auto.PAStationID)
ent.PAStationName = self.Auto.PAStationName or "N/A"
ent.PAStationName = self.Auto.PAStationName
ent.PALastStation = self.Auto.PALastStation
ent.PAWrongPath = self.Auto.PAWrongPath
ent.PADeadlockStart = self.Auto.PADeadlockStart or 128
ent.PADeadlockEnd = self.Auto.PADeadlockEnd or 512
ent.PADeadlockStart = self.Auto.PADeadlockStart
ent.PADeadlockEnd = self.Auto.PADeadlockEnd
ent.PALineChange = self.Auto.PALineChange
ent.PALineChangeStationPath = self.Auto.PALineChangeStationPath
ent.PALineChangeStationID = self.Auto.PALineChangeStationID
@@ -861,7 +821,7 @@ function TOOL:BuildCPanelCustom()
tool:SendSettings()
end
local VEnRouC = CollCat:CheckBox("Enable route number")
VEnRouC:SetTooltip("Enable route number(when disabled route number enables only with invitation signal)")
VEnRouC:SetTooltip("Enable route number(when disabled route number enables only with invation signal)")
VEnRouC:SetValue(tool.Signal.Routes[i].EnRou or false)
function VEnRouC:OnChange()
tool.Signal.Routes[i].EnRou = self:GetChecked()
@@ -1243,7 +1203,7 @@ function TOOL:BuildCPanelCustom()
end
if SBPPType==7 then
local SRK = CPanel:NumSlider("RK Pos:",nil,1,18,0)
SRK:SetValue(tool.Auto.SBPPRK or 1)
SRK:SetValue(tool.Auto.SBPPRK or 0)
SRK.OnValueChanged = function(num)
tool.Auto.SBPPRK = SRK:GetValue()
tool:SendSettings()

View File

@@ -5,7 +5,7 @@ TOOL.AddToMenu = false
if CLIENT then
language.Add("Tool.train_spawner.name", "Train Spawner")
language.Add("Tool.train_spawner.desc", "Spawn a train")
language.Add("Tool.train_spawner.0", "Primary: Spawns a full train. Secondary: Reverse facing (yellow ed when facing the opposite side).")
language.Add("Tool.train_spawner.0", "Primary: Spawns a full train. Secondary: self.Reverse facing (yellow ed when facing the opposite side).")
language.Add("Undone_81-7036", "Undone 81-7036 (does not work)")
language.Add("Undone_81-7037", "Undone 81-7037 (does not work)")
language.Add("Undone_81-717", "Undone 81-717")
@@ -79,23 +79,6 @@ function UpdateGhostPos(pl)
end
end
function UpdateWagPos(pl)
local trace = util.TraceLine(util.GetPlayerTrace(pl))
local tbl = Metrostroi.RerailGetTrackData(trace.HitPos,pl:GetAimVector())
if not tbl then tbl = Trace(pl, trace) end
local pos,ang = Vector(0,0,0),Angle(0,0,0)
if tbl[3] ~= nil then
pos = tbl[1]
ang = tbl[2]
return pos,ang,false
else
pos = tbl.centerpos + Vector(0,0,112-55)
ang = tbl.right:Angle()+Angle(0,90,0)
return pos,ang,true
end
end
function TOOL:UpdateGhost()
local good,canDraw
@@ -166,12 +149,6 @@ function TOOL:Think()
self:OnRemove()
end
end)
local oldOR = self.GhostEntities[1].OnRemove
self.GhostEntities[1].OnRemove = function(ent)
hook.Remove("Think",ent)
oldOR(ent)
end
else
self:UpdateGhost()
end
@@ -213,9 +190,9 @@ function TOOL:SpawnWagon(trace)
local ent
if i == 1 then
if spawnfunc then
ent = self.Train:SpawnFunction(ply,trace,spawnfunc(i,self.Settings,self.Train),self:GetOwner():GetNW2Bool("metrostroi_train_spawner_rev"),UpdateWagPos)
ent = self.Train:SpawnFunction(ply,trace,spawnfunc(i,self.Settings,self.Train),self:GetOwner():GetNW2Bool("metrostroi_train_spawner_rev"))
else
ent = self.Train:SpawnFunction(ply,trace,self.Train.Spawner.head or self.Train.ClassName,self:GetOwner():GetNW2Bool("metrostroi_train_spawner_rev"),UpdateWagPos)
ent = self.Train:SpawnFunction(ply,trace,self.Train.Spawner.head or self.Train.ClassName,self:GetOwner():GetNW2Bool("metrostroi_train_spawner_rev"))
end
--nil,self:GetOwner():GetNW2Bool("metrostroi_train_spawner_rev") and Angle(0,180,0) or Angle(0,0,0)) --Create a first entity in queue
if ent then
@@ -259,6 +236,7 @@ function TOOL:SpawnWagon(trace)
if haveCoupler then
bogeyE1:SetAngles(ent:LocalToWorldAngles(bogeyE1.SpawnAng))
bogeyE2:SetAngles(ent:LocalToWorldAngles(bogeyE1.SpawnAng))
--print(couplL1 == LastEnt.RearBogey,couplL1 == ent.RearCouple,couplL2 == ent.RearCouple)
-- Set bogey position by our bogey couple offset and lastent bogey couple offset
couplE1:SetPos(
couplL1:LocalToWorld(
@@ -303,6 +281,7 @@ function TOOL:SpawnWagon(trace)
Metrostroi.RerailTrain(ent) --Rerail train
--LastEnt:LocalToWorld(bogeyL1:WorldToLocal(Vector))))
--print)
LastRot = rot
end
@@ -330,7 +309,6 @@ function TOOL:SpawnWagon(trace)
if self.Train.Spawner.func then self.Train.Spawner.func(ent,i,self.Settings.WagNum,LastRot) end
if self.Train.Spawner.wagfunc then ent:GenerateWagonNumber(function(_,number) return self.Train.Spawner.wagfunc(ent,i,number) end) end
if ent.TrainSpawnerUpdate then ent:TrainSpawnerUpdate() end
for k,v in pairs(ent.CustomSpawnerUpdates) do if k ~= "BaseClass" then v(ent) end end
hook.Run("MetrostroiSpawnerUpdate",ent,self.Settings)
ent:UpdateTextures()
ent.FrontAutoCouple = i > 1 and i < self.Settings.WagNum
@@ -399,7 +377,6 @@ function TOOL:Reload(trace)
spawner:SpawnFunction(self:GetOwner())
end
function TOOL:LeftClick(trace)
if not self.Train then return end
local class = IsValid(trace.Entity) and trace.Entity:GetClass()
if class and (trace.Entity.Spawner or class ~= "func_door" and class ~= "prop_door_rotating") then
if SERVER then
@@ -427,7 +404,6 @@ function TOOL:LeftClick(trace)
if self.Train.Spawner.func then self.Train.Spawner.func(ent,k,self.Settings.WagNum,rot) end
ent:GenerateWagonNumber(self.Train.Spawner.wagfunc)
if ent.TrainSpawnerUpdate then ent:TrainSpawnerUpdate() end
for k,v in pairs(ent.CustomSpawnerUpdates) do if k ~= "BaseClass" then v(ent) end end
hook.Run("MetrostroiSpawnerUpdate",ent,self.Settings)
ent:UpdateTextures()
table.insert(trains,ent)
@@ -459,7 +435,6 @@ function TOOL:LeftClick(trace)
end
function TOOL:RightClick(trace)
if not self.Train then return end
if IsValid(trace.Entity) then
if SERVER then
if trace.Entity.ClassName == (self.Train.Spawner.head or self.Train.ClassName) or trace.Entity.ClassName == self.Train.Spawner.interim then
@@ -482,7 +457,6 @@ function TOOL:RightClick(trace)
if self.Train.Spawner.func then self.Train.Spawner.func(ent,k,self.Settings.WagNum,rot) end
ent:GenerateWagonNumber(self.Train.Spawner.wagfunc)
if ent.TrainSpawnerUpdate then ent:TrainSpawnerUpdate() end
for k,v in pairs(ent.CustomSpawnerUpdates) do if k ~= "BaseClass" then v(ent) end end
hook.Run("MetrostroiSpawnerUpdate",ent,self.Settings)
ent:UpdateTextures()
table.insert(trains,ent)