1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-24 17:50:37 +01:00

Added hunger level dicrease depending on armor

- Added basic skeleton for the system designed to dicrease hunger depending on the
   armor currently wore by the player. Values may be changed though
This commit is contained in:
LeMagnesium 2015-06-30 17:02:18 +02:00
parent a2b7be291f
commit feb969a08b
3 changed files with 67 additions and 1 deletions

View File

@ -386,6 +386,55 @@ if minetest.get_modpath("food") ~= nil then
end
-- player-action based hunger changes
local exhausting_items = {
["helmet"] = {
["wood"] = 0,
["cactus"] = 1,
["steel"] = 2,
["bronze"] = 4,
["gold"] = 7,
["diamond"] = 10,
["mithril"] = 15
},
["chestplate"] = {
["wood"] = 2,
["cactus"] = 4,
["steel"] = 6,
["bronze"] = 7,
["gold"] = 11,
["diamond"] = 15,
["mithril"] = 18
},
["leggings"] = {
["wood"] = 1,
["cactus"] = 2,
["steel"] = 5,
["bronze"] = 8,
["gold"] = 10,
["diamond"] = 13,
["mithril"] = 16
},
["boots"] = {
["wood"] = 1,
["cactus"] = 1,
["steel"] = 3,
["bronze"] = 4,
["gold"] = 7,
["diamond"] = 10,
["mithril"] = 13
},
["shield"] = {
["wood"] = 4,
["cactus"] = 6,
["steel"] = 8,
["bronze"] = 10,
["gold"] = 13,
["diamond"] = 16,
["mithril"] = 20
}
}
function hbhunger.handle_node_actions(pos, oldnode, player, ext)
if not player or not player:is_player() then
return
@ -403,6 +452,23 @@ function hbhunger.handle_node_actions(pos, oldnode, player, ext)
new = HUNGER_EXHAUST_MOVE
end
exhaus = exhaus + new
-- Armor's exhaus
if minetest.get_modpath("3d_armor") then
local name, inv, arminv, pos = armor:get_valid_player(player, "[exhaus]")
local armorinv = arminv:get_list("armor")
-- table.foreach(armorinv, print)
for index, stack in ipairs(armorinv) do
if stack:get_count() > 0 then
local itemname = stack:get_name():split(":")[2]:split("_")[1]
local itemmaterial = stack:get_name():split(":")[2]:split("_")[2]
exhaus = exhaus + (exhausting_items[itemname][itemmaterial] or 0)/10 -- 0 is admin armor
-- Value is divided by 5 to give a larger scale to our values, without having to high nor
-- too low exhausting factor
end
end
end
if exhaus > HUNGER_EXHAUST_LVL then
exhaus = 0
local h = tonumber(hbhunger.hunger[name])

0
mods/throwing/textures/throwing_bow_horn.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -5,7 +5,7 @@ News de FR - MinetestForFun (Survival - PVP - Hardcore)
/!\ En effet, nous profitons de cette stabilitée pour préparer une grosse MAJ qui boulversera à jamais le gameplay de Minetest /!\
---Next merge--- (Remerciements : ???)
MaJ de "3d_armor" (drop des armurs fixé)
MaJ de "3d_armor" (drop des armurs fixé, niveau de baisse de la faim dépendant des armures ajouté)
MaJ de "homedecor" (nouveaux panneaux colorés)
MaJ de "plantlife"
MaJ de "mesecons"