diff options
author | orwell96 <orwell@bleipb.de> | 2017-12-18 21:44:36 +0100 |
---|---|---|
committer | orwell96 <orwell@bleipb.de> | 2017-12-18 23:09:23 +0100 |
commit | 46c4447da089146c662f217bf3269d78d4c462c2 (patch) | |
tree | e846a588b6ddfb03c456b0c3c4d0653cd3402b85 /advtrains/signals.lua | |
parent | faa60e2bd4d35054f23fda68c06a601f2a197257 (diff) | |
download | advtrains-46c4447da089146c662f217bf3269d78d4c462c2.tar.gz advtrains-46c4447da089146c662f217bf3269d78d4c462c2.tar.bz2 advtrains-46c4447da089146c662f217bf3269d78d4c462c2.zip |
Rewrite rail connection system...
...to support an arbitrary number of connections for rails, which leads to these new features:
- switches now get recognized by the trackworker correctly
- ability to add real rail crosses
During this, I also rewrote the rail registering system and the conway function (important part of path prediction)
Note, developers: the track preset format changed, you might need to rewrite them according to the presets in tracks.lua if you wrote your own
(possibly breaks advcarts)
Diffstat (limited to 'advtrains/signals.lua')
-rw-r--r-- | advtrains/signals.lua | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/advtrains/signals.lua b/advtrains/signals.lua index a42f5e7..b01314e 100644 --- a/advtrains/signals.lua +++ b/advtrains/signals.lua @@ -37,12 +37,12 @@ for r,f in pairs({on={as="off", ls="green", als="red"}, off={as="on", ls="red", mesecons = {effector = { rules=advtrains.meseconrules, ["action_"..f.as] = function (pos, node) - advtrains.ndb.swap_node(pos, {name = "advtrains:retrosignal_"..f.as..rotation, param2 = node.param2}) + advtrains.ndb.swap_node(pos, {name = "advtrains:retrosignal_"..f.as..rotation, param2 = node.param2}, true) end }}, on_rightclick=function(pos, node, player) if minetest.check_player_privs(player:get_player_name(), {train_operator=true}) then - advtrains.ndb.swap_node(pos, {name = "advtrains:retrosignal_"..f.as..rotation, param2 = node.param2}) + advtrains.ndb.swap_node(pos, {name = "advtrains:retrosignal_"..f.as..rotation, param2 = node.param2}, true) end end, }) @@ -72,20 +72,20 @@ for r,f in pairs({on={as="off", ls="green", als="red"}, off={as="on", ls="red", mesecons = {effector = { rules=advtrains.meseconrules, ["action_"..f.as] = function (pos, node) - advtrains.ndb.swap_node(pos, {name = "advtrains:signal_"..f.as..rotation, param2 = node.param2}) + advtrains.ndb.swap_node(pos, {name = "advtrains:signal_"..f.as..rotation, param2 = node.param2}, true) end }}, luaautomation = { getstate = f.ls, setstate = function(pos, node, newstate) if newstate == f.als then - advtrains.ndb.swap_node(pos, {name = "advtrains:signal_"..f.as..rotation, param2 = node.param2}) + advtrains.ndb.swap_node(pos, {name = "advtrains:signal_"..f.as..rotation, param2 = node.param2}, true) end end, }, on_rightclick=function(pos, node, player) if minetest.check_player_privs(player:get_player_name(), {train_operator=true}) then - advtrains.ndb.swap_node(pos, {name = "advtrains:signal_"..f.as..rotation, param2 = node.param2}) + advtrains.ndb.swap_node(pos, {name = "advtrains:signal_"..f.as..rotation, param2 = node.param2}, true) end end, }) @@ -121,20 +121,20 @@ for r,f in pairs({on={as="off", ls="green", als="red"}, off={as="on", ls="red", mesecons = {effector = { rules = mrules_wallsignal, ["action_"..f.as] = function (pos, node) - advtrains.ndb.swap_node(pos, {name = "advtrains:signal_wall_"..loc.."_"..f.as, param2 = node.param2}) + advtrains.ndb.swap_node(pos, {name = "advtrains:signal_wall_"..loc.."_"..f.as, param2 = node.param2}, true) end }}, luaautomation = { getstate = f.ls, setstate = function(pos, node, newstate) if newstate == f.als then - advtrains.ndb.swap_node(pos, {name = "advtrains:signal_wall_"..loc.."_"..f.as, param2 = node.param2}) + advtrains.ndb.swap_node(pos, {name = "advtrains:signal_wall_"..loc.."_"..f.as, param2 = node.param2}, true) end end, }, on_rightclick=function(pos, node, player) if minetest.check_player_privs(player:get_player_name(), {train_operator=true}) then - advtrains.ndb.swap_node(pos, {name = "advtrains:signal_wall_"..loc.."_"..f.as, param2 = node.param2}) + advtrains.ndb.swap_node(pos, {name = "advtrains:signal_wall_"..loc.."_"..f.as, param2 = node.param2}, true) end end, }) @@ -167,20 +167,20 @@ minetest.register_node("advtrains:across_off", { mesecons = {effector = { rules = advtrains.meseconrules, action_on = function (pos, node) - advtrains.ndb.swap_node(pos, {name = "advtrains:across_on", param2 = node.param2}) + advtrains.ndb.swap_node(pos, {name = "advtrains:across_on", param2 = node.param2}, true) end }}, luaautomation = { getstate = "off", setstate = function(pos, node, newstate) if newstate == "on" then - advtrains.ndb.swap_node(pos, {name = "advtrains:across_on", param2 = node.param2}) + advtrains.ndb.swap_node(pos, {name = "advtrains:across_on", param2 = node.param2}, true) end end, }, on_rightclick=function(pos, node, player) if minetest.check_player_privs(player:get_player_name(), {train_operator=true}) then - advtrains.ndb.swap_node(pos, {name = "advtrains:across_on", param2 = node.param2}) + advtrains.ndb.swap_node(pos, {name = "advtrains:across_on", param2 = node.param2}, true) end end, }) @@ -208,20 +208,20 @@ minetest.register_node("advtrains:across_on", { mesecons = {effector = { rules = advtrains.meseconrules, action_off = function (pos, node) - advtrains.ndb.swap_node(pos, {name = "advtrains:across_off", param2 = node.param2}) + advtrains.ndb.swap_node(pos, {name = "advtrains:across_off", param2 = node.param2}, true) end }}, luaautomation = { getstate = "on", setstate = function(pos, node, newstate) if newstate == "off" then - advtrains.ndb.swap_node(pos, {name = "advtrains:across_off", param2 = node.param2}) + advtrains.ndb.swap_node(pos, {name = "advtrains:across_off", param2 = node.param2}, true) end end, }, on_rightclick=function(pos, node, player) if minetest.check_player_privs(player:get_player_name(), {train_operator=true}) then - advtrains.ndb.swap_node(pos, {name = "advtrains:across_off", param2 = node.param2}) + advtrains.ndb.swap_node(pos, {name = "advtrains:across_off", param2 = node.param2}, true) end end, }) |