diff options
Diffstat (limited to 'mesecons/legacy.lua')
-rw-r--r-- | mesecons/legacy.lua | 62 |
1 files changed, 30 insertions, 32 deletions
diff --git a/mesecons/legacy.lua b/mesecons/legacy.lua index 119fa24..6d8ccca 100644 --- a/mesecons/legacy.lua +++ b/mesecons/legacy.lua @@ -1,32 +1,30 @@ -local rules = {
- a = {x = -1, y = 0, z = 0, name="A"},
- b = {x = 0, y = 0, z = 1, name="B"},
- c = {x = 1, y = 0, z = 0, name="C"},
- d = {x = 0, y = 0, z = -1, name="D"},
-}
-
-function mesecon.legacy_update_ports(pos)
- local meta = minetest.get_meta(pos)
- local ports = {
- a = mesecon:is_power_on(mesecon:addPosRule(pos, rules.a),
- mesecon:invertRule(rules.a)) and
- mesecon:rules_link(mesecon:addPosRule(pos, rules.a), pos),
- b = mesecon:is_power_on(mesecon:addPosRule(pos, rules.b),
- mesecon:invertRule(rules.b)) and
- mesecon:rules_link(mesecon:addPosRule(pos, rules.b), pos),
- c = mesecon:is_power_on(mesecon:addPosRule(pos, rules.c),
- mesecon:invertRule(rules.c)) and
- mesecon:rules_link(mesecon:addPosRule(pos, rules.c), pos),
- d = mesecon:is_power_on(mesecon:addPosRule(pos, rules.d),
- mesecon:invertRule(rules.d)) and
- mesecon:rules_link(mesecon:addPosRule(pos, rules.d), pos),
- }
- local n =
- (ports.a and 1 or 0) +
- (ports.b and 2 or 0) +
- (ports.c and 4 or 0) +
- (ports.d and 8 or 0) + 1
- meta:set_int("real_portstates", n)
- return ports
-end
-
+-- Ugly hack to prevent breaking compatibility with other mods +-- 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 + +function mesecon.receptor_off(self, 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 + |