mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-16 16:11:06 +01:00
Cleanup and removed debug prints.
This commit is contained in:
parent
cd63f32cdd
commit
96cd2657db
1 changed files with 3 additions and 21 deletions
|
@ -1,6 +1,6 @@
|
||||||
local S = minetest.get_translator(minetest.get_current_modname())
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
|
|
||||||
ASSIST_TIMEOUT_SEC = 10
|
ASSIST_TIMEOUT_SEC = 5
|
||||||
|
|
||||||
mcl_death_messages = {
|
mcl_death_messages = {
|
||||||
assist = {},
|
assist = {},
|
||||||
|
@ -151,11 +151,6 @@ mcl_death_messages = {
|
||||||
plain = "@1 went off with a bang",
|
plain = "@1 went off with a bang",
|
||||||
item = "@1 went off with a bang due to a firework fired from @3 by @2", -- order is intentional
|
item = "@1 went off with a bang due to a firework fired from @3 by @2", -- order is intentional
|
||||||
},
|
},
|
||||||
sweet_berry = {
|
|
||||||
_translator = S,
|
|
||||||
plain = "@1 died a sweet death",
|
|
||||||
assist = "@1 was poked to death by a sweet berry bush whilst trying to escape @2",
|
|
||||||
},
|
|
||||||
-- Missing snowballs: The Minecraft wiki mentions them but the MC source code does not.
|
-- Missing snowballs: The Minecraft wiki mentions them but the MC source code does not.
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -185,14 +180,8 @@ end
|
||||||
local function get_assist_message(obj, messages, reason)
|
local function get_assist_message(obj, messages, reason)
|
||||||
-- Avoid a timing issue if the assist passes its timeout.
|
-- Avoid a timing issue if the assist passes its timeout.
|
||||||
local assist_details = mcl_death_messages.assist[obj]
|
local assist_details = mcl_death_messages.assist[obj]
|
||||||
if messages.assist then
|
if messages.assist and assist_details then
|
||||||
print("TODO message.assist exists!")--TODO make this 1 condition again
|
return messages._translator(messages.assist, mcl_util.get_object_name(obj), assist_details.name)
|
||||||
if assist_details then
|
|
||||||
print("TODO There is an assist message object!")--TODO
|
|
||||||
return messages._translator(messages.assist, mcl_util.get_object_name(obj), assist_details.name)
|
|
||||||
end
|
|
||||||
else--TODO remove this else
|
|
||||||
print("TODO There was no assist message!")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -234,9 +223,6 @@ mcl_damage.register_on_death(function(obj, reason)
|
||||||
get_fallback_message(obj, messages, reason)
|
get_fallback_message(obj, messages, reason)
|
||||||
|
|
||||||
if send_to == true then
|
if send_to == true then
|
||||||
if not message or message == "" then
|
|
||||||
message = "there was not message"
|
|
||||||
end
|
|
||||||
minetest.chat_send_all(message)
|
minetest.chat_send_all(message)
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(send_to, message)
|
minetest.chat_send_player(send_to, message)
|
||||||
|
@ -245,19 +231,15 @@ mcl_damage.register_on_death(function(obj, reason)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
mcl_damage.register_on_damage(function(obj, damage, reason)
|
mcl_damage.register_on_damage(function(obj, damage, reason)
|
||||||
print("TODO ", reason.type .. " caused damage ")
|
|
||||||
if obj:get_hp() - damage > 0 then
|
if obj:get_hp() - damage > 0 then
|
||||||
if reason.source then
|
if reason.source then
|
||||||
print("TODO reason had a source")
|
|
||||||
-- To avoid timing issues we cancel the previous job before adding a new one.
|
-- To avoid timing issues we cancel the previous job before adding a new one.
|
||||||
if mcl_death_messages.assist[obj] then
|
if mcl_death_messages.assist[obj] then
|
||||||
print("TODO job is being caceled")
|
|
||||||
mcl_death_messages.assist[obj].job:cancel()
|
mcl_death_messages.assist[obj].job:cancel()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Add a new assist object with a timeout job.
|
-- Add a new assist object with a timeout job.
|
||||||
local new_job = minetest.after(ASSIST_TIMEOUT_SEC, function()
|
local new_job = minetest.after(ASSIST_TIMEOUT_SEC, function()
|
||||||
print("TODO in job")
|
|
||||||
mcl_death_messages.assist[obj] = nil
|
mcl_death_messages.assist[obj] = nil
|
||||||
end)
|
end)
|
||||||
mcl_death_messages.assist[obj] = {name = mcl_util.get_object_name(reason.source), job = new_job}
|
mcl_death_messages.assist[obj] = {name = mcl_util.get_object_name(reason.source), job = new_job}
|
||||||
|
|
Loading…
Reference in a new issue