mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-14 15:11:05 +01:00
Greatly simplify fence definition
This commit is contained in:
parent
a7953d526b
commit
322d2eda4c
1 changed files with 27 additions and 548 deletions
|
@ -1,80 +1,7 @@
|
|||
local init = os.clock()
|
||||
local override_original = true --change to "true" if you want original and placed fences replaced
|
||||
|
||||
local function dockable(nodename)
|
||||
if nodename == "default:wood" or string.find(nodename, "wallet:wall") or nodename == "default:brick" or nodename == "default:cobble" or nodename == "default:dirt" or nodename == "default:sandstone" or nodename == "default:stone" or string.find(nodename, "fences:fence_wood") or string.find(nodename, "fences:fencegate") then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function find_dock(pos, second)
|
||||
if pos == nil then
|
||||
return false
|
||||
end
|
||||
|
||||
local h1 = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z})
|
||||
local v1 = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z})
|
||||
local r1 = minetest.get_node({x=pos.x, y=pos.y, z=pos.z+1})
|
||||
local l1 = minetest.get_node({x=pos.x, y=pos.y, z=pos.z-1})
|
||||
local code = 0
|
||||
if dockable(l1.name) then
|
||||
code = code+1
|
||||
if second < 2 then
|
||||
minetest.punch_node({x=pos.x, y=pos.y, z=pos.z-1})
|
||||
end
|
||||
end
|
||||
if dockable(r1.name) then
|
||||
code = code+2
|
||||
if second < 2 then
|
||||
minetest.punch_node({x=pos.x, y=pos.y, z=pos.z+1})
|
||||
end
|
||||
end
|
||||
if dockable(v1.name) then
|
||||
code = code+11
|
||||
if second < 2 then
|
||||
minetest.punch_node({x=pos.x-1, y=pos.y, z=pos.z})
|
||||
end
|
||||
end
|
||||
if dockable(h1.name) then
|
||||
code = code+21
|
||||
if second < 2 then
|
||||
minetest.punch_node({x=pos.x+1, y=pos.y, z=pos.z})
|
||||
end
|
||||
end
|
||||
local me = minetest.get_node(pos)
|
||||
if code > 0 then
|
||||
local tmp_name = "fences:fence_wood_"..code
|
||||
local tmp_node = {name=tmp_name, param1=me.param1, param2=me.param2}
|
||||
if second > 0 then
|
||||
local tmp_node = {name=tmp_name, param1=me.param1, param2=me.param2}
|
||||
minetest.set_node(pos, tmp_node)
|
||||
end
|
||||
elseif code == 0 then
|
||||
if second == 2 then
|
||||
local tmp_node = {name="fences:fence_wood", param1=me.param1, param2=me.param2}
|
||||
minetest.set_node(pos, tmp_node)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local function punch(pos, puncher)
|
||||
if not puncher ~= '' then
|
||||
find_dock(pos, 2)
|
||||
elseif not puncher:is_player() then
|
||||
find_dock(pos, 2)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local p0 = {-2/16, -1/2, -2/16, 2/16, 1/2, 2/16}
|
||||
local p1 = {-2/16, 1/2, -2/16, -2/16, 1/2+8/16, -2/16}
|
||||
local p2 = {-2/16, 1/2, 2/16, -2/16, 1/2+8/16, 2/16}
|
||||
local p3 = {-2/16, 1/2, 2/16, -2/16, 1/2+8/16, 2/16}
|
||||
local p4 = {2/16, 1/2, -2/16, 2/16, 1/2+8/16, -2/16}
|
||||
local p5 = {2/16, 1/2, 2/16, 2/16, 1/2+8/16, 2/16}
|
||||
|
||||
-- Node box
|
||||
local p = {-2/16, -1/2, -2/16, 2/16, 1/2, 2/16}
|
||||
local x1 = {-2/16, 1/2-4/16, 1/16, -1/2, 1/2-1/16, -1/16} --oben(quer) -x
|
||||
local x12 = {-2/16, -1/2+6/16, 1/16, -1/2, -1/2+9/16, -1/16} --unten(quer) -x
|
||||
local x2 = {2/16, 1/2-4/16, -1/16, 1/2, 1/2-1/16, 1/16} --oben(quer) x
|
||||
|
@ -84,16 +11,12 @@ local z12 = {1/16, -1/2+6/16, -2/16, -1/16, -1/2+9/16, -1/2} --unten(quer) -z
|
|||
local z2 = {-1/16, 1/2-4/16, 2/16, 1/16, 1/2-1/16, 1/2} --oben(quer) z
|
||||
local z22 = {-1/16, -1/2+6/16, 2/16, 1/16, -1/2+9/16, 1/2} --unten(quer) z
|
||||
|
||||
local bz1 = {1/16, 1/2-1/16, -6/16, 1/16, 1/2+8/16, -6/16} --oben_block(quer) -z 1seite
|
||||
local bz11 = {-1/16, 1/2-1/16, -6/16, -1/16, 1/2+8/16, -6/16} --oben_block(quer) -z 2seite
|
||||
local bz2 = {1/16, 1/2-1/16, 5/16, 1/16, 1/2+8/16, 5/16} --oben_block(quer) z 1seite
|
||||
local bz21 = {-1/16, 1/2-1/16, 5/16, -1/16, 1/2+8/16, 5/16} --oben_block(quer) z 2seite
|
||||
|
||||
local bx1 = {-6/16, 1/2-1/16, 1/16, -6/16, 1/2+8/16, 1/16} --oben_block(quer) -x 1seite
|
||||
local bx11 = {-6/16, 1/2-1/16, -1/16, -6/16, 1/2+8/16, -1/16} --oben_block(quer) -x 2seite
|
||||
local bx2 = {5/16, 1/2-1/16, 1/16, 5/16, 1/2+8/16, 1/16} --oben_block(quer) x 1seite
|
||||
local bx21 = {5/16, 1/2-1/16, -1/16, 5/16, 1/2+8/16, -1/16} --oben_block(quer) x 2seite
|
||||
|
||||
-- Collision box
|
||||
local cp = {-2/16, -1/2, -2/16, 2/16, 1, 2/16}
|
||||
local cx1 = {-2/16, -1/2+6/16, 2/16, -1/2, 1, -2/16} --unten(quer) -x
|
||||
local cx2 = {2/16, -1/2+6/16, -2/16, 1/2, 1, 2/16} --unten(quer) x
|
||||
local cz1 = {2/16, -1/2+6/16, -2/16, -2/16, 1, -1/2} --unten(quer) -z
|
||||
local cz2 = {-2/16, -1/2+6/16, 2/16, 2/16, 1, 1/2} --unten(quer) z
|
||||
|
||||
minetest.register_node("fences:fence_wood", {
|
||||
description = "Oak Fence",
|
||||
|
@ -102,456 +25,32 @@ minetest.register_node("fences:fence_wood", {
|
|||
wield_image = "default_fence.png",
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,fences=1},
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,fence=1},
|
||||
drop = 'fences:fence_wood',
|
||||
stack_max = 64,
|
||||
sunlight_propagates = true,
|
||||
drawtype = "nodebox",
|
||||
connect_sides = { "front", "back", "left", "right" },
|
||||
connects_to = { "group:solid", "group:fence" },
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {p0,p1,p2,p3,p4,p5,}
|
||||
type = "connected",
|
||||
fixed = {p},
|
||||
connect_front = {z1,z12},
|
||||
connect_back = {z2,z22,},
|
||||
connect_left = {x1,x12},
|
||||
connect_right = {x2,x22},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-2/16, -1/2, -2/16, 2/16, 1/2, 2/16},
|
||||
collision_box = {
|
||||
type = "connected",
|
||||
fixed = {cp},
|
||||
connect_front = {cz1},
|
||||
connect_back = {cz2,},
|
||||
connect_left = {cx1},
|
||||
connect_right = {cx2},
|
||||
},
|
||||
on_construct = function(pos)
|
||||
find_dock(pos, 1)
|
||||
end,
|
||||
on_punch = function(pos, puncher)
|
||||
punch(pos, puncher)
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
find_dock(pos, -1)
|
||||
end
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
|
||||
|
||||
--different fence types- (1=left,2=right,3=top,4=bottom)
|
||||
|
||||
minetest.register_node("fences:fence_wood_1", {
|
||||
tiles = {"default_wood.png"},
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,fences=1,not_in_inventory=1},
|
||||
drop = 'fences:fence_wood',
|
||||
sunlight_propagates = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
p0,p1,p2,p3,p4,p5,
|
||||
z1,z12,
|
||||
bz1,bz11,
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-2/16, -1/2, -2/16, 2/16, 1/2, 2/16},
|
||||
},
|
||||
on_punch = function(pos, puncher)
|
||||
punch(pos, puncher)
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
find_dock(pos, -1)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("fences:fence_wood_2", {
|
||||
tiles = {"default_wood.png"},
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,fences=1,not_in_inventory=1},
|
||||
drop = 'fences:fence_wood',
|
||||
sunlight_propagates = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
p0,p1,p2,p3,p4,p5,
|
||||
z2,z22,
|
||||
bz2,bz21,
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-2/16, -1/2, -2/16, 2/16, 1/2, 2/16},
|
||||
},
|
||||
on_punch = function(pos, puncher)
|
||||
punch(pos, puncher)
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
find_dock(pos, -1)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("fences:fence_wood_3", { --left+right(3)
|
||||
tiles = {"default_wood.png"},
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,fences=1,not_in_inventory=1},
|
||||
drop = 'fences:fence_wood',
|
||||
sunlight_propagates = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
p0,p1,p2,p3,p4,p5,
|
||||
z1,z12,z2,z22,
|
||||
bz1,bz11,bz2,bz21,
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-2/16, -1/2, -2/16, 2/16, 1/2, 2/16},
|
||||
},
|
||||
on_punch = function(pos, puncher)
|
||||
punch(pos, puncher)
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
find_dock(pos, -1)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("fences:fence_wood_11", { --top
|
||||
tiles = {"default_wood.png"},
|
||||
paramtype = "light",
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,fences=1,not_in_inventory=1},
|
||||
drop = 'fences:fence_wood',
|
||||
sunlight_propagates = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
p0,p1,p2,p3,p4,p5,
|
||||
x1,x12,
|
||||
bx1,bx11,
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-2/16, -1/2, -2/16, 2/16, 1/2, 2/16},
|
||||
},
|
||||
on_punch = function(pos, puncher)
|
||||
punch(pos, puncher)
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
find_dock(pos, -1)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("fences:fence_wood_21", { --bottom
|
||||
tiles = {"default_wood.png"},
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,fences=1,not_in_inventory=1},
|
||||
drop = 'fences:fence_wood',
|
||||
sunlight_propagates = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
p0,p1,p2,p3,p4,p5,
|
||||
x2,x22,
|
||||
bx2,bx21,
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-2/16, -1/2, -2/16, 2/16, 1/2, 2/16},
|
||||
},
|
||||
on_punch = function(pos, puncher)
|
||||
punch(pos, puncher)
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
find_dock(pos, -1)
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("fences:fence_wood_32", { --top+bottom(32)
|
||||
tiles = {"default_wood.png"},
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,fences=1,not_in_inventory=1},
|
||||
drop = 'fences:fence_wood',
|
||||
sunlight_propagates = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
p0,p1,p2,p3,p4,p5,
|
||||
x1,x12,x2,x22,
|
||||
bx1,bx11,bx2,bx21,
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-2/16, -1/2, -2/16, 2/16, 1/2, 2/16},
|
||||
},
|
||||
on_punch = function(pos, puncher)
|
||||
punch(pos, puncher)
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
find_dock(pos, -1)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("fences:fence_wood_14", { --left+right(3)+ top(11) =14
|
||||
tiles = {"default_wood.png"},
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,fences=1,not_in_inventory=1},
|
||||
drop = 'fences:fence_wood',
|
||||
sunlight_propagates = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
p0,p1,p2,p3,p4,p5,
|
||||
z1,z12,z2,z22,x1,x12,
|
||||
bz1,bz11,bz2,bz21,bx1,bx11,
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-2/16, -1/2, -2/16, 2/16, 1/2, 2/16},
|
||||
},
|
||||
on_punch = function(pos, puncher)
|
||||
punch(pos, puncher)
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
find_dock(pos, -1)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("fences:fence_wood_24", { --left+right(3)+ bottom(21) =24
|
||||
tiles = {"default_wood.png"},
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,fences=1,not_in_inventory=1},
|
||||
drop = 'fences:fence_wood',
|
||||
sunlight_propagates = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
p0,p1,p2,p3,p4,p5,
|
||||
z1,z12,z2,z22,x2,x22,
|
||||
bz1,bz11,bz2,bz21,bx2,bx21,
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-2/16, -1/2, -2/16, 2/16, 1/2, 2/16},
|
||||
},
|
||||
on_punch = function(pos, puncher)
|
||||
punch(pos, puncher)
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
find_dock(pos, -1)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("fences:fence_wood_35", { --left+right(3)+top+bottom(32) = 35
|
||||
tiles = {"default_wood.png"},
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,fences=1,not_in_inventory=1},
|
||||
drop = 'fences:fence_wood',
|
||||
sunlight_propagates = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
p0,p1,p2,p3,p4,p5,
|
||||
x1,x12,x2,x22,z1,z12,z2,z22,
|
||||
bz1,bz11,bz2,bz21,bx1,bx11,bx2,bx21,
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-2/16, -1/2, -2/16, 2/16, 1/2, 2/16},
|
||||
},
|
||||
on_punch = function(pos, puncher)
|
||||
punch(pos, puncher)
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
find_dock(pos, -1)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("fences:fence_wood_12", { --left(1)+top(11)=12
|
||||
tiles = {"default_wood.png"},
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,fences=1,not_in_inventory=1},
|
||||
drop = 'fences:fence_wood',
|
||||
sunlight_propagates = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
p0,p1,p2,p3,p4,p5,
|
||||
z1,z12,x1,x12,
|
||||
bz1,bz11,bx1,bx11,
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-2/16, -1/2, -2/16, 2/16, 1/2, 2/16},
|
||||
},
|
||||
on_punch = function(pos, puncher)
|
||||
punch(pos, puncher)
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
find_dock(pos, -1)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("fences:fence_wood_22", { --left(1)+bottom(21)=22
|
||||
tiles = {"default_wood.png"},
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,fences=1,not_in_inventory=1},
|
||||
drop = 'fences:fence_wood',
|
||||
sunlight_propagates = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
p0,p1,p2,p3,p4,p5,
|
||||
z1,z12,x2,x22,
|
||||
bz1,bz11,bx2,bx21,
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-2/16, -1/2, -2/16, 2/16, 1/2, 2/16},
|
||||
},
|
||||
on_punch = function(pos, puncher)
|
||||
punch(pos, puncher)
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
find_dock(pos, -1)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("fences:fence_wood_33", { --left(1)+top+bottom(32)=33
|
||||
tiles = {"default_wood.png"},
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,fences=1,not_in_inventory=1},
|
||||
drop = 'fences:fence_wood',
|
||||
sunlight_propagates = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
p0,p1,p2,p3,p4,p5,
|
||||
z1,z12,x1,x12,x2,x22,
|
||||
bz1,bz11,bx1,bx11,bx2,bx21,
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-2/16, -1/2, -2/16, 2/16, 1/2, 2/16},
|
||||
},
|
||||
on_punch = function(pos, puncher)
|
||||
punch(pos, puncher)
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
find_dock(pos, -1)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("fences:fence_wood_34", { --right(2)+top+bottom(32)=34
|
||||
tiles = {"default_wood.png"},
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,fences=1,not_in_inventory=1},
|
||||
drop = 'fences:fence_wood',
|
||||
sunlight_propagates = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
p0,p1,p2,p3,p4,p5,
|
||||
z2,z22,x1,x12,x2,x22,
|
||||
bz2,bz21,bx1,bx11,bx2,bx21,
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-2/16, -1/2, -2/16, 2/16, 1/2, 2/16},
|
||||
},
|
||||
on_punch = function(pos, puncher)
|
||||
punch(pos, puncher)
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
find_dock(pos, -1)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("fences:fence_wood_23", { --right(2)+bottom(21)=23
|
||||
tiles = {"default_wood.png"},
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,fences=1,not_in_inventory=1},
|
||||
drop = 'fences:fence_wood',
|
||||
sunlight_propagates = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
p0,p1,p2,p3,p4,p5,
|
||||
z2,z22,x2,x22,
|
||||
bz2,bz21,bx2,bx21,
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-2/16, -1/2, -2/16, 2/16, 1/2, 2/16},
|
||||
},
|
||||
on_punch = function(pos, puncher)
|
||||
punch(pos, puncher)
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
find_dock(pos, -1)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("fences:fence_wood_13", { --right(2)+top(11)=13
|
||||
tiles = {"default_wood.png"},
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,fences=1,not_in_inventory=1},
|
||||
drop = 'fences:fence_wood',
|
||||
sunlight_propagates = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
p0,p1,p2,p3,p4,p5,
|
||||
z2,z22,x1,x12,
|
||||
bz1,bz11,bx1,bx11,
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-2/16, -1/2, -2/16, 2/16, 1/2, 2/16},
|
||||
},
|
||||
on_punch = function(pos, puncher)
|
||||
punch(pos, puncher)
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
find_dock(pos, -1)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_alias("default:fence_wood", "fences:fence")
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'fences:fence_wood 3',
|
||||
recipe = {
|
||||
|
@ -612,7 +111,7 @@ minetest.register_node("fences:fencegate_open", {
|
|||
is_ground_content = false,
|
||||
sunlight_propagates = true,
|
||||
walkable = true,
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,fences=1,not_in_inventory=1,mesecon_effector_on=1},
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,fence=1,not_in_inventory=1,mesecon_effector_on=1},
|
||||
drop = 'fences:fencegate',
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
|
@ -643,9 +142,6 @@ minetest.register_node("fences:fencegate_open", {
|
|||
punch_gate(pos, node)
|
||||
end),
|
||||
}},
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
find_dock(pos, -1)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("fences:fencegate", {
|
||||
|
@ -659,7 +155,7 @@ minetest.register_node("fences:fencegate", {
|
|||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
walkable = true,
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,mesecon_effector_on=1,fences=1},
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,mesecon_effector_on=1,fence=1},
|
||||
drop = 'fences:fencegate',
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
|
@ -688,7 +184,6 @@ minetest.register_node("fences:fencegate", {
|
|||
meta2 = minetest.get_meta(pos)
|
||||
meta2:set_int("state", 0)
|
||||
state2 = 0
|
||||
find_dock(pos, -1)
|
||||
end,
|
||||
mesecons = {effector = {
|
||||
action_on = (function(pos, node)
|
||||
|
@ -698,23 +193,7 @@ minetest.register_node("fences:fencegate", {
|
|||
on_rightclick = function(pos, node, clicker)
|
||||
punch_gate(pos, node)
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
find_dock(pos, -1)
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
if override_original == true then
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:fence_wood"},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local tmp_node3 = {name="fences:fence_wood"}
|
||||
minetest.set_node(pos, tmp_node3)
|
||||
minetest.punch_node(pos)
|
||||
end
|
||||
})
|
||||
end
|
||||
local time_to_load= os.clock() - init
|
||||
print(string.format("[MOD] "..minetest.get_current_modname().." loaded in %.4f s", time_to_load))
|
||||
|
|
Loading…
Reference in a new issue