From: Mario Date: Sun, 16 Sep 2018 04:33:46 +0000 (+1000) Subject: Implement rudimentary target_score and target_fragsFilter entities for Quake 3 defrag... X-Git-Tag: xonotic-v0.8.5~1857 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6b3608f6fa61dcaacfa71ba73df1d465a347efb6;p=xonotic%2Fxonotic-data.pk3dir.git Implement rudimentary target_score and target_fragsFilter entities for Quake 3 defrag map compatibility --- diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index ccaf3c0fa..da0d84979 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -32,6 +32,8 @@ #include "../common/wepent.qh" #include +#include "compat/quake3.qh" + #include #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); diff --git a/qcsrc/server/compat/quake3.qc b/qcsrc/server/compat/quake3.qc index c85034b84..db73a20c7 100644 --- a/qcsrc/server/compat/quake3.qc +++ b/qcsrc/server/compat/quake3.qc @@ -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 */ diff --git a/qcsrc/server/compat/quake3.qh b/qcsrc/server/compat/quake3.qh index 342a829a1..20e4879d9 100644 --- a/qcsrc/server/compat/quake3.qh +++ b/qcsrc/server/compat/quake3.qh @@ -1,3 +1,5 @@ #pragma once bool DoesQ3ARemoveThisEntity(entity this); + +.int fragsfilter_cnt;