add translation support

This commit is contained in:
tenplus1 2024-08-08 14:39:20 +01:00
parent 76c23bffa0
commit ab4b086753
2 changed files with 11 additions and 5 deletions

6
3d.lua
View File

@ -1,4 +1,8 @@
-- translation support
local S = minetest.get_translator("real_torch")
local function on_flood(pos, oldnode, newnode)
-- drop as unlit torch
@ -25,7 +29,7 @@ end
-- unlit floor torch
minetest.register_node("real_torch:torch", {
description = "Torch",
description = S("Unlit Torch"),
drawtype = "mesh",
mesh = "torch_floor.obj",
inventory_image = "real_torch_on_floor.png",

View File

@ -7,6 +7,8 @@ real_torch = {}
real_torch.min_duration = tonumber(minetest.settings:get("torch_min_duration")) or 1200
real_torch.max_duration = tonumber(minetest.settings:get("torch_max_duration")) or 1800
-- translation support
local S = minetest.get_translator("real_torch")
-- add unlit torches
dofile(minetest.get_modpath("real_torch") .. "/3d.lua")
@ -16,6 +18,7 @@ real_torch.max_duration = tonumber(minetest.settings:get("torch_max_duration"))
minetest.register_lbm({
name = "real_torch:convert_torch_to_node_timer",
nodenames = {"default:torch", "default:torch_wall", "default:torch_ceiling"},
action = function(pos)
if not minetest.get_node_timer(pos):is_started() then
@ -29,15 +32,14 @@ minetest.register_lbm({
-- creative check
local creative_mode_cache = minetest.settings:get_bool("creative_mode")
function is_creative(name)
local function is_creative(name)
return creative_mode_cache or minetest.check_player_privs(name, {creative = true})
end
-- coal powder
minetest.register_craftitem("real_torch:coal_powder", {
description = "Coal Powder",
description = S("Coal Powder"),
inventory_image = "real_torch_coal_powder.png",
-- punching unlit torch with coal powder relights