]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/compat/quake3.qc
Experimental status effects system: general backend for buffs and debuffs networked...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / compat / quake3.qc
index 73bf3c375fb725ec0e2095ea1e38a4dc2505e006..ae9dbd35760faf0e834f184d5f64d16fcac65d82 100644 (file)
@@ -1,16 +1,21 @@
 #include "quake3.qh"
 
-#include <server/defs.qh>
-#include <server/miscfunctions.qh>
-#include <server/items.qh>
-#include <server/resources.qh>
 #include <common/gamemodes/_mod.qh>
-#include <common/t_items.qh>
-#include <common/mapobjects/triggers.qh>
+#include <common/gamemodes/gamemode/ctf/sv_ctf.qh>
 #include <common/mapobjects/trigger/counter.qh>
+#include <common/mapobjects/triggers.qh>
 #include <common/mutators/mutator/buffs/buffs.qh>
+#include <common/mutators/mutator/buffs/sv_buffs.qh>
+#include <common/mutators/mutator/status_effects/_mod.qh>
 #include <common/notifications/all.qh>
+#include <common/stats.qh>
 #include <common/weapons/_all.qh>
+#include <common/weapons/_all.qh>
+#include <server/client.qh>
+#include <server/items/items.qh>
+#include <server/items/spawning.qh>
+#include <server/resources.qh>
+#include <server/world.qh>
 
 //***********************
 //QUAKE 3 ENTITIES - So people can play quake3 maps with the xonotic weapons
@@ -127,17 +132,17 @@ void target_init_use(entity this, entity actor, entity trigger)
 
        if (!(this.spawnflags & 8))
        {
-               STAT(STRENGTH_FINISHED, actor) = 0;
-               STAT(INVINCIBLE_FINISHED, actor) = 0;
-               if(STAT(BUFFS, actor)) // TODO: make a dropbuffs function to handle this
+               StatusEffects_remove(STATUSEFFECT_Strength, actor, STATUSEFFECT_REMOVE_NORMAL);
+               StatusEffects_remove(STATUSEFFECT_Shield, actor, STATUSEFFECT_REMOVE_NORMAL);
+               entity heldbuff = buff_FirstFromFlags(actor);
+               if(heldbuff) // TODO: make a dropbuffs function to handle this
                {
-                       int buffid = buff_FirstFromFlags(STAT(BUFFS, actor)).m_id;
+                       int buffid = heldbuff.m_id;
                        Send_Notification(NOTIF_ONE, actor, MSG_MULTI, ITEM_BUFF_DROP, buffid);
                        sound(actor, CH_TRIGGER, SND_BUFF_LOST, VOL_BASE, ATTN_NORM);
                        if(!IS_INDEPENDENT_PLAYER(actor))
                                Send_Notification(NOTIF_ALL_EXCEPT, actor, MSG_INFO, INFO_ITEM_BUFF_LOST, actor.netname, buffid);
-                       STAT(BUFFS, actor) = 0;
-                       STAT(BUFF_TIME, actor) = 0;
+                       buff_RemoveAll(actor, STATUSEFFECT_REMOVE_NORMAL);
                }
        }
 
@@ -193,9 +198,9 @@ void target_give_init(entity this)
                else if (it.classname == "item_health_mega")
                        SetResourceExplicit(this, RES_HEALTH, 200);
                else if (it.classname == "item_buff") {
-                       entity buff = buff_FirstFromFlags(STAT(BUFFS, it));
+                       entity buff = it.buffdef;
                        this.netname = cons(this.netname, buff.netname);
-                       STAT(BUFF_TIME, this) = it.count;
+                       this.buffs_finished = it.count;
                }
 
                //remove(it); // removing ents in init functions causes havoc, workaround:
@@ -248,9 +253,9 @@ spawnfunc(target_fragsFilter)
 //spawnfunc(item_doubler)        /* handled by buffs mutator */
 //spawnfunc(item_haste)        /* handled by buffs mutator */
 //spawnfunc(item_health)       /* handled in t_quake.qc */
-//spawnfunc(item_health_large) /* handled in t_items.qc */
-//spawnfunc(item_health_small) /* handled in t_items.qc */
-//spawnfunc(item_health_mega)  /* handled in t_items.qc */
+//spawnfunc(item_health_large) /* handled in items.qc */
+//spawnfunc(item_health_small) /* handled in items.qc */
+//spawnfunc(item_health_mega)  /* handled in items.qc */
 //spawnfunc(item_invis)        /* handled by buffs mutator */
 //spawnfunc(item_regen)        /* handled by buffs mutator */
 
@@ -295,11 +300,13 @@ bool DoesQ3ARemoveThisEntity(entity this)
                        gametypename = "team";
                if(g_ctf)
                        gametypename = "ctf";
+               if(g_ctf && ctf_oneflag)
+                       gametypename = "oneflag";
                if(g_duel)
                        gametypename = "tournament";
                if(maxclients == 1)
                        gametypename = "single";
-               // we do not have the other types (oneflag, obelisk, harvester, teamtournament)
+               // we do not have the other types (obelisk, harvester, teamtournament)
                if(strstrofs(this.gametype, gametypename, 0) < 0)
                        return true;
        }