From c2eae4ee28cae9c575b4c0f3ce6229e0d2b437f0 Mon Sep 17 00:00:00 2001 From: fruitiex Date: Sat, 16 Jan 2010 10:30:43 +0000 Subject: [PATCH] FINALLY a fix to the cursed defrag checkpoint bug preventing two players from hitting a checkpoint simultaneously. git-svn-id: svn://svn.icculus.org/nexuiz/trunk@8503 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/qcsrc/server/race.qc | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/data/qcsrc/server/race.qc b/data/qcsrc/server/race.qc index 9aa032fa6..0415bccce 100644 --- a/data/qcsrc/server/race.qc +++ b/data/qcsrc/server/race.qc @@ -1,5 +1,7 @@ #define MAX_CHECKPOINTS 255 +void spawnfunc_target_checkpoint(); + .float race_penalty; .float race_penalty_accumulator; .string race_penalty_reason; @@ -787,12 +789,6 @@ void trigger_race_checkpoint_verify() race_highest_checkpoint = 255; race_timed_checkpoint = 255; } - entity targ; - for(targ = world; (targ = find(targ, target, self.targetname)); ) - if (targ.classname == "trigger_multiple") { - targ.wait = -2; // still needs investigating, why cant two players pass a (defrag) checkpoint at the same time? - targ.delay = 0; - } } else { for(cp = world; (cp = find(cp, classname, "trigger_race_checkpoint")); ) @@ -806,6 +802,19 @@ void trigger_race_checkpoint_verify() } } + if(defrag_ents) { + entity trigger, targ; + for(trigger = world; (trigger = find(trigger, classname, "trigger_multiple")); ) + for(targ = world; (targ = find(targ, targetname, trigger.target)); ) + if (targ.classname == "target_checkpoint" || targ.classname == "target_startTimer" || targ.classname == "target_stopTimer") { + targ.wait = -2; + targ.delay = 0; + + setsize(targ, trigger.mins, trigger.maxs); + setorigin(targ, trigger.origin); + remove(trigger); + } + } remove(self); self = oldself; } @@ -874,8 +883,8 @@ void spawnfunc_target_checkpoint() // defrag entity EXACTTRIGGER_INIT; self.use = checkpoint_use; - //if not(self.spawnflags & 1) - // self.touch = checkpoint_touch; + if not(self.spawnflags & 1) + self.touch = checkpoint_touch; o = (self.absmin + self.absmax) * 0.5; tracebox(o, PL_MIN, PL_MAX, o - '0 0 1' * (o_z - self.absmin_z), MOVE_NORMAL, self); -- 2.39.2