From 3bba8ade5cdafe3b43f4f671f6074771b61c6e4a Mon Sep 17 00:00:00 2001 From: div0 Date: Thu, 23 Oct 2008 09:18:57 +0000 Subject: [PATCH] fix handling of isolated CPs git-svn-id: svn://svn.icculus.org/nexuiz/trunk@4828 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/qcsrc/server/cl_client.qc | 7 ------ data/qcsrc/server/mode_onslaught.qc | 33 ++++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/data/qcsrc/server/cl_client.qc b/data/qcsrc/server/cl_client.qc index fd14899a5..33f603062 100644 --- a/data/qcsrc/server/cl_client.qc +++ b/data/qcsrc/server/cl_client.qc @@ -33,7 +33,6 @@ void spawnpoint_use() // Returns: // -1 if a spawn can't be used // otherwise, a weight of the spawnpoint -.float islinked; // onslaught float Spawn_Score(entity spot, entity playerlist, float teamcheck) { float shortest, thisdist; @@ -60,12 +59,6 @@ float Spawn_Score(entity spot, entity playerlist, float teamcheck) return -1; good = 1; } - else if(ent.classname == "onslaught_controlpoint") - { - if(!ent.islinked) - return -1; - good = 1; - } else if(ent.classname == "trigger_race_checkpoint") { if(self.classname == "player") // spectators may spawn everywhere diff --git a/data/qcsrc/server/mode_onslaught.qc b/data/qcsrc/server/mode_onslaught.qc index c4b474542..9f36f87d0 100644 --- a/data/qcsrc/server/mode_onslaught.qc +++ b/data/qcsrc/server/mode_onslaught.qc @@ -634,6 +634,7 @@ void onslaught_generator_reset() self.nextthink = time + 0.2; } +.float waslinked; void onslaught_controlpoint_icon_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force) { entity oself; @@ -680,16 +681,19 @@ void onslaught_controlpoint_icon_damage(entity inflictor, entity attacker, float // Use targets now (somebody make sure this is in the right place..) oself = self; self = self.owner; - activator = self.owner; + activator = self; SUB_UseTargets (); self = oself; + self.owner.waslinked = self.owner.islinked; + remove(self); } }; void onslaught_controlpoint_icon_think() { + entity oself; self.nextthink = time + 0.1; if (time > self.pain_finished + 1) { @@ -700,14 +704,41 @@ void onslaught_controlpoint_icon_think() self.alpha = self.health / self.max_health; // colormod flash when shot self.colormod = '1 1 1' * (2 - bound(0, (self.pain_finished - time) / 10, 1)); + + if(self.owner.islinked != self.owner.waslinked) + { + // unteam the spawnpoint if needed + float t; + t = self.owner.team; + if(!self.owner.islinked) + self.owner.team = 0; + + oself = self; + self = self.owner; + activator = self; + SUB_UseTargets (); + self = oself; + + self.owner.team = t; + + self.owner.waslinked = self.owner.islinked; + } }; void onslaught_controlpoint_icon_buildthink() { local entity oself; + float a; self.nextthink = time + 0.1; + + // only do this if there is power + a = onslaught_controlpoint_can_be_linked(self.owner, self.owner.team); + if(!a) + return; + self.health = self.health + self.count; + if (self.health >= self.max_health) { self.health = self.max_health; -- 2.39.2