+ Added setting to assign a custom importance to each armor material

+ Added a message telling a player his/her killer's HP
+ Added missing translation
master
Giov4 2020-12-23 20:48:39 +01:00
parent ada2a950a5
commit acb80a54d1
5 changed files with 30 additions and 13 deletions

View File

@ -88,3 +88,18 @@ skywars_settings.nodes_per_tick = 20
skywars_settings.remove_armors_on_join = true
-- The armors importances that are used by the auto equip system:
-- when a player takes an armor from a chest, if it has a greater
-- importance that the already equipped one the latter gets replaced.
-- If the armor name contains one of this materials then the
-- corresponding importance will be associated with it.
skywars_settings.armors_importances = {
["cactus"] = 0,
["wood"] = 1,
["gold"] = 2,
["bronze"] = 3,
["steel"] = 4,
["mithril"] = 5,
["diamond"] = 6
}

View File

@ -85,8 +85,10 @@ arena_lib.on_death("skywars", function(arena, pl_name, reason)
if reason.type == "punch" then
if reason.object and reason.object:is_player() then
local killer = reason.object:get_player_name()
local killer_health = reason.object:get_hp()
arena_lib.send_message_players_in_arena(arena, skywars_settings.prefix .. skywars.T("@1 was killed by @2", pl_name, killer))
skywars.print_msg(pl_name, skywars.T("@1 killed you with @2 HPs", killer, killer_health))
skywars.increment_players_killed(killer)
end
end

View File

@ -36,6 +36,9 @@ minetest.register_on_player_inventory_action(function(player, action, inventory,
if equipped_armor then
local armor_importance = get_armor_importance(armor_name)
local weared_armor_importance = get_armor_importance(equipped_armor)
if not armor_importance or not weared_armor_importance then return end
-- Returning if the just taken armor is worse or as good as the equipped one.
if armor_importance <= weared_armor_importance then return end
end
@ -51,14 +54,9 @@ end)
function get_armor_importance(armor_name)
local importance
if (armor_name:match("wood")) then importance = 1
elseif (armor_name:match("gold")) then importance = 2
elseif (armor_name:match("bronze")) then importance = 3
elseif (armor_name:match("steel")) then importance = 4
elseif (armor_name:match("diamond")) then importance = 5
for material, importance in pairs(skywars_settings.armors_importances) do
if armor_name:match(material) then
return importance
end
end
return importance
end

View File

@ -27,7 +27,6 @@ You didn't set the chests!=Non hai impostato le chest!
You didn't set the map corners!=Non hai impostato gli angoli della mappa!
@1 must be disabled!=@1 deve essere disabilitata!
@1 must be enabled!=@1 deve essere abilitata!
@1 was killed by @2=@1 è stato ucciso da @2
@1 already exists!=@1 esiste già!
@1 added to @2!=@1 aggiunto a @2
@1 removed from @2!=@1 rimosso da @2!
@ -44,4 +43,6 @@ x@1 @2 added to @3!=x@1 @2 aggiunto a @3!
@1 kits have been copied to @2!=I kit di @1 sono stati copiati in @2!
Nobody=Nessuno
Nobody must be in the editor!=Nessuno deve essere nell'editor!
Time is out, the match is over!=Tempo terminato, la partita è finita!
Time is out, the match is over!=Tempo terminato, la partita è finita!
@1 was killed by @2=@1 è stato ucciso da @2
@1 killed you with @2 HPs=@1 ti ha ucciso con @2 HP

View File

@ -27,7 +27,6 @@ You didn't set the chests!=
You didn't set the map corners!=
@1 must be disabled!=
@1 must be enabled!=
@1 was killed by @2=
@1 already exists!=
@1 added to @2!=
@1 removed from @2!=
@ -44,4 +43,6 @@ x@1 @2 added to @3!=
@1 kits have been copied to @2!=
Nobody=
Nobody must be in the editor!=
Time is out, the match is over!=
Time is out, the match is over!=
@1 was killed by @2=
@1 killed you with @2 HPs=