Skip to content

Commit

Permalink
fix broken engine consist messages
Browse files Browse the repository at this point in the history
Distinguish between SendConsistMessage() for engines and SendConsistMessage() for signals.
  • Loading branch information
YoRyan committed Apr 23, 2021
1 parent 4cc791c commit d967cbc
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 35 deletions.
4 changes: 2 additions & 2 deletions Src/Lib/RailWorks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function P.GetRVNumber ()
return Call("GetRVNumber")
end

function P.SendConsistMessage (message, argument, direction)
function P.Engine_SendConsistMessage (message, argument, direction)
return Call("SendConsistMessage", message, tostring(argument), direction) == 1
end

Expand Down Expand Up @@ -146,7 +146,7 @@ function P.SendSignalMessage (message, argument, direction, link, index)
return Call("SendSignalMessage", message, argument, direction, link, index)
end

function P.SendConsistMessage (message, argument)
function P.Signal_SendConsistMessage (message, argument)
if argument == nil then
Call("SendConsistMessage", message)
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,4 +332,4 @@ OnCustomSignalMessage = RailWorks.wraperrors(function (message)
acses:receivemessage(message)
end)

OnConsistMessage = RailWorks.SendConsistMessage
OnConsistMessage = RailWorks.Engine_SendConsistMessage
Original file line number Diff line number Diff line change
Expand Up @@ -307,4 +307,4 @@ OnCustomSignalMessage = RailWorks.wraperrors(function (message)
acses:receivemessage(message)
end)

OnConsistMessage = RailWorks.SendConsistMessage
OnConsistMessage = RailWorks.Engine_SendConsistMessage
Original file line number Diff line number Diff line change
Expand Up @@ -312,4 +312,4 @@ OnCustomSignalMessage = RailWorks.wraperrors(function (message)
acses:receivemessage(message)
end)

OnConsistMessage = RailWorks.SendConsistMessage
OnConsistMessage = RailWorks.Engine_SendConsistMessage
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,10 @@ local function setplayerpantos ()
local rearup = pantoup and pantosel > 0.5
frontpantoanim:setanimatedstate(frontup)
rearpantoanim:setanimatedstate(rearup)
RailWorks.SendConsistMessage(messageid.raisefrontpanto, frontup, 0)
RailWorks.SendConsistMessage(messageid.raisefrontpanto, frontup, 1)
RailWorks.SendConsistMessage(messageid.raiserearpanto, rearup, 0)
RailWorks.SendConsistMessage(messageid.raiserearpanto, rearup, 1)
RailWorks.Engine_SendConsistMessage(messageid.raisefrontpanto, frontup, 0)
RailWorks.Engine_SendConsistMessage(messageid.raisefrontpanto, frontup, 1)
RailWorks.Engine_SendConsistMessage(messageid.raiserearpanto, rearup, 0)
RailWorks.Engine_SendConsistMessage(messageid.raiserearpanto, rearup, 1)

local frontcontact = frontpantoanim:getposition() == 1
local rearcontact = rearpantoanim:getposition() == 1
Expand All @@ -244,10 +244,10 @@ local function setaipantos ()
local rearup = false
frontpantoanim:setanimatedstate(frontup)
rearpantoanim:setanimatedstate(rearup)
RailWorks.SendConsistMessage(messageid.raisefrontpanto, frontup, 0)
RailWorks.SendConsistMessage(messageid.raisefrontpanto, frontup, 1)
RailWorks.SendConsistMessage(messageid.raiserearpanto, rearup, 0)
RailWorks.SendConsistMessage(messageid.raiserearpanto, rearup, 1)
RailWorks.Engine_SendConsistMessage(messageid.raisefrontpanto, frontup, 0)
RailWorks.Engine_SendConsistMessage(messageid.raisefrontpanto, frontup, 1)
RailWorks.Engine_SendConsistMessage(messageid.raiserearpanto, rearup, 0)
RailWorks.Engine_SendConsistMessage(messageid.raiserearpanto, rearup, 1)
end

local function setslavepantos ()
Expand Down Expand Up @@ -507,5 +507,5 @@ OnConsistMessage = RailWorks.wraperrors(function (message, argument, direction)
elseif message == messageid.raiserearpanto then
state.raiserearpantomsg = argument == "true"
end
RailWorks.SendConsistMessage(message, argument, direction)
RailWorks.Engine_SendConsistMessage(message, argument, direction)
end)
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,10 @@ local function setplayerpantos ()
local rearup = pantoup and pantosel > 0.5
frontpantoanim:setanimatedstate(frontup)
rearpantoanim:setanimatedstate(rearup)
RailWorks.SendConsistMessage(messageid.raisefrontpanto, frontup, 0)
RailWorks.SendConsistMessage(messageid.raisefrontpanto, frontup, 1)
RailWorks.SendConsistMessage(messageid.raiserearpanto, rearup, 0)
RailWorks.SendConsistMessage(messageid.raiserearpanto, rearup, 1)
RailWorks.Engine_SendConsistMessage(messageid.raisefrontpanto, frontup, 0)
RailWorks.Engine_SendConsistMessage(messageid.raisefrontpanto, frontup, 1)
RailWorks.Engine_SendConsistMessage(messageid.raiserearpanto, rearup, 0)
RailWorks.Engine_SendConsistMessage(messageid.raiserearpanto, rearup, 1)

