From: Mircea Kitsune Date: Mon, 4 Oct 2010 13:58:10 +0000 (+0300) Subject: Attempt to implement friend protection (the mine not exploding if it would hurt the... X-Git-Tag: xonotic-v0.1.0preview~307^2~33^2~26 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e5fe3cb67ad3830ca01c73410ae46f5b8259f4f0;p=xonotic%2Fxonotic-data.pk3dir.git Attempt to implement friend protection (the mine not exploding if it would hurt the owner or a team mate). Not ready yet. --- diff --git a/qcsrc/server/w_minelayer.qc b/qcsrc/server/w_minelayer.qc index 3127a8169..d03ae635e 100644 --- a/qcsrc/server/w_minelayer.qc +++ b/qcsrc/server/w_minelayer.qc @@ -98,10 +98,16 @@ void W_Mine_Think (void) return; } - // detect players who are close the mine and explode if the player should detonate it + // remote detonation + if (self.owner.weapon == WEP_MINE_LAYER) + if (self.owner.deadflag == DEAD_NO) + if (self.minelayer_detonate) + W_Mine_RemoteExplode(); + entity head; - head = findradius(self.origin, cvar("g_balance_minelayer_detectionradius")); + // detect players who are close to the mine and explode if anyone should detonate it + head = findradius(self.origin, cvar("g_balance_minelayer_detectionradius")); while(head) { if(head.classname == "player" && head.deadflag == DEAD_NO) @@ -112,22 +118,25 @@ void W_Mine_Think (void) spamsound (self, CHAN_PROJECTILE, "weapons/mine_trigger.wav", VOL_BASE, ATTN_NORM); self.mine_time = time + cvar("g_balance_minelayer_time"); } + head = head.chain; } - // explode if it's time + // if it's time for the mine to explode, make sure no friend is in its radius + // if an ally is detected, the explosion is delayed until he's at a safe distance if(self.mine_time && time >= self.mine_time) { + head = findradius(self.origin, cvar("g_balance_minelayer_radius")); + while(head) + { + if(head == self.owner || !IsDifferentTeam(head, self.owner)) + return; + head = head.chain; + } self.mine_time = 0; W_Mine_Explode(); } - // remote detonation - if (self.owner.weapon == WEP_MINE_LAYER) - if (self.owner.deadflag == DEAD_NO) - if (self.minelayer_detonate) - W_Mine_RemoteExplode(); - if(self.csqcprojectile_clientanimate == 0) UpdateCSQCProjectile(self); }