Add plural support for laser stepper

This commit is contained in:
Wuzzy 2024-12-10 03:02:47 +01:00
parent 05283cf856
commit 0423ba7151

View File

@ -1,4 +1,4 @@
local S = minetest.get_translator("lzr_tools")
local S, PS = minetest.get_translator("lzr_tools")
local instadig = { times = { [1] = 0, [2] = 0, [3] = 0}, uses=0, maxlevel=255}
@ -123,6 +123,11 @@ if minetest.settings:get_bool("lzr_debug", false) then
return itemstack
end
local step_msg = function(user, iter)
--~ Message shown when the 'laser stepper' debug tool was used to simulate the laser travel algorithm with a set number of iterations
minetest.chat_send_player(user:get_player_name(), PS("Emitted lasers with @1 iteration.", "Emitted lasers with @1 iterations", iter, iter))
end
-- Debug tool to test the laser travel algorithm.
-- Simulates the laser travelling up to a certain maximum number of iterations.
minetest.register_tool("lzr_tools:laser_stepper", {
@ -142,7 +147,7 @@ if minetest.settings:get_bool("lzr_debug", false) then
ls_max_iterations = ls_max_iterations + 1
end
emit_lasers_raw(ls_max_iterations)
minetest.chat_send_player(user:get_player_name(), S("Emitted lasers with @1 iteration(s).", ls_max_iterations))
step_msg(user, ls_max_iterations)
return itemstack
end,
on_place = function(itemstack, user)
@ -154,7 +159,7 @@ if minetest.settings:get_bool("lzr_debug", false) then
end
ls_max_iterations = math.max(0, ls_max_iterations)
emit_lasers_raw(ls_max_iterations)
minetest.chat_send_player(user:get_player_name(), S("Emitted lasers with @1 iteration(s).", ls_max_iterations))
step_msg(user, ls_max_iterations)
return itemstack
end,
on_secondary_use = function(itemstack, user)
@ -166,7 +171,7 @@ if minetest.settings:get_bool("lzr_debug", false) then
end
ls_max_iterations = math.max(0, ls_max_iterations)
emit_lasers_raw(ls_max_iterations)
minetest.chat_send_player(user:get_player_name(), S("Emitted lasers with @1 iteration(s).", ls_max_iterations))
step_msg(user, ls_max_iterations)
return itemstack
end,
})