Don't flood the world with items
parent
dfc48840a3
commit
37e02ac334
7
init.lua
7
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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue