mirror of
https://github.com/minetest/minetest_game.git
synced 2024-12-22 14:12:26 +01:00
Add missing infotext to nodes (#2477)
This commit is contained in:
parent
888383a812
commit
1f7ea89cb6
@ -200,7 +200,7 @@ local function furnace_node_timer(pos, elapsed)
|
|||||||
if fuel and fuel_totaltime > fuel.time then
|
if fuel and fuel_totaltime > fuel.time then
|
||||||
fuel_totaltime = fuel.time
|
fuel_totaltime = fuel.time
|
||||||
end
|
end
|
||||||
if srclist[1]:is_empty() then
|
if srclist and srclist[1]:is_empty() then
|
||||||
src_time = 0
|
src_time = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -218,10 +218,10 @@ local function furnace_node_timer(pos, elapsed)
|
|||||||
item_state = S("@1%", item_percent)
|
item_state = S("@1%", item_percent)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if srclist[1]:is_empty() then
|
if srclist and not srclist[1]:is_empty() then
|
||||||
item_state = S("Empty")
|
|
||||||
else
|
|
||||||
item_state = S("Not cookable")
|
item_state = S("Not cookable")
|
||||||
|
else
|
||||||
|
item_state = S("Empty")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -238,7 +238,7 @@ local function furnace_node_timer(pos, elapsed)
|
|||||||
-- make sure timer restarts automatically
|
-- make sure timer restarts automatically
|
||||||
result = true
|
result = true
|
||||||
else
|
else
|
||||||
if not fuellist[1]:is_empty() then
|
if fuellist and not fuellist[1]:is_empty() then
|
||||||
fuel_state = S("@1%", 0)
|
fuel_state = S("@1%", 0)
|
||||||
end
|
end
|
||||||
formspec = default.get_furnace_inactive_formspec()
|
formspec = default.get_furnace_inactive_formspec()
|
||||||
@ -291,11 +291,11 @@ minetest.register_node("default:furnace", {
|
|||||||
|
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("formspec", default.get_furnace_inactive_formspec())
|
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size('src', 1)
|
inv:set_size('src', 1)
|
||||||
inv:set_size('fuel', 1)
|
inv:set_size('fuel', 1)
|
||||||
inv:set_size('dst', 4)
|
inv:set_size('dst', 4)
|
||||||
|
furnace_node_timer(pos, 0)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_metadata_inventory_move = function(pos)
|
on_metadata_inventory_move = function(pos)
|
||||||
|
@ -2602,7 +2602,12 @@ local function register_sign(material, desc, def)
|
|||||||
text .. "\" to sign at " .. minetest.pos_to_string(pos))
|
text .. "\" to sign at " .. minetest.pos_to_string(pos))
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("text", text)
|
meta:set_string("text", text)
|
||||||
meta:set_string("infotext", '"' .. text .. '"')
|
|
||||||
|
if #text > 0 then
|
||||||
|
meta:set_string("infotext", '"' .. text .. '"')
|
||||||
|
else
|
||||||
|
meta:set_string("infotext", '')
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -333,7 +333,7 @@ function doors.register(name, def)
|
|||||||
|
|
||||||
if def.protected then
|
if def.protected then
|
||||||
meta:set_string("owner", pn)
|
meta:set_string("owner", pn)
|
||||||
meta:set_string("infotext", S("Owned by @1", pn))
|
meta:set_string("infotext", S("Steel Door") .. "\n" .. S("Owned by @1", pn))
|
||||||
end
|
end
|
||||||
|
|
||||||
if not (creative and creative.is_enabled_for and creative.is_enabled_for(pn)) then
|
if not (creative and creative.is_enabled_for and creative.is_enabled_for(pn)) then
|
||||||
@ -586,7 +586,7 @@ function doors.register_trapdoor(name, def)
|
|||||||
local pn = placer:get_player_name()
|
local pn = placer:get_player_name()
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("owner", pn)
|
meta:set_string("owner", pn)
|
||||||
meta:set_string("infotext", S("Owned by @1", pn))
|
meta:set_string("infotext", S("Steel Trapdoor") .. "\n" .. S("Owned by @1", pn))
|
||||||
|
|
||||||
return (creative and creative.is_enabled_for and creative.is_enabled_for(pn))
|
return (creative and creative.is_enabled_for and creative.is_enabled_for(pn))
|
||||||
end
|
end
|
||||||
|
@ -16,11 +16,15 @@ local vessels_shelf_formspec =
|
|||||||
"listring[current_player;main]" ..
|
"listring[current_player;main]" ..
|
||||||
default.get_hotbar_bg(0, 2.85)
|
default.get_hotbar_bg(0, 2.85)
|
||||||
|
|
||||||
local function get_vessels_shelf_formspec(inv)
|
local function update_vessels_shelf(pos)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
local invlist = inv:get_list("vessels")
|
||||||
|
|
||||||
local formspec = vessels_shelf_formspec
|
local formspec = vessels_shelf_formspec
|
||||||
local invlist = inv and inv:get_list("vessels")
|
|
||||||
-- Inventory slots overlay
|
-- Inventory slots overlay
|
||||||
local vx, vy = 0, 0.3
|
local vx, vy = 0, 0.3
|
||||||
|
local n_items = 0
|
||||||
for i = 1, 16 do
|
for i = 1, 16 do
|
||||||
if i == 9 then
|
if i == 9 then
|
||||||
vx = 0
|
vx = 0
|
||||||
@ -29,10 +33,20 @@ local function get_vessels_shelf_formspec(inv)
|
|||||||
if not invlist or invlist[i]:is_empty() then
|
if not invlist or invlist[i]:is_empty() then
|
||||||
formspec = formspec ..
|
formspec = formspec ..
|
||||||
"image[" .. vx .. "," .. vy .. ";1,1;vessels_shelf_slot.png]"
|
"image[" .. vx .. "," .. vy .. ";1,1;vessels_shelf_slot.png]"
|
||||||
|
else
|
||||||
|
local stack = invlist[i]
|
||||||
|
if not stack:is_empty() then
|
||||||
|
n_items = n_items + stack:get_count()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
vx = vx + 1
|
vx = vx + 1
|
||||||
end
|
end
|
||||||
return formspec
|
meta:set_string("formspec", formspec)
|
||||||
|
if n_items == 0 then
|
||||||
|
meta:set_string("infotext", S("Empty Vessel Shelf"))
|
||||||
|
else
|
||||||
|
meta:set_string("infotext", S("Vessel Shelf (@1 items)", n_items))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("vessels:shelf", {
|
minetest.register_node("vessels:shelf", {
|
||||||
@ -46,7 +60,7 @@ minetest.register_node("vessels:shelf", {
|
|||||||
|
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("formspec", get_vessels_shelf_formspec(nil))
|
update_vessels_shelf(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size("vessels", 8 * 2)
|
inv:set_size("vessels", 8 * 2)
|
||||||
end,
|
end,
|
||||||
@ -63,20 +77,17 @@ minetest.register_node("vessels:shelf", {
|
|||||||
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||||
minetest.log("action", player:get_player_name() ..
|
minetest.log("action", player:get_player_name() ..
|
||||||
" moves stuff in vessels shelf at ".. minetest.pos_to_string(pos))
|
" moves stuff in vessels shelf at ".. minetest.pos_to_string(pos))
|
||||||
local meta = minetest.get_meta(pos)
|
update_vessels_shelf(pos)
|
||||||
meta:set_string("formspec", get_vessels_shelf_formspec(meta:get_inventory()))
|
|
||||||
end,
|
end,
|
||||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
minetest.log("action", player:get_player_name() ..
|
minetest.log("action", player:get_player_name() ..
|
||||||
" moves stuff to vessels shelf at ".. minetest.pos_to_string(pos))
|
" moves stuff to vessels shelf at ".. minetest.pos_to_string(pos))
|
||||||
local meta = minetest.get_meta(pos)
|
update_vessels_shelf(pos)
|
||||||
meta:set_string("formspec", get_vessels_shelf_formspec(meta:get_inventory()))
|
|
||||||
end,
|
end,
|
||||||
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||||
minetest.log("action", player:get_player_name() ..
|
minetest.log("action", player:get_player_name() ..
|
||||||
" takes stuff from vessels shelf at ".. minetest.pos_to_string(pos))
|
" takes stuff from vessels shelf at ".. minetest.pos_to_string(pos))
|
||||||
local meta = minetest.get_meta(pos)
|
update_vessels_shelf(pos)
|
||||||
meta:set_string("formspec", get_vessels_shelf_formspec(meta:get_inventory()))
|
|
||||||
end,
|
end,
|
||||||
on_blast = function(pos)
|
on_blast = function(pos)
|
||||||
local drops = {}
|
local drops = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user