From fe2bf3e82286bf77da1a9f2bd9a9faa994a6e9c6 Mon Sep 17 00:00:00 2001 From: LeMagnesium Date: Sun, 28 Jun 2015 14:12:31 +0200 Subject: [PATCH] Updated 3d_armor and fixed armors' drop - Fixed a mistake in code from @stujones11 repository about bones' drop : when the function assigned to minetest.after looks for bones, it first looks for a node. If there is a node, it looks for bones, if this node isn't bones, it just does nothing. Howevere, you're sure to get a node, because minetest.get_node will even return air and ignore, so, the else case, where every item is dropped, will never happen. --- mods/3d_armor/3d_armor/armor.lua | 22 ++++++++++------------ worlds/minetestforfun/news.txt | 1 + 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/mods/3d_armor/3d_armor/armor.lua b/mods/3d_armor/3d_armor/armor.lua index eca7beda..d7bad099 100755 --- a/mods/3d_armor/3d_armor/armor.lua +++ b/mods/3d_armor/3d_armor/armor.lua @@ -247,7 +247,7 @@ armor.update_armor = function(self, player, dtime) return end local hp = player:get_hp() or 0 - if ARMOR_FIRE_PROTECT == true then + if ARMOR_FIRE_PROTECT == true and dtime then pos.y = pos.y + 1.4 -- head level local node_head = minetest.get_node(pos).name pos.y = pos.y - 1.2 -- feet level @@ -596,17 +596,15 @@ if ARMOR_DROP == true or ARMOR_DESTROY == true then if ARMOR_DESTROY == false then minetest.after(ARMOR_BONES_DELAY, function() local node = minetest.get_node(vector.round(pos)) - if node then - if node.name == "bones:bones" then - local meta = minetest.get_meta(vector.round(pos)) - local owner = meta:get_string("owner") - local inv = meta:get_inventory() - for _,stack in ipairs(drop) do - if name == owner and inv:room_for_item("main", stack) then - inv:add_item("main", stack) - else - armor.drop_armor(pos, stack) - end + if node and node.name == "bones:bones" then + local meta = minetest.get_meta(vector.round(pos)) + local owner = meta:get_string("owner") + local inv = meta:get_inventory() + for _,stack in ipairs(drop) do + if name == owner and inv:room_for_item("main", stack) then + inv:add_item("main", stack) + else + armor.drop_armor(pos, stack) end end else diff --git a/worlds/minetestforfun/news.txt b/worlds/minetestforfun/news.txt index 19642787..4c109cbb 100755 --- a/worlds/minetestforfun/news.txt +++ b/worlds/minetestforfun/news.txt @@ -5,6 +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 "homedecor" (nouveaux panneaux colorés) MaJ de "plantlife" MaJ de "mesecons"