mirror of
https://github.com/minetest-mods/mesecons.git
synced 2024-12-25 09:50:19 +01:00
Fix compatibility with not yet updated mods that use mesecon:receptor_*
This commit is contained in:
parent
d19e975955
commit
a550323fea
@ -66,11 +66,6 @@ dofile(minetest.get_modpath("mesecons").."/actionqueue.lua");
|
|||||||
-- like calling action_on/off/change
|
-- like calling action_on/off/change
|
||||||
dofile(minetest.get_modpath("mesecons").."/internal.lua");
|
dofile(minetest.get_modpath("mesecons").."/internal.lua");
|
||||||
|
|
||||||
-- Deprecated stuff
|
|
||||||
-- To be removed in future releases
|
|
||||||
-- Currently there is nothing here
|
|
||||||
dofile(minetest.get_modpath("mesecons").."/legacy.lua");
|
|
||||||
|
|
||||||
-- API
|
-- API
|
||||||
-- these are the only functions you need to remember
|
-- these are the only functions you need to remember
|
||||||
|
|
||||||
@ -133,6 +128,10 @@ end
|
|||||||
|
|
||||||
print("[OK] Mesecons")
|
print("[OK] Mesecons")
|
||||||
|
|
||||||
|
-- Deprecated stuff
|
||||||
|
-- To be removed in future releases
|
||||||
|
dofile(minetest.get_modpath("mesecons").."/legacy.lua");
|
||||||
|
|
||||||
--The actual wires
|
--The actual wires
|
||||||
dofile(minetest.get_modpath("mesecons").."/wires.lua");
|
dofile(minetest.get_modpath("mesecons").."/wires.lua");
|
||||||
|
|
||||||
|
@ -1,7 +1,29 @@
|
|||||||
function mesecon:receptor_on(pos, rules)
|
-- Ugly hack to prevent breaking compatibility with other mods
|
||||||
mesecon.receptor_on(pos, rules)
|
-- Just remove the following two functions to delete the hack, to be done when other mods have updated
|
||||||
|
function mesecon.receptor_on(self, pos, rules)
|
||||||
|
if (self.receptor_on) then
|
||||||
|
print("[Mesecons] Warning: A mod with mesecon support called mesecon:receptor_on.")
|
||||||
|
print("[Mesecons] If you are the programmer of this mod, please update it ")
|
||||||
|
print("[Mesecons] to use mesecon.receptor_on instead. mesecon:* is deprecated")
|
||||||
|
print("[Mesecons] Otherwise, please make sure you're running the latest version")
|
||||||
|
print("[Mesecons] of that mod and inform the mod creator.")
|
||||||
|
else
|
||||||
|
rules = pos
|
||||||
|
pos = self
|
||||||
|
end
|
||||||
|
mesecon.queue:add_action(pos, "receptor_on", {rules}, nil, rules)
|
||||||
end
|
end
|
||||||
|
|
||||||
function mesecon:receptor_off(pos, rules)
|
function mesecon.receptor_off(self, pos, rules)
|
||||||
mesecon.receptor_off(pos, rules)
|
if (self.receptor_off) then
|
||||||
|
print("[Mesecons] Warning: A mod with mesecon support called mesecon:receptor_off.")
|
||||||
|
print("[Mesecons] If you are the programmer of this mod, please update it ")
|
||||||
|
print("[Mesecons] to use mesecon.receptor_off instead. mesecon:* is deprecated")
|
||||||
|
print("[Mesecons] Otherwise, please make sure you're running the latest version")
|
||||||
|
print("[Mesecons] of that mod and inform the mod creator.")
|
||||||
|
else
|
||||||
|
rules = pos
|
||||||
|
pos = self
|
||||||
|
end
|
||||||
|
mesecon.queue:add_action(pos, "receptor_off", {rules}, nil, rules)
|
||||||
end
|
end
|
||||||
|
@ -11,7 +11,7 @@ minetest.register_node("mesecons_switch:mesecon_switch_off", {
|
|||||||
}},
|
}},
|
||||||
on_punch = function(pos, node)
|
on_punch = function(pos, node)
|
||||||
minetest.swap_node(pos, {name = "mesecons_switch:mesecon_switch_on", param2 = node.param2})
|
minetest.swap_node(pos, {name = "mesecons_switch:mesecon_switch_on", param2 = node.param2})
|
||||||
mesecon.receptor_on(pos)
|
mesecon:receptor_on(pos)
|
||||||
minetest.sound_play("mesecons_switch", {pos=pos})
|
minetest.sound_play("mesecons_switch", {pos=pos})
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
@ -27,7 +27,7 @@ minetest.register_node("mesecons_switch:mesecon_switch_on", {
|
|||||||
}},
|
}},
|
||||||
on_punch = function(pos, node)
|
on_punch = function(pos, node)
|
||||||
minetest.swap_node(pos, {name = "mesecons_switch:mesecon_switch_off", param2 = node.param2})
|
minetest.swap_node(pos, {name = "mesecons_switch:mesecon_switch_off", param2 = node.param2})
|
||||||
mesecon.receptor_off(pos)
|
mesecon:receptor_off(pos)
|
||||||
minetest.sound_play("mesecons_switch", {pos=pos})
|
minetest.sound_play("mesecons_switch", {pos=pos})
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user