SHARE
TWEET

fence2 reg

TumeniNodes Jul 14th, 2018 20 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function default.register_fence2(name, def)
  2.    minetest.register_craft({
  3.       output = name .. " 4",
  4.       recipe = {
  5.          { def.material, 'group:stick', def.material },
  6.          { def.material, 'group:stick', def.material },
  7.       }
  8.    })
  9.  
  10.    local fence_texture = "default_fence_overlay.png^" .. def.image ..
  11.          "^default_fence_overlay.png^[makealpha:255,126,126"
  12.    -- Allow almost everything to be overridden
  13.    local default_fields = {
  14.       paramtype = "light",
  15.       drawtype = "nodebox",
  16.       node_box = {
  17.          type = "connected",
  18.          fixed = {{-1/8, -1/2, -1/8, 1/8, 1/2, 1/8}},
  19.          -- connect_top =
  20.          -- connect_bottom =
  21.          connect_front = {{-1/16,3/16,-1/2,1/16,5/16,-1/8},
  22.             {-1/16,-5/16,-1/2,1/16,-3/16,-1/8}},
  23.          connect_left = {{-1/2,3/16,-1/16,-1/8,5/16,1/16},
  24.             {-1/2,-5/16,-1/16,-1/8,-3/16,1/16}},
  25.          connect_back = {{-1/16,3/16,1/8,1/16,5/16,1/2},
  26.             {-1/16,-5/16,1/8,1/16,-3/16,1/2}},
  27.          connect_right = {{1/8,3/16,-1/16,1/2,5/16,1/16},
  28.             {1/8,-5/16,-1/16,1/2,-3/16,1/16}},
  29.       },
  30.       connects_to = {"group:fence", "group:wood", "group:tree"},
  31.       inventory_image = def.image,
  32.       wield_image = def.image,
  33.       tiles = def.texture,
  34.       sunlight_propagates = true,
  35.       is_ground_content = false,
  36.       groups = {},
  37.    }
  38.    for k, v in pairs(default_fields) do
  39.       if not def[k] then
  40.          def[k] = v
  41.       end
  42.    end
  43.  
  44.    -- Always add to the fence group, even if no group provided
  45.    def.groups.fence = 1
  46.  
  47.    def.texture = nil
  48.    def.material = nil
  49.  
  50.    minetest.register_node(name, def)
  51. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top