Guest User

Untitled

a guest
Jul 19th, 2012
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.01 KB | None | 0 0
  1. -- HYDRO_TURBINE
  2.  
  3. minetest.register_node("mesecons_hydroturbine:hydro_turbine_off", {
  4.     drawtype = "nodebox",
  5.     tile_images = {"jeija_hydro_turbine_off.png", "jeija_hydro_turbine_off.png", "jeija_hydro_turbine_off.png", "jeija_hydro_turbine_off.png", "jeija_hydro_turbine_off.png", "jeija_hydro_turbine_off.png"},
  6.     groups = {dig_immediate=2},
  7.         description="Water Turbine",
  8.     paramtype = "light",
  9.     selection_box = {
  10.         type = "fixed",
  11.         fixed = {{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
  12.             {-0.15, 0.5, -0.15, 0.15, 1.45, 0.15},
  13.             {-0.45, 1.15, -0.1, 0.45, 1.45, 0.1},
  14.             {-0.1, 1.15, -0.45, 0.1, 1.45, 0.45}},
  15.     },
  16.     node_box = {
  17.         type = "fixed",
  18.         fixed = {{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
  19.             {-0.15, 0.5, -0.15, 0.15, 1.45, 0.15},
  20.             {-0.45, 1.15, -0.1, 0.45, 1.45, 0.1},
  21.             {-0.1, 1.15, -0.45, 0.1, 1.45, 0.45}},
  22.     },
  23. })
  24.  
  25. minetest.register_node("mesecons_hydroturbine:hydro_turbine_on", {
  26.     drawtype = "nodebox",
  27.     tile_images = {"jeija_hydro_turbine_on.png", "jeija_hydro_turbine_on.png", "jeija_hydro_turbine_on.png", "jeija_hydro_turbine_on.png", "jeija_hydro_turbine_on.png", "jeija_hydro_turbine_on.png"},
  28.     drop = '"mesecons_hydroturbine:hydro_turbine_off" 1',
  29.     groups = {dig_immediate=2},
  30.         description="Water Turbine",
  31.     paramtype = "light",
  32.     selection_box = {
  33.         type = "fixed",
  34.         fixed = {{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
  35.             {-0.15, 0.5, -0.15, 0.15, 1.45, 0.15},
  36.             {-0.5, 1.15, -0.1, 0.5, 1.45, 0.1},
  37.             {-0.1, 1.15, -0.5, 0.1, 1.45, 0.5}},
  38.     },
  39.     node_box = {
  40.         type = "fixed",
  41.         fixed = {{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
  42.             {-0.15, 0.5, -0.15, 0.15, 1.45, 0.15},
  43.             {-0.5, 1.15, -0.1, 0.5, 1.45, 0.1},
  44.             {-0.1, 1.15, -0.5, 0.1, 1.45, 0.5}},
  45.     },
  46. })
  47.  
  48.  
  49. minetest.register_abm({
  50. nodenames = {"mesecons_hydroturbine:hydro_turbine_off"},
  51.     interval = 1,
  52.     chance = 1,
  53.     action = function(pos, node, active_object_count, active_object_count_wider)
  54.         local waterpos={x=pos.x, y=pos.y+1, z=pos.z}
  55.         if minetest.env:get_node(waterpos).name=="default:water_flowing" then
  56.             --minetest.env:remove_node(pos)
  57.             minetest.env:add_node(pos, {name="mesecons_hydroturbine:hydro_turbine_on"})
  58.             nodeupdate(pos)
  59.             mesecon:receptor_on(pos)
  60.         end
  61.     end,
  62. })
  63.  
  64. minetest.register_abm({
  65. nodenames = {"mesecons_hydroturbine:hydro_turbine_on"},
  66.     interval = 1,
  67.     chance = 1,
  68.     action = function(pos, node, active_object_count, active_object_count_wider)
  69.         local waterpos={x=pos.x, y=pos.y+1, z=pos.z}
  70.         if minetest.env:get_node(waterpos).name~="default:water_flowing" then
  71.             --minetest.env:remove_node(pos)
  72.             minetest.env:add_node(pos, {name="mesecons_hydroturbine:hydro_turbine_off"})
  73.             nodeupdate(pos)
  74.             mesecon:receptor_off(pos)
  75.         end
  76.     end,
  77. })
  78.  
  79. mesecon:add_receptor_node("mesecons_hydroturbine:hydro_turbine_on")
  80. mesecon:add_receptor_node_off("mesecons_hydroturbine:hydro_turbine_off")
  81.  
  82. minetest.register_craft({
  83.     output = '"mesecons_hydroturbine:hydro_turbine_off" 2',
  84.     recipe = {
  85.     {'','"default:stick"', ''},
  86.     {'"default:stick"', '"default:steel_ingot"', '"default:stick"'},
  87.     {'','"default:stick"', ''},
  88.     }
  89. })
Advertisement
Add Comment
Please, Sign In to add comment