diff --git a/api.lua b/api.lua index 89febcd..2eb6019 100644 --- a/api.lua +++ b/api.lua @@ -21,6 +21,8 @@ else end end end +local FS = function(...) return minetest.formspec_escape(S(...)) end + -- CMI support check local use_cmi = minetest.global_exists("cmi") @@ -34,8 +36,8 @@ local use_vh1 = minetest.get_modpath("visual_harm_1ndicators") -- Global mobs = { mod = "redo", - version = "20230816", - intllib = S, + version = "20230927", + translate = S, intllib = S, invis = minetest.global_exists("invisibility") and invisibility or {}, node_snow = minetest.registered_aliases["mapgen_snow"] or (use_mc2 and "mcl_core:snow") or "default:snow", @@ -1587,6 +1589,8 @@ function mob_class:breed() -- make sure baby is actually there if ent2 then + textures = self.base_texture + -- using specific child texture (if found) if self.child_texture then textures = self.child_texture[1] @@ -1675,8 +1679,7 @@ function mob_class:replace(pos) local newnode = with -- pass actual node name when using table or groups - if type(oldnode) == "table" - or oldnode:find("group:") then + if type(oldnode) == "table" or oldnode:find("group:") then oldnode = minetest.get_node(pos).name end @@ -2485,6 +2488,11 @@ function mob_class:do_states(dtime) self:set_velocity(0) self.state = "stand" self:set_animation("stand") + + -- try to turn so we are not stuck + yaw = yaw + random(-1, 1) * 1.5 + yaw = self:set_yaw(yaw, 4) + else self:set_velocity(self.run_velocity) self:set_animation("walk") @@ -3929,6 +3937,8 @@ function mobs:add_mob(pos, def) if not ent then --print("[mobs] entity not found " .. def.name) return false + else + effect(pos, 15, "tnt_smoke.png", 1, 2, 2, 15, 5) end if def.child then @@ -4762,7 +4772,6 @@ function mobs:feed_tame(self, clicker, feed_count, breed, tame) self.health = self.health + 4 if self.health >= self.hp_max then - self.health = self.hp_max end @@ -4821,8 +4830,7 @@ function mobs:feed_tame(self, clicker, feed_count, breed, tame) -- if mob has been tamed you can name it with a nametag if item:get_name() == "mobs:nametag" - and (name == self.owner - or minetest.check_player_privs(name, "protection_bypass")) then + and (name == self.owner or minetest.check_player_privs(name, "protection_bypass")) then -- store mob and nametag stack in external variables mob_obj[name] = self @@ -4831,13 +4839,9 @@ function mobs:feed_tame(self, clicker, feed_count, breed, tame) local tag = self.nametag or "" local esc = minetest.formspec_escape - minetest.show_formspec(name, "mobs_nametag", - "size[8,4]" .. - "field[0.5,1;7.5,0;name;" .. - esc(S("Enter name:")) .. - ";" .. tag .. "]" .. - "button_exit[2.5,3.5;3,1;mob_rename;" .. - esc(FS("Rename")) .. "]") + minetest.show_formspec(name, "mobs_nametag", "size[8,4]" + .. "field[0.5,1;7.5,0;name;" .. esc(FS("Enter name:")) .. ";" .. esc(tag) .. "]" + .. "button_exit[2.5,3.5;3,1;mob_rename;" .. esc(FS("Rename")) .. "]") return true end