Compatibility with old pistons

This commit is contained in:
Jeija 2012-12-27 12:03:05 +01:00
parent ac0fb91139
commit d3b77b5be3
2 changed files with 16 additions and 11 deletions

@ -11,7 +11,7 @@ minetest.register_alias("mesecons:wireless_receiver", "mesecons_wireless:wireles
minetest.register_alias("mesecons:wireless_transmitter", "mesecons_wireless:wireless_transmitter_off")
minetest.register_alias("mesecons:switch", "mesecons_switch:mesecon_switch_off")
minetest.register_alias("mesecons:button", "mesecons_button:button_off")
minetest.register_alias("mesecons:piston", "mesecons_pistons:piston_normal")
minetest.register_alias("mesecons:piston", "mesecons_pistons:piston_normal_off")
minetest.register_alias("mesecons:blinky_plant", "mesecons_blinkyplant:blinky_plant_off")
minetest.register_alias("mesecons:mesecon_torch", "mesecons_torch:mesecon_torch_on")
minetest.register_alias("mesecons:torch", "mesecons_torch:mesecon_torch_on")
@ -30,3 +30,9 @@ minetest.register_alias("mesecons:solarpanel", "mesecons_solarpanel:solar_panel_
--Backwards compatibility
minetest.register_alias("mesecons:mesecon_off", "mesecons:wire_00000000_off")
minetest.register_alias("mesecons_pistons:piston_sticky", "mesecons_pistons:piston_sticky_on")
minetest.register_alias("mesecons_pistons:piston_normal", "mesecons_pistons:piston_normal_on")
minetest.register_alias("mesecons_pistons:piston_up_normal", "mesecons_pistons:piston_up_normal_on")
minetest.register_alias("mesecons_pistons:piston_down_normal", "mesecons_pistons:piston_down_normal_on")
minetest.register_alias("mesecons_pistons:piston_up_sticky", "mesecons_pistons:piston_up_sticky_on")
minetest.register_alias("mesecons_pistons:piston_down_sticky", "mesecons_pistons:piston_down_sticky_on")

@ -1,8 +1,3 @@
--
--
--
--
-- Get mesecon rules of pistons
piston_rules =
{{x=0, y=0, z=1}, --everything apart from z- (pusher side)
@ -44,8 +39,12 @@ local piston_remove_pusher = function (pos, node)
dir = piston_get_direction(pistonspec.dir, node)
local pusherpos = mesecon:addPosRule(pos, dir)
local pushername = minetest.env:get_node(pusherpos).name
if pushername == pistonspec.pusher then --make sure there actually is a pusher (for compatibility reasons mainly)
minetest.env:remove_node(pusherpos)
nodeupdate(pusherpos)
end
end
local piston_on = function (pos, node)
@ -252,7 +251,7 @@ local piston_up_on_box = {
-- Normal
local pistonspec_normal_down = {
local pistonspec_normal_up = {
offname = "mesecons_pistons:piston_up_normal_off",
onname = "mesecons_pistons:piston_up_normal_on",
dir = {x = 0, y = 1, z = 0},
@ -265,7 +264,7 @@ minetest.register_node("mesecons_pistons:piston_up_normal_off", {
groups = {cracky = 3, not_in_creative_inventory = 1},
paramtype2 = "facedir",
drop = {"mesecons_pistons:piston_normal_off"},
mesecons_piston = pistonspec_normal_down,
mesecons_piston = pistonspec_normal_up,
mesecons = {effector={
action_on = piston_on,
}}
@ -282,7 +281,7 @@ minetest.register_node("mesecons_pistons:piston_up_normal_on", {
after_dig_node = piston_remove_pusher,
node_box = piston_up_on_box,
selection_box = piston_up_on_box,
mesecons_piston = pistonspec_normal_down,
mesecons_piston = pistonspec_normal_up,
mesecons = {effector={
action_off = piston_off,
}}