From 046204cf9a1544892070b1cf8991594f13ce0eaa Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Mon, 5 Sep 2016 18:39:17 +0100 Subject: Added attack_animals flag for monsters --- api.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'api.lua') diff --git a/api.lua b/api.lua index 6a73f60..19c61e7 100644 --- a/api.lua +++ b/api.lua @@ -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, -- cgit v1.2.3