mirror of
https://github.com/metrostroi-repo/MetrostroiAddon.git
synced 2026-05-02 00:42:29 +00:00
fix param Signal
This commit is contained in:
@@ -506,10 +506,10 @@ tps:defaultAccess( ULib.ACCESS_ALL )
|
|||||||
tps:help( "Teleport between stations." )
|
tps:help( "Teleport between stations." )
|
||||||
|
|
||||||
|
|
||||||
function ulx.sroutes( calling_ply, signal )
|
function ulx.sroutes( calling_ply, sig )
|
||||||
if not IsValid(calling_ply) then return end
|
if not IsValid(calling_ply) then return end
|
||||||
local Train = calling_ply:GetTrain()
|
local Train = calling_ply:GetTrain()
|
||||||
if IsValid(Train) then
|
if IsValid(Train) and (not sig or sig == "") then
|
||||||
local signal
|
local signal
|
||||||
-- Get train position
|
-- Get train position
|
||||||
local pos = Metrostroi.TrainPositions[Train]
|
local pos = Metrostroi.TrainPositions[Train]
|
||||||
@@ -518,7 +518,6 @@ function ulx.sroutes( calling_ply, signal )
|
|||||||
if pos then
|
if pos then
|
||||||
signal = Metrostroi.GetARSJoint(pos.node1,pos.x,Metrostroi.TrainDirections[Train], Train)
|
signal = Metrostroi.GetARSJoint(pos.node1,pos.x,Metrostroi.TrainDirections[Train], Train)
|
||||||
end
|
end
|
||||||
|
|
||||||
if signal then
|
if signal then
|
||||||
local found = false
|
local found = false
|
||||||
for k,v in pairs(signal.Routes or {}) do
|
for k,v in pairs(signal.Routes or {}) do
|
||||||
@@ -542,6 +541,9 @@ function ulx.sroutes( calling_ply, signal )
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
local signal = Metrostroi.GetSignalByName(sig)
|
local signal = Metrostroi.GetSignalByName(sig)
|
||||||
|
if not signal and sig then
|
||||||
|
signal = Metrostroi.GetSignalByName(sig:upper())
|
||||||
|
end
|
||||||
if not signal then
|
if not signal then
|
||||||
ULib.tsayError( calling_ply, "Signal not found", true)
|
ULib.tsayError( calling_ply, "Signal not found", true)
|
||||||
return
|
return
|
||||||
@@ -567,7 +569,7 @@ function ulx.sroutes( calling_ply, signal )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
local sroutes = ulx.command( CATEGORY_NAME, "ulx sroutes", ulx.sroutes, "!sroutes" )
|
local sroutes = ulx.command( CATEGORY_NAME, "ulx sroutes", ulx.sroutes, "!sroutes" )
|
||||||
sroutes:addParam{ type=ULib.cmds.StringArg, hint="Signal", ULib.cmds.takeRestOfLine }
|
sroutes:addParam{ type=ULib.cmds.StringArg, hint="Signal", ULib.cmds.optional }
|
||||||
sroutes:defaultAccess( ULib.ACCESS_ALL )
|
sroutes:defaultAccess( ULib.ACCESS_ALL )
|
||||||
sroutes:help( "Print routes of next signal" )
|
sroutes:help( "Print routes of next signal" )
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user