forked from Mineclonia/Mineclonia
Fix group attack for slime, zombie and zombiepig
This commit is contained in:
parent
f3b4c56772
commit
47ef78bf6a
|
@ -2569,12 +2569,20 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
|
||||||
|
|
||||||
if obj then
|
if obj then
|
||||||
|
|
||||||
-- only alert members of same mob
|
-- only alert members of same mob or friends
|
||||||
if obj.group_attack == true
|
if obj.group_attack
|
||||||
and obj.state ~= "attack"
|
and obj.state ~= "attack"
|
||||||
and obj.owner ~= name
|
and obj.owner ~= name then
|
||||||
and obj.name == self.name then
|
if obj.name == self.name then
|
||||||
do_attack(obj, hitter)
|
do_attack(obj, hitter)
|
||||||
|
elseif type(obj.group_attack) == "table" then
|
||||||
|
for i=1, #obj.group_attack do
|
||||||
|
if obj.name == obj.group_attack[i] then
|
||||||
|
do_attack(obj, hitter)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- have owned mobs attack player threat
|
-- have owned mobs attack player threat
|
||||||
|
|
|
@ -78,6 +78,8 @@ functions needed for the mob to work properly which contains the following:
|
||||||
punches when nearby.
|
punches when nearby.
|
||||||
'group_attack' when true has same mob type grouping together to attack
|
'group_attack' when true has same mob type grouping together to attack
|
||||||
offender.
|
offender.
|
||||||
|
[MCL2 extension:] When a table, this is a list of
|
||||||
|
mob types that will get alerted as well (besides same mob type)
|
||||||
'attack_type' tells the api what a mob does when attacking the player
|
'attack_type' tells the api what a mob does when attacking the player
|
||||||
or another mob:
|
or another mob:
|
||||||
'dogfight' is a melee attack when player is within mob reach.
|
'dogfight' is a melee attack when player is within mob reach.
|
||||||
|
@ -222,6 +224,7 @@ functions needed for the mob to work properly which contains the following:
|
||||||
'glow' same as in entity definition
|
'glow' same as in entity definition
|
||||||
'child' if true, spawn mob as child
|
'child' if true, spawn mob as child
|
||||||
|
|
||||||
|
|
||||||
Node Replacement
|
Node Replacement
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ end
|
||||||
local slime_big = {
|
local slime_big = {
|
||||||
type = "monster",
|
type = "monster",
|
||||||
pathfinding = 1,
|
pathfinding = 1,
|
||||||
group_attack = true,
|
group_attack = { "mobs_mc:slime_big", "mobs_mc:slime_small", "mobs_mc:slime_tiny" },
|
||||||
hp_min = 16,
|
hp_min = 16,
|
||||||
hp_max = 16,
|
hp_max = 16,
|
||||||
collisionbox = {-1.02, -0.01, -1.02, 1.02, 2.03, 1.02},
|
collisionbox = {-1.02, -0.01, -1.02, 1.02, 2.03, 1.02},
|
||||||
|
|
|
@ -65,8 +65,8 @@ local zombie = {
|
||||||
fear_height = 4,
|
fear_height = 4,
|
||||||
pathfinding = 1,
|
pathfinding = 1,
|
||||||
jump = true,
|
jump = true,
|
||||||
--jump_height = 3,
|
jump_height = 4,
|
||||||
group_attack = true,
|
group_attack = { "mobs_mc:zombie", "mobs_mc:baby_zombie", "mobs_mc:husk", "mobs_mc:baby_husk" },
|
||||||
drops = drops_zombie,
|
drops = drops_zombie,
|
||||||
animation = {
|
animation = {
|
||||||
speed_normal = 25, speed_run = 50,
|
speed_normal = 25, speed_run = 50,
|
||||||
|
@ -75,7 +75,6 @@ local zombie = {
|
||||||
run_start = 0, run_end = 40,
|
run_start = 0, run_end = 40,
|
||||||
},
|
},
|
||||||
lava_damage = 4,
|
lava_damage = 4,
|
||||||
-- TODO: Burn mob only when in direct sunlight
|
|
||||||
sunlight_damage = 2,
|
sunlight_damage = 2,
|
||||||
view_range = 16,
|
view_range = 16,
|
||||||
attack_type = "dogfight",
|
attack_type = "dogfight",
|
||||||
|
|
|
@ -18,7 +18,7 @@ local pigman = {
|
||||||
hp_max = 20,
|
hp_max = 20,
|
||||||
armor = 90,
|
armor = 90,
|
||||||
attack_type = "dogfight",
|
attack_type = "dogfight",
|
||||||
group_attack = true,
|
group_attack = { "mobs_mc:pigman", "mobs_mc:baby_pigman" },
|
||||||
damage = 9,
|
damage = 9,
|
||||||
reach = 2,
|
reach = 2,
|
||||||
collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.94, 0.3},
|
collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.94, 0.3},
|
||||||
|
|
Loading…
Reference in New Issue