mirror of
https://github.com/minetest-mods/3d_armor.git
synced 2024-12-27 11:10:39 +01:00
commit
1c56ee4bd6
@ -234,13 +234,13 @@ armor.set_player_armor = function(self, player)
|
|||||||
self:update_player_visuals(player)
|
self:update_player_visuals(player)
|
||||||
end
|
end
|
||||||
|
|
||||||
armor.update_armor = function(self, player, dtime)
|
armor.update_armor = function(self, player)
|
||||||
local name, player_inv, armor_inv, pos = armor:get_valid_player(player, "[update_armor]")
|
local name, player_inv, armor_inv, pos = armor:get_valid_player(player, "[update_armor]")
|
||||||
if not name then
|
if not name then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local hp = player:get_hp() or 0
|
local hp = player:get_hp() or 0
|
||||||
if ARMOR_FIRE_PROTECT == true and dtime then
|
if ARMOR_FIRE_PROTECT == true then
|
||||||
pos.y = pos.y + 1.4 -- head level
|
pos.y = pos.y + 1.4 -- head level
|
||||||
local node_head = minetest.get_node(pos).name
|
local node_head = minetest.get_node(pos).name
|
||||||
pos.y = pos.y - 1.2 -- feet level
|
pos.y = pos.y - 1.2 -- feet level
|
||||||
@ -250,7 +250,7 @@ armor.update_armor = function(self, player, dtime)
|
|||||||
-- check for fire protection, if not enough then get hurt
|
-- check for fire protection, if not enough then get hurt
|
||||||
if row[1] == node_head or row[1] == node_feet then
|
if row[1] == node_head or row[1] == node_feet then
|
||||||
if hp > 0 and armor.def[name].fire < row[2] then
|
if hp > 0 and armor.def[name].fire < row[2] then
|
||||||
hp = hp - row[3] * dtime
|
hp = hp - row[3] * ARMOR_UPDATE_TIME
|
||||||
player:set_hp(hp)
|
player:set_hp(hp)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
@ -590,7 +590,7 @@ minetest.register_globalstep(function(dtime)
|
|||||||
time = time + dtime
|
time = time + dtime
|
||||||
if time > ARMOR_UPDATE_TIME then
|
if time > ARMOR_UPDATE_TIME then
|
||||||
for _,player in ipairs(minetest.get_connected_players()) do
|
for _,player in ipairs(minetest.get_connected_players()) do
|
||||||
armor:update_armor(player, time)
|
armor:update_armor(player)
|
||||||
end
|
end
|
||||||
time = 0
|
time = 0
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user