Added attack_animals flag for monsters

master
TenPlus1 2016-09-05 18:39:17 +01:00
parent c15ffef8ae
commit 046204cf9a
3 changed files with 3026 additions and 3 deletions

View File

@ -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,

View File

@ -1,5 +1,5 @@
MOB API (23rd May 2016)
MOB API (5th September 2016)
The mob api is a function that can be called on by other mods to add new animals or monsters into minetest.
@ -24,6 +24,7 @@ This functions registers a new mob as a Minetest entity.
'docile_by_day' when true, mob will not attack during daylight hours unless provoked
'attacks_monsters' usually for npc's to attack monsters in area
'group_attack' true to defend same kind of mobs from attack in area
'attack_animals' true for monster to attack animals as well as player and npc's
'hp_min' minimum health
'hp_max' maximum health (mob health is randomly selected between both)
'physical' same is in minetest.register_entity()

3019
api_bak.lua Normal file

File diff suppressed because it is too large Load Diff