1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-11-15 23:10:31 +01:00

added group_attack in cow,goat,warthog and npc

added group attack if not tamed and type(name) identical
fixed crash if unknow node in function env_damage
This commit is contained in:
crabman77 2015-07-22 00:11:38 +02:00
parent 69ce8e8266
commit 1020b080aa
5 changed files with 8 additions and 1 deletions

View File

@ -317,6 +317,7 @@ function mobs:register_mob(name, def)
local nod = minetest.get_node_or_nil(pos)
if not nod then return end ; -- print ("standing in "..nod.name)
local nodef = minetest.registered_nodes[nod.name]
if not nodef then return end
pos.y = pos.y + 1
-- water
@ -1185,8 +1186,10 @@ end
local obj = nil
for _, oir in pairs(minetest.get_objects_inside_radius(hitter:getpos(), 5)) do
obj = oir:get_luaentity()
if obj then
if obj
and obj.name == self.name then
if obj.group_attack == true
and not obj.tamed
and obj.state ~= "attack" then
obj.do_attack(obj, hitter, 1)
end

View File

@ -6,6 +6,7 @@ mobs:register_mob("mobs:cow", {
type = "animal",
-- aggressive, does 5 damage to player when threatened
passive = false,
group_attack = true,
attack_type = "dogfight",
damage = 4,
-- health & armor

View File

@ -6,6 +6,7 @@ mobs:register_mob("mobs:goat", {
type = "animal",
-- aggressive, does 5 damage to player when threatened
passive = false,
group_attack = true,
attack_type = "dogfight",
damage = 4,
-- health & armor

View File

@ -13,6 +13,7 @@ mobs:register_mob("mobs:npc", {
type = "npc",
-- aggressive, deals 6 damage to player/monster when hit
passive = false,
group_attack = true,
damage = 5, -- 3 damages if tamed
attack_type = "dogfight",
attacks_monsters = true,

View File

@ -6,6 +6,7 @@ mobs:register_mob("mobs:pumba", {
type = "animal",
-- aggressive, deals 5 damage to player when threatened
passive = false,
group_attack = true,
attack_type = "dogfight",
damage = 4,
-- health & armor