diff options
author | TenPlus1 <kinsellaja@yahoo.com> | 2016-09-05 18:39:17 +0100 |
---|---|---|
committer | TenPlus1 <kinsellaja@yahoo.com> | 2016-09-05 18:39:17 +0100 |
commit | 046204cf9a1544892070b1cf8991594f13ce0eaa (patch) | |
tree | c6268e95cf609948c7f5ec78cd823bcddbef8984 /api.lua | |
parent | c15ffef8ae30dd781f2ffbe933704e5e99b1e8c7 (diff) |
Added attack_animals flag for monsters
Diffstat (limited to 'api.lua')
-rw-r--r-- | api.lua | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -987,7 +987,8 @@ local monster_attack = function(self) local s = self.object:getpos() local p, sp, dist - local player, type, obj, min_player + local player, obj, min_player + local type = "" local min_dist = self.view_range + 1 local objs = minetest.get_objects_inside_radius(s, self.view_range) @@ -1012,7 +1013,8 @@ local monster_attack = function(self) end if type == "player" - or type == "npc" then + or type == "npc" + or (type == "animal" and self.attack_animals == true) then s = self.object:getpos() p = player:getpos() @@ -2323,6 +2325,7 @@ minetest.register_entity(name, { dogshoot_switch = def.dogshoot_switch, dogshoot_count = 0, dogshoot_count_max = def.dogshoot_count_max or 5, + attack_animals = def.attack_animals or false, on_blast = def.on_blast or do_tnt, |