forked from VoxeLibre/VoxeLibre
Compare commits
6 Commits
master
...
scaffoldin
Author | SHA1 | Date |
---|---|---|
cora | 728ef1060b | |
cora | f4eb3c1e19 | |
cora | 3fc53e08f7 | |
cora | 40df7b2b72 | |
cora | ab9a22d7af | |
cora | 2d8498545c |
|
@ -31,6 +31,7 @@ Please read <http://minecraft.gamepedia.com/Breaking> to learn how digging times
|
||||||
|
|
||||||
* `crush_after_fall=1`: For falling nodes. These will crush whatever they hit after falling, not dropping as an item
|
* `crush_after_fall=1`: For falling nodes. These will crush whatever they hit after falling, not dropping as an item
|
||||||
* `falling_node_damage=1`: For falling nodes. Hurts any objects it hits while falling. Damage is based on anvils
|
* `falling_node_damage=1`: For falling nodes. Hurts any objects it hits while falling. Damage is based on anvils
|
||||||
|
* `stack_falling = 1` : Stack falling nodes on top of each other even if they are not walkable.
|
||||||
* `dig_by_water=1`: Blocks with this group will drop when they are near flowing water
|
* `dig_by_water=1`: Blocks with this group will drop when they are near flowing water
|
||||||
* `destroy_by_lava_flow=1`: Blocks with this group will be destroyed by flowing lava
|
* `destroy_by_lava_flow=1`: Blocks with this group will be destroyed by flowing lava
|
||||||
* `dig_by_piston=1`: Blocks which will drop as an item when pushed by a piston. They also cannot be pulled by sticky pistons
|
* `dig_by_piston=1`: Blocks which will drop as an item when pushed by a piston. They also cannot be pulled by sticky pistons
|
||||||
|
|
|
@ -159,7 +159,8 @@ minetest.register_entity(":__builtin:falling_node", {
|
||||||
|
|
||||||
if bcn and (not bcd or bcd.walkable or
|
if bcn and (not bcd or bcd.walkable or
|
||||||
(minetest.get_item_group(self.node.name, "float") ~= 0 and
|
(minetest.get_item_group(self.node.name, "float") ~= 0 and
|
||||||
bcd.liquidtype ~= "none")) then
|
bcd.liquidtype ~= "none") or
|
||||||
|
minetest.get_item_group(self.node.name, "stack_falling") > 0 ) then
|
||||||
if bcd and bcd.leveled and
|
if bcd and bcd.leveled and
|
||||||
bcn.name == self.node.name then
|
bcn.name == self.node.name then
|
||||||
local addlevel = self.node.level
|
local addlevel = self.node.level
|
||||||
|
|
|
@ -0,0 +1,154 @@
|
||||||
|
local modname = minetest.get_current_modname()
|
||||||
|
local S = minetest.get_translator(modname)
|
||||||
|
local has_bamboo = minetest.get_modpath("mcl_bamboo")
|
||||||
|
|
||||||
|
local adjacents = {
|
||||||
|
vector.new(0,0,1),
|
||||||
|
vector.new(0,0,-1),
|
||||||
|
vector.new(1,0,0),
|
||||||
|
vector.new(-1,0,0),
|
||||||
|
}
|
||||||
|
|
||||||
|
minetest.register_node("mcl_scaffolding:scaffolding", {
|
||||||
|
description = S("Scaffolding"),
|
||||||
|
doc_items_longdesc = S("Scaffolding block..."),
|
||||||
|
doc_items_hidden = false,
|
||||||
|
tiles = {"mcl_scaffolding_scaffolding_top.png","mcl_scaffolding_scaffolding_side.png","mcl_scaffolding_scaffolding_bottom.png"},
|
||||||
|
drawtype = "nodebox",
|
||||||
|
paramtype = "light",
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.5, 0.375, -0.5, 0.5, 0.5, 0.5},
|
||||||
|
{-0.5, -0.5, -0.5, -0.375, 0.5, -0.375},
|
||||||
|
{0.375, -0.5, -0.5, 0.5, 0.5, -0.375},
|
||||||
|
{0.375, -0.5, 0.375, 0.5, 0.5, 0.5},
|
||||||
|
{-0.5, -0.5, 0.375, -0.375, 0.5, 0.5},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
buildable_to = false,
|
||||||
|
is_ground_content = false,
|
||||||
|
walkable = false,
|
||||||
|
climbable = true,
|
||||||
|
physical = true,
|
||||||
|
node_placement_prediction = "",
|
||||||
|
groups = { handy=1, axey=1, flammable=3, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=20, falling_node = 1, stack_falling = 1 },
|
||||||
|
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||||
|
_mcl_blast_resistance = 0,
|
||||||
|
_mcl_hardness = 0,
|
||||||
|
on_place = function(itemstack, placer, ptd)
|
||||||
|
-- count param2 up when placing to the sides. Fall when > 6
|
||||||
|
local ctrl = placer:get_player_control()
|
||||||
|
if ctrl and ctrl.sneak then
|
||||||
|
local pp2 = minetest.get_node(ptd.under).param2
|
||||||
|
local np2 = pp2 + 1
|
||||||
|
if minetest.get_node(vector.offset(ptd.above,0,-1,0)).name == "air" then
|
||||||
|
minetest.set_node(ptd.above,{name = "mcl_scaffolding:scaffolding_horizontal",param2 = np2})
|
||||||
|
itemstack:take_item(1)
|
||||||
|
end
|
||||||
|
if np2 > 6 then
|
||||||
|
minetest.check_single_for_falling(ptd.above)
|
||||||
|
end
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
--place on solid nodes
|
||||||
|
local node = minetest.get_node(ptd.under)
|
||||||
|
if itemstack:get_name() ~= node.name then
|
||||||
|
minetest.set_node(ptd.above,{name = "mcl_scaffolding:scaffolding",param2 = 0})
|
||||||
|
itemstack:take_item(1)
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
--build up when placing on existing scaffold
|
||||||
|
local h = 0
|
||||||
|
local pos = ptd.under
|
||||||
|
repeat
|
||||||
|
pos.y = pos.y + 1
|
||||||
|
h = h + 1
|
||||||
|
local cn = minetest.get_node(pos)
|
||||||
|
if cn.name == "air" then
|
||||||
|
minetest.set_node(pos, node)
|
||||||
|
itemstack:take_item(1)
|
||||||
|
placer:set_wielded_item(itemstack)
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
until cn.name ~= node.name or h >= 32
|
||||||
|
end,
|
||||||
|
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||||
|
repeat
|
||||||
|
minetest.set_node(pos,{name="air"})
|
||||||
|
minetest.add_item(pos,"mcl_scaffolding:scaffolding")
|
||||||
|
for _,v in pairs(adjacents) do
|
||||||
|
minetest.check_for_falling(vector.add(pos,v))
|
||||||
|
end
|
||||||
|
pos = vector.offset(pos,0,1,0)
|
||||||
|
until oldnode.name ~= minetest.get_node(pos).name
|
||||||
|
end,
|
||||||
|
_mcl_after_falling = function(pos, depth)
|
||||||
|
if minetest.get_node(pos).name == "mcl_scaffolding:scaffolding" then
|
||||||
|
minetest.set_node(pos,{name = "mcl_scaffolding:scaffolding",param2 = 0})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("mcl_scaffolding:scaffolding_horizontal", {
|
||||||
|
description = S("Scaffolding horizontal"),
|
||||||
|
doc_items_longdesc = S("Scaffolding block..."),
|
||||||
|
doc_items_hidden = false,
|
||||||
|
tiles = {"mcl_scaffolding_scaffolding_side.png","mcl_scaffolding_scaffolding_top.png","mcl_scaffolding_scaffolding_bottom.png"},
|
||||||
|
drawtype = "nodebox",
|
||||||
|
paramtype = "light",
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.5, 0.375, -0.5, 0.5, 0.5, 0.5},
|
||||||
|
{-0.5, -0.5, -0.5, -0.375, 0.5, -0.375},
|
||||||
|
{0.375, -0.5, -0.5, 0.5, 0.5, -0.375},
|
||||||
|
{0.375, -0.5, 0.375, 0.5, 0.5, 0.5},
|
||||||
|
{-0.5, -0.5, 0.375, -0.375, 0.5, 0.5},
|
||||||
|
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
groups = { handy=1, axey=1, flammable=3, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=20, not_in_creative_inventory = 1, falling_node = 1 },
|
||||||
|
_mcl_after_falling = function(pos)
|
||||||
|
if minetest.get_node(pos).name == "mcl_scaffolding:scaffolding_horizontal" then
|
||||||
|
if minetest.get_node(vector.offset(pos,0,0,0)).name ~= "mcl_scaffolding:scaffolding" then
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
minetest.add_item(pos,"mcl_scaffolding:scaffolding")
|
||||||
|
else
|
||||||
|
minetest.set_node(vector.offset(pos,0,1,0),{name = "mcl_scaffolding:scaffolding"})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
local bamboo = "mcl_core:stick"
|
||||||
|
if has_bamboo then
|
||||||
|
bamboo = "mcl_bamboo:bamboo_stem"
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "mcl_scaffolding:scaffolding 6",
|
||||||
|
recipe = {{bamboo, "mcl_mobitems:string", bamboo},
|
||||||
|
{bamboo, "", bamboo},
|
||||||
|
{bamboo, "", bamboo}}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "fuel",
|
||||||
|
recipe = "mcl_scaffolding:scaffolding",
|
||||||
|
burntime = 20
|
||||||
|
})
|
|
@ -0,0 +1,4 @@
|
||||||
|
name = mcl_scaffolding
|
||||||
|
author = cora
|
||||||
|
depends = mcl_sounds, mcl_core, mcl_mobitems
|
||||||
|
optional_depends = mcl_bamboo
|
Binary file not shown.
After Width: | Height: | Size: 316 B |
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
After Width: | Height: | Size: 343 B |
Loading…
Reference in New Issue