1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-25 02:00:37 +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) local nod = minetest.get_node_or_nil(pos)
if not nod then return end ; -- print ("standing in "..nod.name) if not nod then return end ; -- print ("standing in "..nod.name)
local nodef = minetest.registered_nodes[nod.name] local nodef = minetest.registered_nodes[nod.name]
if not nodef then return end
pos.y = pos.y + 1 pos.y = pos.y + 1
-- water -- water
@ -1185,8 +1186,10 @@ end
local obj = nil local obj = nil
for _, oir in pairs(minetest.get_objects_inside_radius(hitter:getpos(), 5)) do for _, oir in pairs(minetest.get_objects_inside_radius(hitter:getpos(), 5)) do
obj = oir:get_luaentity() obj = oir:get_luaentity()
if obj then if obj
and obj.name == self.name then
if obj.group_attack == true if obj.group_attack == true
and not obj.tamed
and obj.state ~= "attack" then and obj.state ~= "attack" then
obj.do_attack(obj, hitter, 1) obj.do_attack(obj, hitter, 1)
end end

View File

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

View File

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

View File

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

View File

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