]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Implement rudimentary target_score and target_fragsFilter entities for Quake 3 defrag...
authorMario <zacjardine@y7mail.com>
Sun, 16 Sep 2018 04:33:46 +0000 (14:33 +1000)
committerMario <zacjardine@y7mail.com>
Sun, 16 Sep 2018 04:33:46 +0000 (14:33 +1000)
qcsrc/server/client.qc
qcsrc/server/compat/quake3.qc
qcsrc/server/compat/quake3.qh

index ccaf3c0fa92b864d2c7e7f90d6f5cea670bb53bc..da0d84979f5e139531a89f86f410184b51ea7759 100644 (file)
@@ -32,6 +32,8 @@
 #include "../common/wepent.qh"
 #include <common/state.qh>
 
+#include "compat/quake3.qh"
+
 #include <common/effects/qc/globalsound.qh>
 
 #include "../common/mapobjects/func/conveyor.qh"
@@ -707,6 +709,7 @@ void PutPlayerInServer(entity this)
        this.speedrunning = false;
 
        this.counter_cnt = 0;
+       this.fragsfilter_cnt = 0;
 
        target_voicescript_clear(this);
 
index c85034b840947e3f1b71f93ac647f6176fc8cb47..db73a20c725c32347af1bd0f7b3047b876d8a105 100644 (file)
@@ -184,12 +184,35 @@ spawnfunc(target_give)
        InitializeEntity(this, target_give_init, INITPRIO_FINDTARGET);
 }
 
+void score_use(entity this, entity actor, entity trigger)
+{
+       if(!IS_PLAYER(actor))
+               return;
+       actor.fragsfilter_cnt += this.count;
+}
+spawnfunc(target_score)
+{
+       if(!g_cts) { delete(this); return; }
+
+       if(!this.count)
+               this.count = 1;
+       this.use = score_use;
+}
 
+void fragsfilter_use(entity this, entity actor, entity trigger)
+{
+       if(!IS_PLAYER(actor))
+               return;
+       if(actor.fragsfilter_cnt == this.frags)
+               SUB_UseTargets(this, actor, trigger);
+}
 spawnfunc(target_fragsFilter)
 {
-       this.spawnflags |= COUNTER_PER_PLAYER;
-       this.count = this.frags;
-       spawnfunc_trigger_counter(this);
+       if(!g_cts) { delete(this); return; }
+
+       if(!this.frags)
+               this.frags = 1;
+       this.use = fragsfilter_use;
 }
 
 //spawnfunc(item_flight)       /* handled by buffs mutator */
index 342a829a187b12daa84a0b532bc0269aca79c16b..20e4879d9a37596290a2a24258a7d69db623e21a 100644 (file)
@@ -1,3 +1,5 @@
 #pragma once
 
 bool DoesQ3ARemoveThisEntity(entity this);
+
+.int fragsfilter_cnt;