mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-12-25 19:02:26 +01:00
Merge pull request 'More burning HUD fixes (kabou)' (#2076) from fix-burning-hud into master
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2076
This commit is contained in:
commit
81a1b9973a
@ -131,17 +131,6 @@ function mcl_burning.set_on_fire(obj, burn_time)
|
||||
if obj:is_player() then
|
||||
mcl_burning.update_hud(obj)
|
||||
end
|
||||
|
||||
-- FIXME: does this code make sense? It removes attached fire luaentities from
|
||||
-- another object that happen to be at the same position.
|
||||
local fire_luaentity = fire_entity:get_luaentity()
|
||||
for _, other in pairs(minetest.get_objects_inside_radius(fire_entity:get_pos(), 0)) do
|
||||
local other_luaentity = other:get_luaentity()
|
||||
if other_luaentity and other_luaentity.name == "mcl_burning:fire" and other_luaentity ~= fire_luaentity then
|
||||
other:remove()
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function mcl_burning.extinguish(obj)
|
||||
|
@ -57,7 +57,7 @@ minetest.register_on_joinplayer(function(player)
|
||||
local storage = {}
|
||||
local burn_data = player:get_meta():get_string("mcl_burning:data")
|
||||
if burn_data ~= "" then
|
||||
storage = minetest.deserialize(burn_data)
|
||||
storage = minetest.deserialize(burn_data) or storage
|
||||
end
|
||||
mcl_burning.storage[player] = storage
|
||||
if storage.burn_time and storage.burn_time > 0 then
|
||||
@ -98,8 +98,7 @@ minetest.register_entity("mcl_burning:fire", {
|
||||
glow = -1,
|
||||
backface_culling = false,
|
||||
},
|
||||
animation_frame = 0,
|
||||
animation_timer = 0,
|
||||
_mcl_animation_timer = 0,
|
||||
on_activate = function(self)
|
||||
self.object:set_sprite({x = 0, y = 0}, animation_frames, 1.0 / animation_frames)
|
||||
end,
|
||||
@ -115,9 +114,9 @@ minetest.register_entity("mcl_burning:fire", {
|
||||
return
|
||||
end
|
||||
if parent:is_player() then
|
||||
self.animation_timer = self.animation_timer + dtime
|
||||
if self.animation_timer >= 0.1 then
|
||||
self.animation_timer = 0
|
||||
self._mcl_animation_timer = self._mcl_animation_timer + dtime
|
||||
if self._mcl_animation_timer >= 0.1 then
|
||||
self._mcl_animation_timer = 0
|
||||
mcl_burning.update_hud(parent)
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user