Fix rail rules (kinda)

This commit is contained in:
Wuzzy 2018-01-22 17:33:06 +01:00
parent 01952b56fd
commit b62075afcb
1 changed files with 26 additions and 7 deletions

View File

@ -30,6 +30,26 @@ local register_rail = function(itemstring, tiles, def_extras, creative)
minetest.register_node(itemstring, ndef) minetest.register_node(itemstring, ndef)
end end
-- Redstone rules
local rail_rules_long =
{{x=-1, y= 0, z= 0, spread=true},
{x= 1, y= 0, z= 0, spread=true},
{x= 0, y=-1, z= 0, spread=true},
{x= 0, y= 1, z= 0, spread=true},
{x= 0, y= 0, z=-1, spread=true},
{x= 0, y= 0, z= 1, spread=true},
{x= 1, y= 1, z= 0},
{x= 1, y=-1, z= 0},
{x=-1, y= 1, z= 0},
{x=-1, y=-1, z= 0},
{x= 0, y= 1, z= 1},
{x= 0, y=-1, z= 1},
{x= 0, y= 1, z=-1},
{x= 0, y=-1, z=-1}}
local rail_rules_short = mesecon.rules.pplate
local railuse = "Place them on the ground to build your railway, the rails will automatically connect to each other and will turn into curves, T-junctions, crossings and slopes as needed." local railuse = "Place them on the ground to build your railway, the rails will automatically connect to each other and will turn into curves, T-junctions, crossings and slopes as needed."
-- Normal rail -- Normal rail
@ -55,7 +75,7 @@ register_rail("mcl_minecarts:golden_rail",
state = mesecon.state.off, state = mesecon.state.off,
offstate = "mcl_minecarts:golden_rail", offstate = "mcl_minecarts:golden_rail",
onstate = "mcl_minecarts:golden_rail_on", onstate = "mcl_minecarts:golden_rail_on",
rules = mesecon.rules.default, rules = rail_rules_long,
}, },
}, },
} }
@ -72,7 +92,7 @@ register_rail("mcl_minecarts:golden_rail_on",
state = mesecon.state.on, state = mesecon.state.on,
offstate = "mcl_minecarts:golden_rail", offstate = "mcl_minecarts:golden_rail",
onstate = "mcl_minecarts:golden_rail_on", onstate = "mcl_minecarts:golden_rail_on",
rules = mesecon.rules.default, rules = rail_rules_long,
}, },
}, },
drop = "mcl_minecarts:golden_rail", drop = "mcl_minecarts:golden_rail",
@ -80,7 +100,6 @@ register_rail("mcl_minecarts:golden_rail_on",
false false
) )
-- Activator rail (off) -- Activator rail (off)
register_rail("mcl_minecarts:activator_rail", register_rail("mcl_minecarts:activator_rail",
{"mcl_minecarts_rail_activator.png", "default_rail_curved.png^[colorize:#FF0000:96", "default_rail_t_junction.png^[colorize:#FF0000:96", "default_rail_crossing.png^[colorize:#FF0000:96"}, {"mcl_minecarts_rail_activator.png", "default_rail_curved.png^[colorize:#FF0000:96", "default_rail_t_junction.png^[colorize:#FF0000:96", "default_rail_crossing.png^[colorize:#FF0000:96"},
@ -93,7 +112,7 @@ register_rail("mcl_minecarts:activator_rail",
state = mesecon.state.off, state = mesecon.state.off,
offstate = "mcl_minecarts:activator_rail", offstate = "mcl_minecarts:activator_rail",
onstate = "mcl_minecarts:activator_rail_on", onstate = "mcl_minecarts:activator_rail_on",
rules = mesecon.rules.default, rules = rail_rules_long,
}, },
}, },
} }
@ -109,7 +128,7 @@ register_rail("mcl_minecarts:activator_rail_on",
state = mesecon.state.on, state = mesecon.state.on,
offstate = "mcl_minecarts:activator_rail", offstate = "mcl_minecarts:activator_rail",
onstate = "mcl_minecarts:activator_rail_on", onstate = "mcl_minecarts:activator_rail_on",
rules = mesecon.rules.default, rules = rail_rules_long,
}, },
}, },
drop = "mcl_minecarts:activator_rail", drop = "mcl_minecarts:activator_rail",
@ -127,7 +146,7 @@ register_rail("mcl_minecarts:detector_rail",
mesecons = { mesecons = {
receptor = { receptor = {
state = mesecon.state.off, state = mesecon.state.off,
rules = mesecon.rules.pplate, rules = rail_rules_short,
}, },
}, },
} }
@ -141,7 +160,7 @@ register_rail("mcl_minecarts:detector_rail_on",
mesecons = { mesecons = {
receptor = { receptor = {
state = mesecon.state.on, state = mesecon.state.on,
rules = mesecon.rules.pplate, rules = rail_rules_short,
}, },
}, },
drop = "mcl_minecarts:detector_rail", drop = "mcl_minecarts:detector_rail",