local frontcontact = frontpantoanim:getposition() == 1
local rearcontact = rearpantoanim:getposition() == 1
Expand All @@ -304,10 +304,10 @@ local function setaipantos ()
local rearup = false
frontpantoanim:setanimatedstate(frontup)
rearpantoanim:setanimatedstate(rearup)
RailWorks.SendConsistMessage(messageid.raisefrontpanto, frontup, 0)
RailWorks.SendConsistMessage(messageid.raisefrontpanto, frontup, 1)
RailWorks.SendConsistMessage(messageid.raiserearpanto, rearup, 0)
RailWorks.SendConsistMessage(messageid.raiserearpanto, rearup, 1)
RailWorks.Engine_SendConsistMessage(messageid.raisefrontpanto, frontup, 0)
RailWorks.Engine_SendConsistMessage(messageid.raisefrontpanto, frontup, 1)
RailWorks.Engine_SendConsistMessage(messageid.raiserearpanto, rearup, 0)
RailWorks.Engine_SendConsistMessage(messageid.raiserearpanto, rearup, 1)
end

local function setslavepantos ()
Expand Down Expand Up @@ -336,8 +336,8 @@ end

local function settilt ()
local isolate = RailWorks.GetControlValue("TiltIsolate", 0)
RailWorks.SendConsistMessage(messageid.tiltisolate, isolate, 0)
RailWorks.SendConsistMessage(messageid.tiltisolate, isolate, 1)
RailWorks.Engine_SendConsistMessage(messageid.tiltisolate, isolate, 0)
RailWorks.Engine_SendConsistMessage(messageid.tiltisolate, isolate, 1)
end

local function setcone ()
Expand All @@ -357,18 +357,18 @@ do
end

if RailWorks.GetControlValue("DestOnOff", 0) == 1 then
RailWorks.SendConsistMessage(messageid.destination, id, 0)
RailWorks.SendConsistMessage(messageid.destination, id, 1)
RailWorks.Engine_SendConsistMessage(messageid.destination, id, 0)
RailWorks.Engine_SendConsistMessage(messageid.destination, id, 1)
else
RailWorks.SendConsistMessage(messageid.destination, 0, 0)
RailWorks.SendConsistMessage(messageid.destination, 0, 1)
RailWorks.Engine_SendConsistMessage(messageid.destination, 0, 0)
RailWorks.Engine_SendConsistMessage(messageid.destination, 0, 1)
end
end
end

local function setaidest ()
RailWorks.SendConsistMessage(messageid.destination, 1, 0)
RailWorks.SendConsistMessage(messageid.destination, 1, 1)
RailWorks.Engine_SendConsistMessage(messageid.destination, 1, 0)
RailWorks.Engine_SendConsistMessage(messageid.destination, 1, 1)
end

local function setstatusscreen ()
Expand Down Expand Up @@ -602,5 +602,5 @@ OnConsistMessage = RailWorks.wraperrors(function (message, argument, direction)
elseif message == messageid.raiserearpanto then
state.raisefrontpantomsg = argument == "true"
end
RailWorks.SendConsistMessage(message, argument, direction)
RailWorks.Engine_SendConsistMessage(message, argument, direction)
end)
Original file line number Diff line number Diff line change
Expand Up @@ -273,4 +273,4 @@ OnCustomSignalMessage = RailWorks.wraperrors(function (message)
acses:receivemessage(message)
end)

OnConsistMessage = RailWorks.SendConsistMessage
OnConsistMessage = RailWorks.Engine_SendConsistMessage
Original file line number Diff line number Diff line change
Expand Up @@ -486,4 +486,4 @@ OnCustomSignalMessage = RailWorks.wraperrors(function (message)
acses:receivemessage(message)
end)

OnConsistMessage = RailWorks.SendConsistMessage
OnConsistMessage = RailWorks.Engine_SendConsistMessage
Original file line number Diff line number Diff line change
Expand Up @@ -252,4 +252,4 @@ OnCustomSignalMessage = RailWorks.wraperrors(function (message)
acses:receivemessage(message)
end)

OnConsistMessage = RailWorks.SendConsistMessage
OnConsistMessage = RailWorks.Engine_SendConsistMessage
Original file line number Diff line number Diff line change
Expand Up @@ -367,4 +367,4 @@ OnCustomSignalMessage = RailWorks.wraperrors(function (message)
acses:receivemessage(message)
end)

OnConsistMessage = RailWorks.SendConsistMessage
OnConsistMessage = RailWorks.Engine_SendConsistMessage

0 comments on commit d967cbc

Please sign in to comment.