From b512f882e9ba3d255117aa3f4c00c5fb5e6a426f Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Mon, 25 Apr 2016 20:23:38 +0100 Subject: Disable lifetimer if remove_far_mobs is true, despawn distance set to 15 --- api.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'api.lua') diff --git a/api.lua b/api.lua index 292a847..3c8bcf4 100644 --- a/api.lua +++ b/api.lua @@ -1,5 +1,5 @@ --- Mobs Api (16th April 2016) +-- Mobs Api (25th April 2016) mobs = {} mobs.mod = "redo" @@ -1977,14 +1977,15 @@ local mob_step = function(self, dtime) -- when lifetimer expires remove mob (except npc and tamed) if self.type ~= "npc" and not self.tamed - and self.state ~= "attack" then + and self.state ~= "attack" + and remove_far ~= true then self.lifetimer = self.lifetimer - dtime if self.lifetimer <= 0 then -- only despawn away from player - local objs = minetest.get_objects_inside_radius(pos, 10) + local objs = minetest.get_objects_inside_radius(pos, 15) for _,oir in pairs(objs) do -- cgit v1.2.3