diff --git a/internal_nodefunctions.lua b/internal_nodefunctions.lua index aaec840..268919c 100644 --- a/internal_nodefunctions.lua +++ b/internal_nodefunctions.lua @@ -39,9 +39,9 @@ local function get_target_nodename(node, pos, next_stages) elseif ((stage_chance[3] ~= nil) and (type(stage_chance[3].can_set) == "function") and (stage_chance[3].can_set(pos) == false)) then - return node.name + return node.name, {} else - return stage_chance[1] + return stage_chance[1], stage_chance end end end @@ -55,19 +55,27 @@ local function on_timer(pos, elapsed) local node = minetest.get_node(pos) local stage = minetest.registered_nodes[node.name]._stage - local target_nodename - local timer = 0 - local duration if ((stage == nil) or (stage.next_stages == nil) or (stage.duration == nil)) then yl_api_nodestages.remove_timer(pos) return end + local target_nodename + local target_nodeparams + local next_stage + local timer = 0 + local duration + repeat duration = stage.duration timer = timer + duration - target_nodename = get_target_nodename(node, pos, stage.next_stages) + target_nodename, next_stage = get_target_nodename(node, pos, + stage.next_stages) + target_nodeparams = { + param1 = next_stage.param1, + param2 = next_stage.param2 + } if (target_nodename == yl_api_nodestages.error) then -- Thing kaputt, stop it. @@ -85,12 +93,16 @@ local function on_timer(pos, elapsed) stage = minetest.registered_nodes[target_nodename] and minetest.registered_nodes[target_nodename]._stage or nil end - until ((timer >= elapsed) or (stage == nil) or (stage.duration == 0) or (stage.duration == nil)) + until ((timer >= elapsed) or (stage == nil) or (stage.duration == 0) or + (stage.duration == nil)) - if (node.name == target_nodename) then - return true end + if (node.name == target_nodename) then return true end - minetest.set_node(pos, {name = target_nodename}) + minetest.set_node(pos, { + name = target_nodename, + param1 = target_nodeparams.param1, + param2 = target_nodeparams.param2 + }) local remaining = timer - elapsed if (stage and stage.duration and (remaining > 0)) then diff --git a/locale/template.txt b/locale/template.txt new file mode 100644 index 0000000..7370247 --- /dev/null +++ b/locale/template.txt @@ -0,0 +1,3 @@ +# textdomain: yl_api_nodestages + +[MOD] @1 : @2= \ No newline at end of file diff --git a/locale/yl_api_nodestages.de.tr b/locale/yl_api_nodestages.de.tr new file mode 100644 index 0000000..bb54583 --- /dev/null +++ b/locale/yl_api_nodestages.de.tr @@ -0,0 +1,3 @@ +# textdomain: yl_api_nodestages + +[MOD] @1 : @2=[MOD] @1 : @2 \ No newline at end of file diff --git a/texts.lua b/texts.lua index 1af3287..6acd630 100644 --- a/texts.lua +++ b/texts.lua @@ -3,7 +3,13 @@ local S = minetest.get_translator(yl_api_nodestages.modname) local texts = {} --function yl_api_nodestages.t(key, ...) return S(texts[key], ...) or "" end -function yl_api_nodestages.t(key, ...) return S(texts[key], ...) or "" end +function yl_api_nodestages.t(key, ...) + if (texts[key] == nil) then + minetest.log("warning","key " .. (key or "") .. " does not exist") + return key + end + return S(texts[key], ...) or "" +end -- Fixed texts @@ -14,7 +20,7 @@ texts["get_filepath"] = "get_filepath : @1" -- Translateable texts -texts["information_additional"] = "YL Food API" +texts["information_additional"] = "YL Nodestages API" texts["api_sent_x_to_y"] = "Sent @1 to @2"