From c173345135a1dd699b0984a12ef2bb12f94087e4 Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Thu, 5 Oct 2023 11:54:44 +0100 Subject: [PATCH] use self.backup_properties instead of self.initial_properties --- api.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/api.lua b/api.lua index a3940b2..2bb08ee 100644 --- a/api.lua +++ b/api.lua @@ -11,7 +11,7 @@ local use_mc2 = minetest.get_modpath("mcl_core") -- Global mobs = { mod = "redo", - version = "20231004", + version = "20231005", translate = S, invis = minetest.global_exists("invisibility") and invisibility or {}, node_snow = minetest.registered_aliases["mapgen_snow"] @@ -3137,10 +3137,11 @@ function mob_class:mob_staticdata() self.serialized_cmi_components = cmi.serialize_components(self._cmi_components) end - -- move existing variables to new initial_properties table for future compatibility - if not self.initial_properties then + -- move existing variables to new table for future compatibility + -- using self.initial_properties lost some variables when backing up?!? + if not self.backup_properties then - self.initial_properties = { + self.backup_properties = { hp_max = self.hp_max, physical = self.physical, collisionbox = self.collisionbox, @@ -4706,7 +4707,7 @@ function mobs:feed_tame(self, clicker, feed_count, breed, tame) if self.child == true then -- deduct 10% of the time to adulthood - self.hornytimer = math.floor(self.hornytimer + ( + self.hornytimer = floor(self.hornytimer + ( (CHILD_GROW_TIME - self.hornytimer) * 0.1)) --print ("====", self.hornytimer) return true @@ -4728,6 +4729,7 @@ function mobs:feed_tame(self, clicker, feed_count, breed, tame) if tame then if self.tamed == false then + minetest.chat_send_player(clicker:get_player_name(), S("@1 has been tamed!", self.name:split(":")[2]))