Support for only_peaceful_mobs setting in minetest.conf

master
PilzAdam 2012-09-22 12:47:52 +02:00
parent 4c9d02d417
commit 5dffc85eeb
1 changed files with 7 additions and 0 deletions

View File

@ -48,6 +48,10 @@ function mobs:register_mob(name, def)
end,
on_step = function(self, dtime)
if self.type == "monster" and minetest.setting_getbool("only_peaceful_mobs") then
self.object:remove()
end
if self.object:getvelocity().y > 0.1 then
local yaw = self.object:getyaw()
if self.drawtype == "side" then
@ -281,6 +285,9 @@ function mobs:register_mob(name, def)
self.state = "stand"
self.object:setvelocity({x=0, y=self.object:getvelocity().y, z=0})
self.object:setyaw(math.random(1, 360)/180*math.pi)
if self.type == "hostile" and minetest.setting_getbool("only_peaceful_mobs") then
self.object:remove()
end
end,
on_punch = function(self, hitter)