diff --git a/api.lua b/api.lua index 6c20fe5..518f243 100644 --- a/api.lua +++ b/api.lua @@ -599,10 +599,10 @@ function mobs:register_mob(name, def) if self.type == "npc" and self.order == "follow" - and self.state ~= "attack" then + and self.state ~= "attack" + and self.owner ~= "" then -- npc stop following player if not owner if self.following - and self.type == "npc" and self.owner and self.owner ~= self.following:get_player_name() then self.following = nil @@ -1349,7 +1349,8 @@ function mobs:explosion(pos, radius, fire, smoke, sound) local n = minetest.get_node(p).name if minetest.get_item_group(n, "unbreakable") ~= 1 then -- if chest then drop items inside - if n == "default:chest" then + if n == "default:chest" + or n == "3dchest:chest" then local meta = minetest.get_meta(p) local inv = meta:get_inventory() for i = 1,32 do @@ -1500,7 +1501,9 @@ function mobs:register_arrow(name, def) end if self.hit_mob and player:get_luaentity().name ~= self.object:get_luaentity().name - and player:get_luaentity().name ~= "__builtin:item" then + and player:get_luaentity().name ~= "__builtin:item" + and player:get_luaentity().name ~= "gauges:hp_bar" + and player:get_luaentity().name ~= "signs:text" then self.hit_mob(self, player) self.object:remove() ; -- print ("hit mob") return @@ -1598,28 +1601,22 @@ end -- follow what I'm holding ? function follow_holding(self, clicker) local item = clicker:get_wielded_item() - local follow_item = false local t = type(self.follow) -- single item if t == "string" and item:get_name() == self.follow then - follow_item = true + return true -- multiple items elseif t == "table" then for no = 1, #self.follow do if self.follow[no] == item:get_name() then - follow_item = true + return true end end end - -- true if can eat/tame with item - if follow_item == true then - return true - end - return false end @@ -1628,24 +1625,6 @@ function mobs:feed_tame(self, clicker, feed_count, breed) if not self.follow then return false end - local item = clicker:get_wielded_item() - local follow_item = false - local t = type(self.follow) - - -- single item - if t == "string" - and item:get_name() == self.follow then - follow_item = true - - -- multiple items - elseif t == "table" then - for no = 1, #self.follow do - if self.follow[no] == item:get_name() then - follow_item = true - end - end - end - -- can eat/tame with item in hand if follow_holding(self, clicker) then --print ("mmm, tasty") diff --git a/init.lua b/init.lua index 296f641..4368883 100644 --- a/init.lua +++ b/init.lua @@ -33,6 +33,4 @@ dofile(path.."/npc.lua") -- TenPlus1 -- Mob Items dofile(path.."/crafts.lua") -if minetest.setting_get("log_mods") then - minetest.log("action", "mobs loaded") -end \ No newline at end of file +print ("[MOD] Mobs Redo loaded") \ No newline at end of file diff --git a/npc.lua b/npc.lua index 285f0ea..70434a0 100644 --- a/npc.lua +++ b/npc.lua @@ -76,7 +76,7 @@ mobs:register_mob("mobs:npc", { minetest.add_item(pos, { name = mobs.npc_drops[math.random(1, #mobs.npc_drops)] }) - + return else -- if owner switch between follow and stand if self.owner and self.owner == clicker:get_player_name() then