Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.18 KB | None | 0 0
  1.     minetest.register_node("scifi_nodes:switch_off", {
  2.         description = "Wall switch",
  3.         tiles = {
  4.             "scifi_nodes_switch_off.png",
  5.         },
  6.         inventory_image = "scifi_nodes_switch_on.png",
  7.         wield_image = "scifi_nodes_switch_on.png",
  8.         drawtype = "signlike",
  9.         sunlight_propagates = true,
  10.         node_box = {
  11.             type = "wallmounted",
  12.             },
  13.         selection_box = {
  14.             type = "wallmounted",
  15.         },
  16.         paramtype = "light",
  17.         paramtype2 = "wallmounted",
  18.         groups = {cracky=1, oddly_breakable_by_hand=1, mesecon_needs_receiver = 1},
  19.         on_rightclick = function(pos, node, clicker, item, _)
  20.                 minetest.sound_play("scifi_nodes_digicode", {max_hear_distance = 8, pos = pos, gain = 1.0})
  21.                 minetest.swap_node(pos, {name="scifi_nodes:switch_on", param2=node.param2})
  22.                 minetest.get_node_timer(pos):start(3)
  23.         end,
  24.         sounds = default.node_sound_glass_defaults(),
  25.         mesecons = {
  26.             receptor = {
  27.                 state = mesecon.state.off,
  28.                 rules = {
  29.                     {x=1, y=-1, z=0},
  30.                     {x=-1, y=-1, z=0},
  31.                     {x=0, y=-1, z=1},
  32.                     {x=0, y=-1, z=-1}
  33.                 }
  34.             }
  35.         },
  36.     })
  37.  
  38.     minetest.register_node("scifi_nodes:switch_on", {
  39.         description = "Wall switch",
  40.         sunlight_propagates = true,
  41.         tiles = {
  42.             "scifi_nodes_switch_on.png",
  43.         },
  44.         inventory_image = "scifi_nodes_switch_on.png",
  45.         wield_image = "scifi_nodes_switch_on.png",
  46.         drawtype = "signlike",
  47.         node_box = {
  48.             type = "wallmounted",
  49.         },
  50.         selection_box = {
  51.             type = "wallmounted",
  52.         },
  53.         paramtype = "light",
  54.         paramtype2 = "wallmounted",
  55.         light_source = 5,
  56.         groups = {cracky=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1, mesecon_needs_receiver = 1},
  57.         on_rightclick = function(pos, node, clicker, item, _)
  58.             minetest.swap_node(pos, {name="scifi_nodes:switch_off", param2=node.param2})
  59.             mesecon.receptor_off(pos)
  60.         end,
  61.         on_timer = function(pos, node, clicker, item, _)
  62.             minetest.swap_node(pos, {name="scifi_nodes:switch_off", param2=node.param2})
  63.             mesecon.receptor_off(pos)
  64.         end,
  65.         sounds = default.node_sound_glass_defaults(),
  66.         mesecons = {
  67.             receptor = {
  68.                 state = mesecon.state.on,
  69.                 rules = {
  70.                     {x=1, y=-1, z=0},
  71.                     {x=-1, y=-1, z=0},
  72.                     {x=0, y=-1, z=1},
  73.                     {x=0, y=-1, z=-1}
  74.                 }
  75.             }
  76.         },
  77.     })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement