Use old chests in ruins and drop their stuff
parent
7550a15d4a
commit
c882e3dc04
|
@ -87,45 +87,24 @@ end
|
|||
-- Legacy
|
||||
--
|
||||
|
||||
function default.spawn_falling_node(p, nodename)
|
||||
spawn_falling_node(p, nodename)
|
||||
end
|
||||
|
||||
-- Horrible crap to support old code
|
||||
-- Don't use this and never do what this does, it's completely wrong!
|
||||
-- (More specifically, the client and the C++ code doesn't get the group)
|
||||
function default.register_falling_node(nodename, texture)
|
||||
minetest.log("error", debug.traceback())
|
||||
minetest.log('error', "WARNING: default.register_falling_node is deprecated")
|
||||
if minetest.registered_nodes[nodename] then
|
||||
minetest.registered_nodes[nodename].groups.falling_node = 1
|
||||
function default.drop_node_inventory()
|
||||
return function(pos, oldnode, oldmetadata, digger)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:from_table(oldmetadata)
|
||||
local inv = meta:get_inventory()
|
||||
for i = 1, inv:get_size("main") do
|
||||
local stack = inv:get_stack("main", i)
|
||||
if not stack:is_empty() then
|
||||
local p = { x = pos.x + math.random(0, 5)/5 - 0.5,
|
||||
y = pos.y,
|
||||
z = pos.z + math.random(0, 5)/5 - 0.5
|
||||
}
|
||||
minetest.add_item(p, stack)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--
|
||||
-- Global callbacks
|
||||
--
|
||||
|
||||
-- Global environment step function
|
||||
function on_step(dtime)
|
||||
-- print("on_step")
|
||||
end
|
||||
minetest.register_globalstep(on_step)
|
||||
|
||||
function on_placenode(p, node)
|
||||
--print("on_placenode")
|
||||
end
|
||||
minetest.register_on_placenode(on_placenode)
|
||||
|
||||
function on_dignode(p, node)
|
||||
--print("on_dignode")
|
||||
end
|
||||
minetest.register_on_dignode(on_dignode)
|
||||
|
||||
function on_punchnode(p, node)
|
||||
end
|
||||
minetest.register_on_punchnode(on_punchnode)
|
||||
|
||||
--
|
||||
-- Grow trees
|
||||
--
|
||||
|
|
|
@ -9,23 +9,40 @@ local chest_stuff = {
|
|||
|
||||
}
|
||||
|
||||
local frm = default.chest_formspec
|
||||
minetest.register_node("ruins:chest", {
|
||||
description = "Old Chest",
|
||||
tiles = {"ruins_chest_top.png", "ruins_chest_top.png", "ruins_chest_side.png",
|
||||
"ruins_chest_side.png", "ruins_chest_side.png", "ruins_chest_front.png"},
|
||||
paramtype2 = "facedir",
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2},
|
||||
legacy_facedir_simple = true,
|
||||
sounds = default.node_sound_wood_defaults({
|
||||
dug = {name = "ruins_chest_break", gain = 0.6},
|
||||
}),
|
||||
drop = "default:stick 2",
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 8*4)
|
||||
end,
|
||||
after_dig_node = default.drop_node_inventory(),
|
||||
})
|
||||
|
||||
--[[local frm = default.chest_formspec
|
||||
if not default.chest_formspec then
|
||||
frm = "size[8,9]"..
|
||||
"list[current_name;main;0,0;8,4;]"..
|
||||
"list[current_player;main;0,5;8,4;]"
|
||||
end
|
||||
end]]
|
||||
|
||||
local function fill_chest(pos)
|
||||
minetest.set_node(pos, {name="default:chest", metadata=""})
|
||||
minetest.set_node(pos, {name="ruins:chest", metadata=""})
|
||||
minetest.after(2, function()
|
||||
local n = minetest.get_node(pos)
|
||||
local cnt = 0
|
||||
if n ~= nil then
|
||||
if n.name == "default:chest" then
|
||||
if n.name == "ruins:chest" then
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec",frm)
|
||||
meta:set_string("infotext", "Chest")
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 8*4)
|
||||
while cnt < 2 do
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 933 B |
Binary file not shown.
After Width: | Height: | Size: 663 B |
Binary file not shown.
After Width: | Height: | Size: 901 B |
Binary file not shown.
After Width: | Height: | Size: 913 B |
Loading…
Reference in New Issue