From: Mario Date: Thu, 29 Aug 2013 10:46:12 +0000 (+1000) Subject: Fix monsters attacking their owners in non-teamplay modes X-Git-Tag: xonotic-v0.8.0~241^2^2~143 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b8b6754929463ba6e39ed2f63355efde5a740c36;p=xonotic%2Fxonotic-data.pk3dir.git Fix monsters attacking their owners in non-teamplay modes --- diff --git a/qcsrc/common/monsters/lib/monsters.qc b/qcsrc/common/monsters/lib/monsters.qc index af7172718..4abf318dc 100644 --- a/qcsrc/common/monsters/lib/monsters.qc +++ b/qcsrc/common/monsters/lib/monsters.qc @@ -86,9 +86,12 @@ float monster_isvalidtarget (entity targ, entity ent) if not(targ.vehicle_flags & VHF_ISVEHICLE) // vehicles dont count as alive? if(targ.deadflag != DEAD_NO || ent.deadflag != DEAD_NO || targ.health <= 0 || ent.health <= 0) return FALSE; // enemy/self is dead - - if(targ.monster_owner == ent || ent.monster_owner == targ) - return FALSE; // enemy owns us, or we own them + + if(ent.monster_owner == targ) + return FALSE; // don't attack our master + + if(targ.monster_owner == ent) + return FALSE; // don't attack our pet if not(targ.vehicle_flags & VHF_ISVEHICLE) if(targ.flags & FL_NOTARGET) @@ -515,7 +518,9 @@ void monster_move(float runspeed, float walkspeed, float stopspeed, float manim_ targ = monster_target; runspeed = monster_speed_run; walkspeed = monster_speed_walk; - + + if(teamplay) + if(autocvar_g_monsters_teams) if(IsDifferentTeam(self.monster_owner, self)) self.monster_owner = world; diff --git a/qcsrc/common/monsters/monster/cerberus.qc b/qcsrc/common/monsters/monster/cerberus.qc index afbf3aced..689f04254 100644 --- a/qcsrc/common/monsters/monster/cerberus.qc +++ b/qcsrc/common/monsters/monster/cerberus.qc @@ -57,6 +57,8 @@ void cerberus_checkowner() { if(time < self.cerberus_last_trace) return; + if(IS_PLAYER(self.monster_owner)) + return; // don't check player masters if(vlen(self.origin - self.monster_owner.origin) > self.target_range) self.monster_owner = world;