]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/compat/quake3.qc
Rename server/items.qc to server/items/spawning.qc
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / compat / quake3.qc
index 8205b81284d2811d618b38e6c8675aca3942482b..4103ccf29a57e2f87f4df8844a17fe78ff446253 100644 (file)
@@ -2,9 +2,11 @@
 
 #include <server/defs.qh>
 #include <server/miscfunctions.qh>
-#include <server/items.qh>
+#include <server/items/spawning.qh>
 #include <server/resources.qh>
-#include <common/t_items.qh>
+#include <common/gamemodes/_mod.qh>
+#include <common/items.qh>
+#include <common/gamemodes/gamemode/ctf/sv_ctf.qh>
 #include <common/mapobjects/triggers.qh>
 #include <common/mapobjects/trigger/counter.qh>
 #include <common/mutators/mutator/buffs/buffs.qh>
@@ -59,10 +61,7 @@ SPAWNFUNC_ITEM(item_armor_shard, ITEM_ArmorSmall)
 SPAWNFUNC_ITEM(item_enviro, ITEM_Shield)
 
 // medkit -> armor (we have no holdables)
-SPAWNFUNC_ITEM(holdable_medkit, ITEM_ArmorMega)
-
-// doubler -> strength
-SPAWNFUNC_ITEM(item_doubler, ITEM_Strength)
+SPAWNFUNC_ITEM(holdable_medkit, ITEM_ArmorBig)
 
 .float wait;
 .float delay;
@@ -103,24 +102,34 @@ void target_init_use(entity this, entity actor, entity trigger)
 
        if (!(this.spawnflags & 4))
        {
-               SetResource(actor, RES_SHELLS, start_ammo_shells);
-               SetResource(actor, RES_BULLETS, start_ammo_nails);
-               SetResource(actor, RES_ROCKETS, start_ammo_rockets);
-               SetResource(actor, RES_CELLS, start_ammo_cells);
-               SetResource(actor, RES_PLASMA, start_ammo_plasma);
-               SetResource(actor, RES_FUEL, start_ammo_fuel);
-
-               STAT(WEAPONS, actor) = start_weapons;
-               if (this.spawnflags & 32)
+               if(this.spawnflags & 32) // spawn with only melee
+               {
+                       SetResource(actor, RES_SHELLS, 0);
+                       SetResource(actor, RES_BULLETS, 0);
+                       SetResource(actor, RES_ROCKETS, 0);
+                       SetResource(actor, RES_CELLS, 0);
+                       SetResource(actor, RES_PLASMA, 0);
+                       SetResource(actor, RES_FUEL, 0);
+
+                       STAT(WEAPONS, actor) = WEPSET(SHOTGUN);
+               }
+               else
                {
-                       // TODO
+                       SetResource(actor, RES_SHELLS, start_ammo_shells);
+                       SetResource(actor, RES_BULLETS, start_ammo_nails);
+                       SetResource(actor, RES_ROCKETS, start_ammo_rockets);
+                       SetResource(actor, RES_CELLS, start_ammo_cells);
+                       SetResource(actor, RES_PLASMA, start_ammo_plasma);
+                       SetResource(actor, RES_FUEL, start_ammo_fuel);
+
+                       STAT(WEAPONS, actor) = start_weapons;
                }
        }
 
        if (!(this.spawnflags & 8))
        {
-               actor.strength_finished = 0;
-               actor.invincible_finished = 0;
+               STAT(STRENGTH_FINISHED, actor) = 0;
+               STAT(INVINCIBLE_FINISHED, actor) = 0;
                if(STAT(BUFFS, actor)) // TODO: make a dropbuffs function to handle this
                {
                        int buffid = buff_FirstFromFlags(STAT(BUFFS, actor)).m_id;
@@ -176,6 +185,10 @@ void target_give_init(entity this)
                        SetResourceExplicit(this, RES_ROCKETS, GetResource(this, RES_ROCKETS) + it.count * WEP_CVAR_PRI(mortar, ammo)); // WEAPONTODO
                        this.netname = cons(this.netname, "mortar");
                }
+               else if (it.classname == "weapon_shotgun") {
+                       SetResourceExplicit(this, RES_SHELLS, GetResource(this, RES_SHELLS) + it.count * WEP_CVAR_PRI(shotgun, ammo)); // WEAPONTODO
+                       this.netname = cons(this.netname, "shotgun");
+               }
                else if (it.classname == "item_armor_mega")
                        SetResourceExplicit(this, RES_ARMOR, 100);
                else if (it.classname == "item_health_mega")
@@ -233,11 +246,12 @@ spawnfunc(target_fragsFilter)
 }
 
 //spawnfunc(item_flight)       /* handled by buffs mutator */
+//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 */
 
@@ -282,11 +296,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;
        }