diff --git a/init.lua b/init.lua index b58adb4..662ddcc 100644 --- a/init.lua +++ b/init.lua @@ -7,6 +7,13 @@ creatures.ANIM_WALK = 4 creatures.ANIM_EAT = 5 creatures.ANIM_RUN = 6 +-- Drop items (when not killed by player) only if items get removed +creatures.drop_on_death = false +local remove_items = minetest.setting_get("remove_items") +if minetest.get_modpath("builtin_item") ~= nil and remove_items ~= nil and remove_items > 0 then + creatures.drop_on_death = true +end + -- spawning controls (experimental) creatures.spawned = {} local spawn_day = 600 diff --git a/sheep.lua b/sheep.lua index 408d945..d9af8aa 100644 --- a/sheep.lua +++ b/sheep.lua @@ -202,7 +202,7 @@ SHEEP_DEF.on_step = function(self, dtime) minetest.sound_play(s_sound_dead, {pos = current_pos, max_hear_distance = 10, gain = 0.9}) self.object:set_animation({x=self.anim.lay_START,y=self.anim.lay_END}, s_animation_speed, 0) minetest.after(1, function() - if self.has_wool then + if self.has_wool and creatures.drop_on_death then local obj = minetest.env:add_item(current_pos, s_drop) end self.object:remove() diff --git a/zombie.lua b/zombie.lua index afc5def..7c8ba71 100644 --- a/zombie.lua +++ b/zombie.lua @@ -170,7 +170,7 @@ ZOMBIE_DEF.on_step = function(self, dtime) self.object:set_animation({x=self.anim.lay_START,y=self.anim.lay_END}, z_animation_speed, 0) minetest.after(1, function() self.object:remove() - if self.object:get_hp() < 1 then + if self.object:get_hp() < 1 and creatures.drop_on_death then creatures.drop(current_pos, {{name=z_drop, count=math.random(0,2)}}) end end)