5% chance spawn endermite after using ender pearl

This commit is contained in:
Wuzzy 2017-07-07 17:26:55 +02:00
parent 7d2ffe1c92
commit 1b7b43551e

View file

@ -251,9 +251,17 @@ local pearl_on_step = function(self, dtime)
end end
end end
local oldpos = player:getpos()
-- Teleport and hurt player
player:setpos(telepos) player:setpos(telepos)
player:set_hp(player:get_hp() - 5) player:set_hp(player:get_hp() - 5)
-- 5% chance to spawn endermite at the player's origin
local r = math.random(1,20)
if r == 1 then
minetest.add_entity(oldpos, "mobs_mc:endermite")
end
end end
self.object:remove() self.object:remove()
return return