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
|
if obj:is_player() then
|
||||||
mcl_burning.update_hud(obj)
|
mcl_burning.update_hud(obj)
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
function mcl_burning.extinguish(obj)
|
function mcl_burning.extinguish(obj)
|
||||||
|
|
|
@ -57,7 +57,7 @@ minetest.register_on_joinplayer(function(player)
|
||||||
local storage = {}
|
local storage = {}
|
||||||
local burn_data = player:get_meta():get_string("mcl_burning:data")
|
local burn_data = player:get_meta():get_string("mcl_burning:data")
|
||||||
if burn_data ~= "" then
|
if burn_data ~= "" then
|
||||||
storage = minetest.deserialize(burn_data)
|
storage = minetest.deserialize(burn_data) or storage
|
||||||
end
|
end
|
||||||
mcl_burning.storage[player] = storage
|
mcl_burning.storage[player] = storage
|
||||||
if storage.burn_time and storage.burn_time > 0 then
|
if storage.burn_time and storage.burn_time > 0 then
|
||||||
|
@ -98,8 +98,7 @@ minetest.register_entity("mcl_burning:fire", {
|
||||||
glow = -1,
|
glow = -1,
|
||||||
backface_culling = false,
|
backface_culling = false,
|
||||||
},
|
},
|
||||||
animation_frame = 0,
|
_mcl_animation_timer = 0,
|
||||||
animation_timer = 0,
|
|
||||||
on_activate = function(self)
|
on_activate = function(self)
|
||||||
self.object:set_sprite({x = 0, y = 0}, animation_frames, 1.0 / animation_frames)
|
self.object:set_sprite({x = 0, y = 0}, animation_frames, 1.0 / animation_frames)
|
||||||
end,
|
end,
|
||||||
|
@ -115,9 +114,9 @@ minetest.register_entity("mcl_burning:fire", {
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if parent:is_player() then
|
if parent:is_player() then
|
||||||
self.animation_timer = self.animation_timer + dtime
|
self._mcl_animation_timer = self._mcl_animation_timer + dtime
|
||||||
if self.animation_timer >= 0.1 then
|
if self._mcl_animation_timer >= 0.1 then
|
||||||
self.animation_timer = 0
|
self._mcl_animation_timer = 0
|
||||||
mcl_burning.update_hud(parent)
|
mcl_burning.update_hud(parent)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user