]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Implement support for spawnflags 32 on target_init entities, also add compatibility...
authorMario <mario.mario@y7mail.com>
Tue, 19 May 2020 05:39:32 +0000 (15:39 +1000)
committerMario <mario.mario@y7mail.com>
Tue, 19 May 2020 05:39:32 +0000 (15:39 +1000)
qcsrc/server/compat/quake3.qc

index 2517923f26fbe60bc14ac19a2d8a889815e204d2..4d469b455dc1919c1061c238e10d8be061afc8fc 100644 (file)
@@ -100,17 +100,27 @@ 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
                {
-                       // TODO
+                       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
+               {
+                       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;
                }
        }
 
@@ -173,6 +183,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")