movelib_move_simple_gravity(v_forward, ((self.enemy) ? runspeed : walkspeed), 0.6);
if(time > self.pain_finished)
if(time > self.attack_finished_single)
+ if(vlen(self.velocity) > 0)
monsters_setframe((self.enemy) ? manim_run : manim_walk);
+ else
+ monsters_setframe(manim_idle);
}
else
{
{
case MR_THINK:
{
- monster_move(MON_CVAR(bruiser, speed_run), MON_CVAR(bruiser, speed_walk), MON_CVAR(bruiser, speed_stop), bruiser_anim_run, bruiser_anim_walk, bruiser_anim_stand);
+ entity pet = world;
+ pet = findentity(pet, monster_owner, self);
+ float rspeed = MON_CVAR(bruiser, speed_run);
+
+ if(pet)
+ if(self.enemy)
+ if(vlen(self.enemy.origin - pet.origin) < vlen(self.enemy.origin - self.origin))
+ rspeed = 0;
+
+ monster_move(rspeed, MON_CVAR(bruiser, speed_walk), MON_CVAR(bruiser, speed_stop), bruiser_anim_run, bruiser_anim_walk, bruiser_anim_stand);
return TRUE;
}
case MR_DEATH:
const float cerberus_anim_die = 4;
const float cerberus_anim_pain = 5;
+.float cerberus_last_trace;
+
+void cerberus_findowner()
+{
+ if(time < self.cerberus_last_trace || self.monster_owner)
+ return;
+
+ entity head;
+
+ FOR_EACH_MONSTER(head)
+ if(head.health > 0)
+ if(head.monsterid == MON_BRUISER)
+ if(findentity(world, monster_owner, head) == world)
+ if(vlen(head.origin - self.origin) < self.target_range)
+ if(!IsDifferentTeam(head, self))
+ if(head.enemy == world)
+ {
+ self.monster_owner = head;
+ break;
+ }
+
+ self.cerberus_last_trace = time + 3;
+}
+
+void cerberus_checkowner()
+{
+ if(time < self.cerberus_last_trace)
+ return;
+
+ if(vlen(self.origin - self.monster_owner.origin) > self.target_range)
+ self.monster_owner = world;
+ if(self.monster_owner.health < 1)
+ self.monster_owner = world;
+ if(IsDifferentTeam(self.monster_owner, self))
+ self.monster_owner = world;
+
+ self.cerberus_last_trace = time + 3;
+}
+
void cerberus_touch_jump()
{
if (other.takedamage)
{
case MR_THINK:
{
+ if(self.monster_owner)
+ cerberus_checkowner();
+ else
+ cerberus_findowner();
monster_move(MON_CVAR(cerberus, speed_run), MON_CVAR(cerberus, speed_walk), MON_CVAR(cerberus, speed_stop), cerberus_anim_run, cerberus_anim_walk, cerberus_anim_idle);
return TRUE;
}
case MR_DEATH:
{
+ if(self.monster_owner.flags & FL_MONSTER)
+ self.monster_owner = world;
monsters_setframe(cerberus_anim_die);
return TRUE;
}