lbm.lua 684 B

123456789101112131415161718192021
  1. minetest.register_lbm({
  2. label = 'Sabotaged Node Reset',
  3. name = 'sabotage:node_fix',
  4. nodenames = {'group:sabotage'},
  5. run_at_every_load = true,
  6. action = function(pos, node)
  7. if minetest.get_item_group(node.name, 'sabotage') == 2 then
  8. local meta = minetest.get_meta(pos)
  9. local map_id = meta:get_string('map_id')
  10. local sabotaged = lobby.sabotage[map_id]
  11. if not sabotaged then
  12. local def = minetest.registered_nodes[node.name]
  13. local flip = def.sabotage_switch
  14. if flip then
  15. minetest.swap_node(pos, {name = flip, param2 = node.param2})
  16. end
  17. end
  18. end
  19. end
  20. })