mesewire.lua 958 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. local mesewire_rules =
  2. {
  3. {x = 1, y = 0, z = 0},
  4. {x =-1, y = 0, z = 0},
  5. {x = 0, y = 1, z = 0},
  6. {x = 0, y =-1, z = 0},
  7. {x = 0, y = 0, z = 1},
  8. {x = 0, y = 0, z =-1},
  9. }
  10. minetest.override_item("default:mese", {
  11. mesecons = {conductor = {
  12. state = mesecon.state.off,
  13. onstate = "mesecons_extrawires:mese_powered",
  14. rules = mesewire_rules
  15. }}
  16. })
  17. -- Copy node definition of powered mese from normal mese
  18. -- and brighten texture tiles to indicate mese is powered
  19. local powered_def = mesecon.mergetable(minetest.registered_nodes["default:mese"], {
  20. drop = "default:mese",
  21. light_source = 5,
  22. mesecons = {conductor = {
  23. state = mesecon.state.on,
  24. offstate = "default:mese",
  25. rules = mesewire_rules
  26. }},
  27. groups = {cracky = 1, not_in_creative_inventory = 1},
  28. on_blast = mesecon.on_blastnode,
  29. })
  30. for i, v in pairs(powered_def.tiles) do
  31. powered_def.tiles[i] = v .. "^[brighten"
  32. end
  33. minetest.register_node("mesecons_extrawires:mese_powered", powered_def)