chests can now be named
This commit is contained in:
parent
55dea76d3c
commit
9c314e0549
@ -23,6 +23,9 @@ default_privs = interact, shout, spawn, fast, player_skin
|
|||||||
# if you're given the inital stuff; a stone pick and 10 torches
|
# if you're given the inital stuff; a stone pick and 10 torches
|
||||||
give_initial_stuff = false
|
give_initial_stuff = false
|
||||||
|
|
||||||
|
# if you can name chests when the sign is below the chest; may cause problems
|
||||||
|
signs_allow_name_above = false
|
||||||
|
|
||||||
# possible player skins; make sure they exist in the form "player_skins_[skin].png"!
|
# possible player skins; make sure they exist in the form "player_skins_[skin].png"!
|
||||||
player_skins_names = male,female
|
player_skins_names = male,female
|
||||||
|
|
||||||
|
@ -2,6 +2,31 @@
|
|||||||
-- Functions/ABMs
|
-- Functions/ABMs
|
||||||
--
|
--
|
||||||
|
|
||||||
|
-- Chest naming via signs
|
||||||
|
function default.write_name(pos, text)
|
||||||
|
-- check above, if allowed
|
||||||
|
if minetest.setting_getbool("signs_allow_name_above") then
|
||||||
|
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
|
||||||
|
local abovedef = nil
|
||||||
|
if minetest.registered_nodes[minetest.get_node(above).name] then
|
||||||
|
abovedef = minetest.registered_nodes[minetest.get_node(above).name]
|
||||||
|
end
|
||||||
|
if abovedef and abovedef.write_name ~= nil then
|
||||||
|
abovedef.write_name(above, text)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- then below
|
||||||
|
local below = {x = pos.x, y = pos.y - 1, z = pos.z}
|
||||||
|
local belowdef = nil
|
||||||
|
if minetest.registered_nodes[minetest.get_node(below).name] then
|
||||||
|
belowdef = minetest.registered_nodes[minetest.get_node(below).name]
|
||||||
|
end
|
||||||
|
if belowdef and belowdef.write_name ~= nil then
|
||||||
|
belowdef.write_name(below, text)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Saplings growing
|
-- Saplings growing
|
||||||
|
|
||||||
function default.grow_tree(pos, variety)
|
function default.grow_tree(pos, variety)
|
||||||
@ -270,26 +295,25 @@ minetest.register_abm( -- cactus grows
|
|||||||
minetest.register_abm( -- papyrus grows
|
minetest.register_abm( -- papyrus grows
|
||||||
{
|
{
|
||||||
nodenames = {"default:papyrus"},
|
nodenames = {"default:papyrus"},
|
||||||
neighbors = {"group:plantable_sandy"},
|
neighbors = {"group:plantable_sandy", "group:plantable_soil"},
|
||||||
interval = 20,
|
interval = 20,
|
||||||
chance = 10,
|
chance = 10,
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
pos.y = pos.y-1
|
pos.y = pos.y-1
|
||||||
local name = minetest.get_node(pos).name
|
local name = minetest.get_node(pos).name
|
||||||
if name == "default:sand" or name == "default:dirt" or name == "default:dirt_with_grass" then
|
|
||||||
if minetest.find_node_near(pos, 3, {"group:water"}) == nil then
|
if minetest.find_node_near(pos, 3, {"group:water"}) == nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
pos.y = pos.y+1
|
||||||
|
local height = 0
|
||||||
|
while minetest.get_node(pos).name == "default:papyrus" and height < 3 do
|
||||||
|
height = height+1
|
||||||
pos.y = pos.y+1
|
pos.y = pos.y+1
|
||||||
local height = 0
|
end
|
||||||
while minetest.get_node(pos).name == "default:papyrus" and height < 3 do
|
if height < 3 then
|
||||||
height = height+1
|
if minetest.get_node(pos).name == "air" then
|
||||||
pos.y = pos.y+1
|
minetest.set_node(pos, {name="default:papyrus"})
|
||||||
end
|
|
||||||
if height < 3 then
|
|
||||||
if minetest.get_node(pos).name == "air" then
|
|
||||||
minetest.set_node(pos, {name="default:papyrus"})
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@ -332,21 +356,4 @@ minetest.register_abm( -- weak torchs burn out and die after ~3 minutes
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
-- if minetest.setting_getbool("flowing_water_sounds") then
|
|
||||||
-- minetest.register_abm( -- river water makes gurgling noises
|
|
||||||
-- {
|
|
||||||
-- nodenames = {"group:flowing_water"},
|
|
||||||
-- interval = 1,
|
|
||||||
-- chance = 16,
|
|
||||||
-- action = function(pos, node)
|
|
||||||
-- minetest.sound_play(
|
|
||||||
-- "default_water",
|
|
||||||
-- {
|
|
||||||
-- pos = pos,
|
|
||||||
-- gain = 0.2,
|
|
||||||
-- })
|
|
||||||
-- end
|
|
||||||
-- })
|
|
||||||
-- end
|
|
||||||
|
|
||||||
default.log("functions", "loaded")
|
default.log("functions", "loaded")
|
@ -1210,7 +1210,12 @@ minetest.register_node(
|
|||||||
minetest.pos_to_string(pos))
|
minetest.pos_to_string(pos))
|
||||||
meta:set_string("text", fields.text)
|
meta:set_string("text", fields.text)
|
||||||
meta:set_string("infotext", '"'..fields.text..'"')
|
meta:set_string("infotext", '"'..fields.text..'"')
|
||||||
|
|
||||||
|
default.write_name(pos, meta:get_string("text"))
|
||||||
end,
|
end,
|
||||||
|
on_destruct = function(pos)
|
||||||
|
default.write_name(pos, "")
|
||||||
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node(
|
minetest.register_node(
|
||||||
@ -1422,6 +1427,15 @@ minetest.register_node(
|
|||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
return inv:is_empty("main")
|
return inv:is_empty("main")
|
||||||
end,
|
end,
|
||||||
|
write_name = function(pos, text)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
|
||||||
|
if text ~= "" then
|
||||||
|
meta:set_string("infotext", text)
|
||||||
|
else
|
||||||
|
meta:set_string("infotext", "Chest")
|
||||||
|
end
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
local form_chest = default.ui.get_page("core_2part")
|
local form_chest = default.ui.get_page("core_2part")
|
||||||
|
@ -173,6 +173,15 @@ minetest.register_node(
|
|||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
return inv:is_empty("main") and locks.is_owner(meta, player)
|
return inv:is_empty("main") and locks.is_owner(meta, player)
|
||||||
end,
|
end,
|
||||||
|
write_name = function(pos, text)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
|
||||||
|
if text ~= "" then
|
||||||
|
meta:set_string("infotext", text .. " (Owned by " .. meta:get_string("lock_owner") .. ")")
|
||||||
|
else
|
||||||
|
meta:set_string("infotext", "Locked Chest (Owned by " .. meta:get_string("lock_owner") .. ")")
|
||||||
|
end
|
||||||
|
end,
|
||||||
on_blast = function() end,
|
on_blast = function() end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user