Minor changes to mcl_burning.

* Remove animation_frame from fire entity state, it is now kept in the
  storage table of the parent entity.
* Rename animation_timer in fire entity table to _mcl_animation_timer,
  in line with mineclone2 policy on adding custom members to minetest
  tables.
* Comment out code that does nothing sensible.  Scheduled for deletion
  at a later time.
This commit is contained in:
kabou 2022-03-03 09:38:59 +01:00 committed by cora
parent 0b89149fe2
commit e9ff2ba32a
2 changed files with 6 additions and 5 deletions

View file

@ -132,6 +132,7 @@ function mcl_burning.set_on_fire(obj, burn_time)
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()
@ -142,6 +143,7 @@ function mcl_burning.set_on_fire(obj, burn_time)
break
end
end
]]--
end
function mcl_burning.extinguish(obj)

View file

@ -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