Advertisement
TumeniNodes

lighting

Jul 8th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.92 KB | None | 0 0
  1. -- Manual Wall Lamps
  2.  
  3. minetest.register_node("lighting:wall_lamp_off", {
  4.     description = "Wall Lamp Off",
  5.     use_texture_alpha = true,
  6.     tiles = {
  7.         -- up, down, right, left, back, front
  8.         'lighting_streetlamp_top.png',
  9.         'lighting_streetlamp_top.png',
  10.         'lighting_wall_lamp_offR.png',
  11.         'lighting_wall_lamp_offL.png',
  12.         'lighting_streetlamp_off.png',
  13.         'lighting_streetlamp_off.png',
  14.     },
  15.     drawtype = "nodebox",
  16.     paramtype = "light",
  17.     paramtype2 = "facedir",
  18. --    legacy_facedir_simple = true,
  19.     sunlight_propagates = true,
  20.     groups = {snappy = 3},
  21.     sounds = default.node_sound_glass_defaults(),
  22.     node_box = {
  23.         type = "fixed",
  24.         fixed = {
  25.             {-3/16, -1/2, 1/8, 3/16, 1/8, 1/2},
  26.             {-1/16, 1/8, 5/16, 1/16, 3/16, 7/16},
  27.             {-5/16, 0, 0, 5/16, 1/16, 1/2},
  28.         },
  29.     },
  30.     selection_box = {
  31.         type = "fixed",
  32.         fixed = {-3/16, -1/2, 1/8, 3/16, 1/8, 1/2},
  33.     },
  34.     on_rightclick = function(pos, node, clicker)
  35.         node.name = "lighting:wall_lamp_on"
  36.         minetest.swap_node(pos, node)
  37.     end,
  38. })
  39.  
  40. minetest.register_node("lighting:wall_lamp_on", {
  41.     description = "Street Lamp ",
  42.     use_texture_alpha = true,
  43.     tiles = {
  44.         -- up, down, right, left, back, front
  45.         'lighting_streetlamp_top.png',
  46.         'lighting_streetlamp_top.png',
  47.         'lighting_wall_lamp_onR.png',
  48.         'lighting_wall_lamp_onL.png',
  49.         'lighting_streetlamp_on.png',
  50.         'lighting_streetlamp_on.png',
  51.     },
  52.     drawtype = "nodebox",
  53.     paramtype = "light",
  54.     paramtype2 = "facedir",
  55. --    legacy_facedir_simple = true,
  56.     sunlight_propagates = true,
  57.     light_source = 12,
  58.     groups = {not_in_creative_inventory = 1},
  59.     node_box = {
  60.         type = "fixed",
  61.         fixed = {
  62.             {-3/16, -1/2, 1/8, 3/16, 1/8, 1/2},
  63.             {-1/16, 1/8, 5/16, 1/16, 3/16, 7/16},
  64.             {-5/16, 0, 0, 5/16, 1/16, 1/2},
  65.         },
  66.     },
  67.     selection_box = {
  68.         type = "fixed",
  69.         fixed = {-3/16, -1/2, 1/8, 3/16, 1/8, 1/2},
  70.     },
  71.     on_rightclick = function(pos, node, clicker)
  72.         node.name = "lighting:wall_lamp_off"
  73.         minetest.swap_node(pos, node)
  74.     end,
  75. })
  76.  
  77. --[[    minetest.register_abm({
  78.             nodenames = {"lighting:streetlamp_off", "lighting:streetlamp_on"},
  79.             interval = 10,
  80.             chance = 1,
  81. --            catch_up = false,
  82.             action = function(pos, node)
  83.                 local tod = minetest.get_timeofday()
  84.                 if tod >= 0.2 and tod <= 0.8 then
  85.                     if node.name == "lighting:streetlamp_on" then
  86.                         minetest.swap_node(pos, {name = "lighting:streetlamp_off"})
  87.                     end
  88.                 else
  89.                     if node.name == "lighting:streetlamp_off" then
  90.                         minetest.swap_node(pos, {name = "lighting:streetlamp_on"})
  91.                     else
  92.                         minetest.add_particle({
  93.                             pos = {x=pos.x, y=pos.y-0.1, z=pos.z},
  94.                             velocity = {x=0, y=0, z=0},
  95.                             acceleration = {x=0, y=0, z=0},
  96.                             expirationtime = 11,
  97.                             size = 20,
  98.                             collisiondetection = false,
  99.                             collisionremoval = false,
  100.                             vertical = true,
  101.                             texture = "lighting_streetlamp_glow.png",
  102.                             glow = 7
  103.                         })
  104.                     end
  105.                 end
  106.             end
  107.         })]]--
  108.  
  109.  
  110.  
  111. -- Time of Day Wall Lamps
  112.  
  113. minetest.register_node("lighting:tod_wall_lamp_off", {
  114.     description = "TOD Wall Lamp Off",
  115.     use_texture_alpha = true,
  116.     tiles = {
  117.         -- up, down, right, left, back, front
  118.         'lighting_streetlamp_top.png',
  119.         'lighting_streetlamp_top.png',
  120.         'lighting_wall_lamp_offR.png',
  121.         'lighting_wall_lamp_offL.png',
  122.         'lighting_streetlamp_off.png',
  123.         'lighting_streetlamp_off.png',
  124.     },
  125.     drawtype = "nodebox",
  126.     paramtype = "light",
  127.     paramtype2 = "facedir",
  128. --    legacy_facedir_simple = true,
  129.     sunlight_propagates = true,
  130.     groups = {snappy = 3},
  131.     sounds = default.node_sound_glass_defaults(),
  132.     node_box = {
  133.         type = "fixed",
  134.         fixed = {
  135.             {-3/16, -1/2, 1/8, 3/16, 1/8, 1/2},
  136.             {-1/16, 1/8, 5/16, 1/16, 3/16, 7/16},
  137.             {-5/16, 0, 0, 5/16, 1/16, 1/2},
  138.         },
  139.     },
  140.     selection_box = {
  141.         type = "fixed",
  142.         fixed = {-3/16, -1/2, 1/8, 3/16, 1/8, 1/2},
  143.     },
  144. })
  145.  
  146. minetest.register_node("lighting:tod_wall_lamp_on", {
  147.     description = "TOD Wall Lamp ",
  148.     use_texture_alpha = true,
  149.     tiles = {
  150.         -- up, down, right, left, back, front
  151.         'lighting_streetlamp_top.png',
  152.         'lighting_streetlamp_top.png',
  153.         'lighting_wall_lamp_onR.png',
  154.         'lighting_wall_lamp_onL.png',
  155.         'lighting_streetlamp_on.png',
  156.         'lighting_streetlamp_on.png',
  157.     },
  158.     drawtype = "nodebox",
  159.     paramtype = "light",
  160.     paramtype2 = "facedir",
  161. --    legacy_facedir_simple = true,
  162.     sunlight_propagates = true,
  163.     light_source = 12,
  164.     groups = {not_in_creative_inventory = 1},
  165.     node_box = {
  166.         type = "fixed",
  167.         fixed = {
  168.             {-3/16, -1/2, 1/8, 3/16, 1/8, 1/2},
  169.             {-1/16, 1/8, 5/16, 1/16, 3/16, 7/16},
  170.             {-5/16, 0, 0, 5/16, 1/16, 1/2},
  171.         },
  172.     },
  173.     selection_box = {
  174.         type = "fixed",
  175.         fixed = {-3/16, -1/2, 1/8, 3/16, 1/8, 1/2},
  176.     },
  177. })
  178.  
  179.     minetest.register_abm({
  180.             nodenames = {"lighting:tod_wall_lamp_off", "lighting:tod_wall_lamp_on"},
  181.             interval = 10,
  182.             chance = 1,
  183. --            catch_up = false,
  184.             action = function(pos, node)
  185.                 local tod = minetest.get_timeofday()
  186.                 if tod >= 0.2 and tod <= 0.8 then
  187.                     if node.name == "lighting:tod_wall_lamp_on" then
  188.                         minetest.swap_node(pos, {name = "lighting:tod_wall_lamp_off"})
  189.                     end
  190.                 else
  191.                     if node.name == "lighting:tod_wall_lamp_off" then
  192.                         minetest.swap_node(pos, {name = "lighting:tod_wall_lamp_on"})
  193.                     else
  194.                         minetest.add_particle({
  195.                             pos = {x=pos.x, y=pos.y-0.1, z=pos.z+0.2},
  196.                             velocity = {x=0, y=0, z=0},
  197.                             acceleration = {x=0, y=0, z=0},
  198.                             expirationtime = 11,
  199.                             size = 20,
  200.                             collisiondetection = false,
  201.                             collisionremoval = false,
  202.                             vertical = true,
  203.                             texture = "lighting_streetlamp_glow.png",
  204.                             glow = 7
  205.                         })
  206.                     end
  207.                 end
  208.             end
  209.         })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement