Make cauldron infotexts more helpful
This commit is contained in:
parent
219c6481bd
commit
c0d9d66825
@ -1,11 +1,25 @@
|
|||||||
local cauldron, sounds = {}, {}
|
local cauldron, sounds = {}, {}
|
||||||
local S = minetest.get_translator("xdecor")
|
local S = minetest.get_translator("xdecor")
|
||||||
|
|
||||||
local infotext_empty = S("Cauldron (empty)")
|
local hint_fire = S("Light a fire below to heat it up")
|
||||||
local infotext_idle = S("Cauldron (idle)")
|
local hint_eat = S("Use a bowl to eat the soup")
|
||||||
local infotext_boiling = S("Cauldron (active) - Drop foods inside to make a soup")
|
local hint_recipe = S("Drop foods inside to make a soup")
|
||||||
local infotext_soup_boiling = S("Cauldron (active) - Use a bowl to eat the soup")
|
|
||||||
local infotext_soup_idle = S("Cauldron (inactive) - Use a bowl to eat the soup")
|
local infotexts = {
|
||||||
|
["xdecor:cauldron_empty"] = S("Cauldron (empty)"),
|
||||||
|
["xdecor:cauldron_idle"] = S("Cauldron (cold water)").."\n"..hint_fire,
|
||||||
|
["xdecor:cauldron_idle_river_water"] = S("Cauldron (cold river water)").."\n"..hint_fire,
|
||||||
|
["xdecor:cauldron_idle_soup"] = S("Cauldron (cold soup)").."\n"..hint_eat,
|
||||||
|
["xdecor:cauldron_boiling"] = S("Cauldron (boiling water)").."\n"..hint_recipe,
|
||||||
|
["xdecor:cauldron_boiling_river_water"] = S("Cauldron (boiling river water)").."\n"..hint_recipe,
|
||||||
|
["xdecor:cauldron_soup"] = S("Cauldron (boiling soup)").."\n"..hint_eat,
|
||||||
|
}
|
||||||
|
|
||||||
|
local function set_infotext(meta, node)
|
||||||
|
if infotexts[node.name] then
|
||||||
|
meta:set_string("infotext", infotexts[node.name])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Add more ingredients here that make a soup.
|
-- Add more ingredients here that make a soup.
|
||||||
local ingredients_list = {
|
local ingredients_list = {
|
||||||
@ -59,8 +73,9 @@ end
|
|||||||
|
|
||||||
function cauldron.idle_construct(pos)
|
function cauldron.idle_construct(pos)
|
||||||
local timer = minetest.get_node_timer(pos)
|
local timer = minetest.get_node_timer(pos)
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("infotext", infotext_idle)
|
set_infotext(meta, node)
|
||||||
timer:start(10.0)
|
timer:start(10.0)
|
||||||
cauldron.stop_sound(pos)
|
cauldron.stop_sound(pos)
|
||||||
end
|
end
|
||||||
@ -69,21 +84,13 @@ function cauldron.boiling_construct(pos)
|
|||||||
cauldron.start_sound(pos)
|
cauldron.start_sound(pos)
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("infotext", infotext_boiling)
|
local node = minetest.get_node(pos)
|
||||||
|
set_infotext(meta, node)
|
||||||
|
|
||||||
local timer = minetest.get_node_timer(pos)
|
local timer = minetest.get_node_timer(pos)
|
||||||
timer:start(5.0)
|
timer:start(5.0)
|
||||||
end
|
end
|
||||||
|
|
||||||
function cauldron.idle_construct(pos)
|
|
||||||
local timer = minetest.get_node_timer(pos)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
meta:set_string("infotext", infotext_idle)
|
|
||||||
timer:start(10.0)
|
|
||||||
cauldron.stop_sound(pos)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function cauldron.filling(pos, node, clicker, itemstack)
|
function cauldron.filling(pos, node, clicker, itemstack)
|
||||||
local inv = clicker:get_inventory()
|
local inv = clicker:get_inventory()
|
||||||
@ -236,28 +243,27 @@ end
|
|||||||
|
|
||||||
xdecor.register("cauldron_empty", {
|
xdecor.register("cauldron_empty", {
|
||||||
description = S("Cauldron"),
|
description = S("Cauldron"),
|
||||||
groups = {cracky=2, oddly_breakable_by_hand=1},
|
groups = {cracky=2, oddly_breakable_by_hand=1,cauldron=1},
|
||||||
on_rotate = screwdriver.rotate_simple,
|
on_rotate = screwdriver.rotate_simple,
|
||||||
tiles = {"xdecor_cauldron_top_empty.png", "xdecor_cauldron_sides.png"},
|
tiles = {"xdecor_cauldron_top_empty.png", "xdecor_cauldron_sides.png"},
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_metal_defaults(),
|
||||||
infotext = infotext_empty,
|
|
||||||
collision_box = xdecor.pixelbox(16, cauldron.cbox),
|
collision_box = xdecor.pixelbox(16, cauldron.cbox),
|
||||||
on_rightclick = cauldron.filling,
|
on_rightclick = cauldron.filling,
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("infotext", infotext_empty)
|
local node = minetest.get_node(pos)
|
||||||
|
set_infotext(meta, node)
|
||||||
cauldron.stop_sound(pos)
|
cauldron.stop_sound(pos)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
xdecor.register("cauldron_idle", {
|
xdecor.register("cauldron_idle", {
|
||||||
description = S("Cauldron with Water (idle)"),
|
description = S("Cauldron with Water (cold)"),
|
||||||
groups = {cracky=2, oddly_breakable_by_hand=1, not_in_creative_inventory=1},
|
groups = {cracky=2, oddly_breakable_by_hand=1, not_in_creative_inventory=1,cauldron=2},
|
||||||
on_rotate = screwdriver.rotate_simple,
|
on_rotate = screwdriver.rotate_simple,
|
||||||
tiles = {"xdecor_cauldron_top_idle.png", "xdecor_cauldron_sides.png"},
|
tiles = {"xdecor_cauldron_top_idle.png", "xdecor_cauldron_sides.png"},
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_metal_defaults(),
|
||||||
drop = "xdecor:cauldron_empty",
|
drop = "xdecor:cauldron_empty",
|
||||||
infotext = infotext_idle,
|
|
||||||
collision_box = xdecor.pixelbox(16, cauldron.cbox),
|
collision_box = xdecor.pixelbox(16, cauldron.cbox),
|
||||||
on_rightclick = cauldron.filling,
|
on_rightclick = cauldron.filling,
|
||||||
on_construct = cauldron.idle_construct,
|
on_construct = cauldron.idle_construct,
|
||||||
@ -265,13 +271,12 @@ xdecor.register("cauldron_idle", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
xdecor.register("cauldron_idle_river_water", {
|
xdecor.register("cauldron_idle_river_water", {
|
||||||
description = S("Cauldron with River Water (idle)"),
|
description = S("Cauldron with River Water (cold)"),
|
||||||
groups = {cracky=2, oddly_breakable_by_hand=1, not_in_creative_inventory=1},
|
groups = {cracky=2, oddly_breakable_by_hand=1, not_in_creative_inventory=1,cauldron=2},
|
||||||
on_rotate = screwdriver.rotate_simple,
|
on_rotate = screwdriver.rotate_simple,
|
||||||
tiles = {"xdecor_cauldron_top_idle_river_water.png", "xdecor_cauldron_sides.png"},
|
tiles = {"xdecor_cauldron_top_idle_river_water.png", "xdecor_cauldron_sides.png"},
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_metal_defaults(),
|
||||||
drop = "xdecor:cauldron_empty",
|
drop = "xdecor:cauldron_empty",
|
||||||
infotext = infotext_idle,
|
|
||||||
collision_box = xdecor.pixelbox(16, cauldron.cbox),
|
collision_box = xdecor.pixelbox(16, cauldron.cbox),
|
||||||
on_rightclick = cauldron.filling,
|
on_rightclick = cauldron.filling,
|
||||||
on_construct = cauldron.idle_construct,
|
on_construct = cauldron.idle_construct,
|
||||||
@ -279,17 +284,17 @@ xdecor.register("cauldron_idle_river_water", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
xdecor.register("cauldron_idle_soup", {
|
xdecor.register("cauldron_idle_soup", {
|
||||||
description = S("Cauldron with Soup (idle)"),
|
description = S("Cauldron with Soup (cold)"),
|
||||||
groups = {cracky = 2, oddly_breakable_by_hand = 1, not_in_creative_inventory = 1},
|
groups = {cracky = 2, oddly_breakable_by_hand = 1, not_in_creative_inventory = 1,cauldron=2},
|
||||||
on_rotate = screwdriver.rotate_simple,
|
on_rotate = screwdriver.rotate_simple,
|
||||||
drop = "xdecor:cauldron_empty",
|
drop = "xdecor:cauldron_empty",
|
||||||
infotext = infotext_soup_idle,
|
|
||||||
tiles = {"xdecor_cauldron_top_idle_soup.png", "xdecor_cauldron_sides.png"},
|
tiles = {"xdecor_cauldron_top_idle_soup.png", "xdecor_cauldron_sides.png"},
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_metal_defaults(),
|
||||||
collision_box = xdecor.pixelbox(16, cauldron.cbox),
|
collision_box = xdecor.pixelbox(16, cauldron.cbox),
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("infotext", infotext_soup_idle)
|
local node = minetest.get_node(pos)
|
||||||
|
set_infotext(meta, node)
|
||||||
local timer = minetest.get_node_timer(pos)
|
local timer = minetest.get_node_timer(pos)
|
||||||
timer:start(10.0)
|
timer:start(10.0)
|
||||||
cauldron.stop_sound(pos)
|
cauldron.stop_sound(pos)
|
||||||
@ -299,11 +304,10 @@ xdecor.register("cauldron_idle_soup", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
xdecor.register("cauldron_boiling", {
|
xdecor.register("cauldron_boiling", {
|
||||||
description = S("Cauldron with Water (active)"),
|
description = S("Cauldron with Water (boiling)"),
|
||||||
groups = {cracky=2, oddly_breakable_by_hand=1, not_in_creative_inventory=1},
|
groups = {cracky=2, oddly_breakable_by_hand=1, not_in_creative_inventory=1,cauldron=3},
|
||||||
on_rotate = screwdriver.rotate_simple,
|
on_rotate = screwdriver.rotate_simple,
|
||||||
drop = "xdecor:cauldron_empty",
|
drop = "xdecor:cauldron_empty",
|
||||||
infotext = infotext_boiling,
|
|
||||||
damage_per_second = 2,
|
damage_per_second = 2,
|
||||||
tiles = {
|
tiles = {
|
||||||
{
|
{
|
||||||
@ -323,11 +327,10 @@ xdecor.register("cauldron_boiling", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
xdecor.register("cauldron_boiling_river_water", {
|
xdecor.register("cauldron_boiling_river_water", {
|
||||||
description = S("Cauldron with River Water (active)"),
|
description = S("Cauldron with River Water (boiling)"),
|
||||||
groups = {cracky=2, oddly_breakable_by_hand=1, not_in_creative_inventory=1},
|
groups = {cracky=2, oddly_breakable_by_hand=1, not_in_creative_inventory=1,cauldron=3},
|
||||||
on_rotate = screwdriver.rotate_simple,
|
on_rotate = screwdriver.rotate_simple,
|
||||||
drop = "xdecor:cauldron_empty",
|
drop = "xdecor:cauldron_empty",
|
||||||
infotext = infotext_boiling,
|
|
||||||
damage_per_second = 2,
|
damage_per_second = 2,
|
||||||
tiles = {
|
tiles = {
|
||||||
{
|
{
|
||||||
@ -349,11 +352,10 @@ xdecor.register("cauldron_boiling_river_water", {
|
|||||||
|
|
||||||
|
|
||||||
xdecor.register("cauldron_soup", {
|
xdecor.register("cauldron_soup", {
|
||||||
description = S("Cauldron with Soup (active)"),
|
description = S("Cauldron with Soup (boiling)"),
|
||||||
groups = {cracky = 2, oddly_breakable_by_hand = 1, not_in_creative_inventory = 1},
|
groups = {cracky = 2, oddly_breakable_by_hand = 1, not_in_creative_inventory = 1,cauldron=3},
|
||||||
on_rotate = screwdriver.rotate_simple,
|
on_rotate = screwdriver.rotate_simple,
|
||||||
drop = "xdecor:cauldron_empty",
|
drop = "xdecor:cauldron_empty",
|
||||||
infotext = infotext_soup_boiling,
|
|
||||||
damage_per_second = 2,
|
damage_per_second = 2,
|
||||||
tiles = {
|
tiles = {
|
||||||
{
|
{
|
||||||
@ -367,7 +369,8 @@ xdecor.register("cauldron_soup", {
|
|||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
cauldron.start_sound(pos)
|
cauldron.start_sound(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("infotext", infotext_soup_boiling)
|
local node = minetest.get_node(pos)
|
||||||
|
set_infotext(meta, node)
|
||||||
|
|
||||||
local timer = minetest.get_node_timer(pos)
|
local timer = minetest.get_node_timer(pos)
|
||||||
timer:start(5.0)
|
timer:start(5.0)
|
||||||
@ -426,3 +429,13 @@ minetest.register_lbm({
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_lbm({
|
||||||
|
label = "Update cauldron infotexts",
|
||||||
|
name = "xdecor:update_cauldron_infotexts",
|
||||||
|
nodenames = {"group:cauldron"},
|
||||||
|
run_at_every_load = false,
|
||||||
|
action = function(pos, node)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
set_infotext(meta, node)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user