From e9ff2ba32a356ddf3f29c744e465d433f613b3ed Mon Sep 17 00:00:00 2001 From: kabou Date: Thu, 3 Mar 2022 09:38:59 +0100 Subject: [PATCH] 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. --- mods/ENTITIES/mcl_burning/api.lua | 2 ++ mods/ENTITIES/mcl_burning/init.lua | 9 ++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/mods/ENTITIES/mcl_burning/api.lua b/mods/ENTITIES/mcl_burning/api.lua index 8093d45f98..3fcc7778f7 100644 --- a/mods/ENTITIES/mcl_burning/api.lua +++ b/mods/ENTITIES/mcl_burning/api.lua @@ -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) diff --git a/mods/ENTITIES/mcl_burning/init.lua b/mods/ENTITIES/mcl_burning/init.lua index 62bf3f69a9..5ffc804a1a 100644 --- a/mods/ENTITIES/mcl_burning/init.lua +++ b/mods/ENTITIES/mcl_burning/init.lua @@ -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