Deals with all TODO

This commit is contained in:
AliasAlreadyTaken 2024-07-07 23:43:22 +02:00
parent 786642eda4
commit a2c8e78034
2 changed files with 10 additions and 6 deletions

10
api.lua
View File

@ -110,7 +110,8 @@ local function add_stage(p_stage)
target_def._stage = stage
target_def.on_timer = yl_api_nodestages.on_timer
target_def.on_construct = yl_api_nodestages.on_construct
-- TODO: Do we really need a destruct? If we do, shouldn't we check for it?
-- Do we really need a destruct? If we do, shouldn't we check for it?
-- No, we don't, at least for now
-- target_def.on_destruct = yl_api_nodestages.on_destruct
minetest.override_item(nodename, target_def)
@ -180,7 +181,8 @@ local function overwrite_stage(p_stage)
target_def._stage._previous = previous
target_def.on_timer = yl_api_nodestages.on_timer
target_def.on_construct = yl_api_nodestages.on_construct
-- TODO: Do we really need a destruct? If we do, shouldn't we check for it?
-- Do we really need a destruct? If we do, shouldn't we check for it?
-- No, we don't, at least for now
-- target_def.on_destruct = yl_api_nodestages.on_destruct
minetest.override_item(nodename, target_def)
@ -222,7 +224,9 @@ local function delete_stage(modname, nodename)
def._stage = nil
def.on_timer = nil
def.on_construct = nil
def.on_destruct = nil -- TODO: Do we really need a destruct? If we do, shouldn't we check for it?
-- Do we really need a destruct? If we do, shouldn't we check for it?
-- No, we don't, at least for now
-- def.on_destruct = nil
if (minetest.registered_nodes[modname .. ":" .. nodename]._stage ~= nil) then
return false, yl_api_nodestages.t("stage_not_deleted")

View File

@ -58,13 +58,13 @@ Future update where we have random duration:
-- Preparation for random duration
function calc_duration(duration)
assert(duration ~= nil, "TODO: ERROR")
assert(duration ~= nil, "ERROR")
local d_min, d_max
-- table
if type(duration) == "table" then
assert(((#duration >= 1) and (#duration <= 2)), "TODO: ERROR")
assert(((#duration >= 1) and (#duration <= 2)), "ERROR")
if #duration == 1 then
d_min = duration[1]
@ -84,7 +84,7 @@ function calc_duration(duration)
return yl_api_nodestages.error
end
assert((d_min >= 0) and (d_max >= 0) and ((d_max >= d_min)), "TODO: ERROR")
assert((d_min >= 0) and (d_max >= 0) and ((d_max >= d_min)), "ERROR")
return {min = d_min, max = d_max}
end