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) local function on_flood(pos, oldnode, newnode)
-- drop as unlit torch -- drop as unlit torch
@ -25,7 +29,7 @@ end
-- unlit floor torch -- unlit floor torch
minetest.register_node("real_torch:torch", { minetest.register_node("real_torch:torch", {
description = "Torch", description = S("Unlit Torch"),
drawtype = "mesh", drawtype = "mesh",
mesh = "torch_floor.obj", mesh = "torch_floor.obj",
inventory_image = "real_torch_on_floor.png", inventory_image = "real_torch_on_floor.png",

View File

@ -7,15 +7,18 @@ real_torch = {}
real_torch.min_duration = tonumber(minetest.settings:get("torch_min_duration")) or 1200 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 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 -- add unlit torches
dofile(minetest.get_modpath("real_torch") .. "/3d.lua") dofile(minetest.get_modpath("real_torch") .. "/3d.lua")
-- start timer on any already placed torches -- start timer on any already placed torches
minetest.register_lbm({ minetest.register_lbm({
name = "real_torch:convert_torch_to_node_timer", name = "real_torch:convert_torch_to_node_timer",
nodenames = {"default:torch", "default:torch_wall", "default:torch_ceiling"}, nodenames = {"default:torch", "default:torch_wall", "default:torch_ceiling"},
action = function(pos) action = function(pos)
if not minetest.get_node_timer(pos):is_started() then if not minetest.get_node_timer(pos):is_started() then
@ -29,15 +32,14 @@ minetest.register_lbm({
-- creative check -- creative check
local creative_mode_cache = minetest.settings:get_bool("creative_mode") local creative_mode_cache = minetest.settings:get_bool("creative_mode")
local function is_creative(name)
function is_creative(name)
return creative_mode_cache or minetest.check_player_privs(name, {creative = true}) return creative_mode_cache or minetest.check_player_privs(name, {creative = true})
end end
-- coal powder -- coal powder
minetest.register_craftitem("real_torch:coal_powder", { minetest.register_craftitem("real_torch:coal_powder", {
description = "Coal Powder", description = S("Coal Powder"),
inventory_image = "real_torch_coal_powder.png", inventory_image = "real_torch_coal_powder.png",
-- punching unlit torch with coal powder relights -- punching unlit torch with coal powder relights