]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cheats.qc
Merge branch 'master' into Lyberta/TeamplayOverhaul
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cheats.qc
index ded5e8409885efa1500d13237e5b2b2921bdab45..04172b5eb2b59d74de854c3c1d440ad4c5f7827a 100644 (file)
@@ -1,10 +1,16 @@
 #include "cheats.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+#include <common/effects/all.qh>
+#include <server/resources.qh>
+
 #include "g_damage.qh"
+#include "player.qh"
 #include "race.qh"
-#include "../common/triggers/teleporters.qh"
+#include "../common/mapobjects/teleporters.qh"
 
-#include "mutators/_mod.qh"
+#include <server/mutators/_mod.qh>
 
 #include "weapons/tracing.qh"
 
 
 #include <common/weapons/_all.qh>
 
-#include "../common/triggers/subs.qh"
+#include "../common/mapobjects/subs.qh"
+#include <common/mapobjects/triggers.qh>
 
-#include "../common/triggers/func/breakable.qh"
+#include "../common/mapobjects/func/breakable.qh"
 
 #include "../lib/csqcmodel/sv_model.qh"
 
 #include "../lib/warpzone/anglestransform.qh"
 #include "../lib/warpzone/util_server.qh"
 
-void CopyBody(entity this, float keepvelocity);
-
 #ifdef NOCHEATS
 
 float CheatImpulse(entity this, int imp) { return 0; }
@@ -147,15 +152,15 @@ float CheatImpulse(entity this, int imp)
                        this.personal.origin = this.origin;
                        this.personal.v_angle = this.v_angle;
                        this.personal.velocity = this.velocity;
-                       this.personal.ammo_rockets = this.ammo_rockets;
-                       this.personal.ammo_nails = this.ammo_nails;
-                       this.personal.ammo_cells = this.ammo_cells;
-                       this.personal.ammo_plasma = this.ammo_plasma;
-                       this.personal.ammo_shells = this.ammo_shells;
-                       this.personal.ammo_fuel = this.ammo_fuel;
-                       this.personal.health = max(1, this.health);
-                       this.personal.armorvalue = this.armorvalue;
-                       this.personal.weapons = this.weapons;
+                       SetResourceAmount(this.personal, RESOURCE_ROCKETS, GetResourceAmount(this, RESOURCE_ROCKETS));
+                       SetResourceAmount(this.personal, RESOURCE_BULLETS, GetResourceAmount(this, RESOURCE_BULLETS));
+                       SetResourceAmount(this.personal, RESOURCE_CELLS, GetResourceAmount(this, RESOURCE_CELLS));
+                       SetResourceAmount(this.personal, RESOURCE_PLASMA, GetResourceAmount(this, RESOURCE_PLASMA));
+                       SetResourceAmount(this.personal, RESOURCE_SHELLS, GetResourceAmount(this, RESOURCE_SHELLS));
+                       SetResourceAmount(this.personal, RESOURCE_FUEL, GetResourceAmount(this, RESOURCE_FUEL));
+                       SetResourceAmount(this.personal, RESOURCE_HEALTH, max(1, GetResourceAmount(this, RESOURCE_HEALTH)));
+                       SetResourceAmount(this.personal, RESOURCE_ARMOR, GetResourceAmount(this, RESOURCE_ARMOR));
+                       STAT(WEAPONS, this.personal) = STAT(WEAPONS, this);
                        this.personal.items = this.items;
                        this.personal.pauserotarmor_finished = this.pauserotarmor_finished;
                        this.personal.pauserothealth_finished = this.pauserothealth_finished;
@@ -206,15 +211,15 @@ float CheatImpulse(entity this, int imp)
                                        MUTATOR_CALLHOOK(AbortSpeedrun, this);
                                }
 
-                               this.ammo_rockets = this.personal.ammo_rockets;
-                               this.ammo_nails = this.personal.ammo_nails;
-                               this.ammo_cells = this.personal.ammo_cells;
-                               this.ammo_plasma = this.personal.ammo_plasma;
-                               this.ammo_shells = this.personal.ammo_shells;
-                               this.ammo_fuel = this.personal.ammo_fuel;
-                               this.health = this.personal.health;
-                               this.armorvalue = this.personal.armorvalue;
-                               this.weapons = this.personal.weapons;
+                               SetResourceAmount(this, RESOURCE_ROCKETS, GetResourceAmount(this.personal, RESOURCE_ROCKETS));
+                               SetResourceAmount(this, RESOURCE_BULLETS, GetResourceAmount(this.personal, RESOURCE_BULLETS));
+                               SetResourceAmount(this, RESOURCE_CELLS, GetResourceAmount(this.personal, RESOURCE_CELLS));
+                               SetResourceAmount(this, RESOURCE_PLASMA, GetResourceAmount(this.personal, RESOURCE_PLASMA));
+                               SetResourceAmount(this, RESOURCE_SHELLS, GetResourceAmount(this.personal, RESOURCE_SHELLS));
+                               SetResourceAmount(this, RESOURCE_FUEL, GetResourceAmount(this.personal, RESOURCE_FUEL));
+                               SetResourceAmount(this, RESOURCE_HEALTH, GetResourceAmount(this.personal, RESOURCE_HEALTH));
+                               SetResourceAmount(this, RESOURCE_ARMOR, GetResourceAmount(this.personal, RESOURCE_ARMOR));
+                               STAT(WEAPONS, this) = STAT(WEAPONS, this.personal);
                                this.items = this.personal.items;
                                this.pauserotarmor_finished = time + this.personal.pauserotarmor_finished - this.personal.teleport_time;
                                this.pauserothealth_finished = time + this.personal.pauserothealth_finished - this.personal.teleport_time;
@@ -264,7 +269,7 @@ float CheatImpulse(entity this, int imp)
                case CHIMPULSE_R00T.impulse:
                        IS_CHEAT(this, imp, 0, 0);
                        RandomSelection_Init();
-                       FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it) && DIFF_TEAM(it, this), LAMBDA(RandomSelection_AddEnt(it, 1, 1)));
+                       FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it) && DIFF_TEAM(it, this), { RandomSelection_AddEnt(it, 1, 1); });
                        if(RandomSelection_chosen_ent)
                                e = RandomSelection_chosen_ent;
                        else
@@ -275,10 +280,10 @@ float CheatImpulse(entity this, int imp)
 
                        e2 = spawn();
                        setorigin(e2, e.origin);
-                       RadiusDamage(e2, this, 1000, 0, 128, NULL, NULL, 500, DEATH_CHEAT.m_id, e);
+                       RadiusDamage(e2, this, 1000, 0, 128, NULL, NULL, 500, DEATH_CHEAT.m_id, DMG_NOWEP, e);
                        delete(e2);
 
-                       LOG_INFO("404 Sportsmanship not found.\n");
+                       LOG_INFO("404 Sportsmanship not found.");
                        DID_CHEAT();
                        break;
        }
@@ -286,7 +291,6 @@ float CheatImpulse(entity this, int imp)
        END_CHEAT_FUNCTION();
 }
 
-void DragBox_Think(entity this);
 float drag_lastcnt;
 float CheatCommand(entity this, int argc)
 {
@@ -325,7 +329,7 @@ float CheatCommand(entity this, int argc)
                                // arguments:
                                //   effectname
                                effectnum = _particleeffectnum(argv(1));
-                               W_SetupShot(this, weaponentities[0], false, false, SND_Null, CH_WEAPON_A, 0);
+                               W_SetupShot(this, weaponentities[0], false, false, SND_Null, CH_WEAPON_A, 0, 0);
                                traceline(w_shotorg, w_shotorg + w_shotdir * max_shot_distance, MOVE_NORMAL, this);
                                __trailparticles(this, effectnum, w_shotorg, trace_endpos);
                                DID_CHEAT();
@@ -340,7 +344,7 @@ float CheatCommand(entity this, int argc)
                                // arguments:
                                //   modelname mode
                                f = stof(argv(2));
-                               W_SetupShot(this, weaponentities[0], false, false, SND_Null, CH_WEAPON_A, 0);
+                               W_SetupShot(this, weaponentities[0], false, false, SND_Null, CH_WEAPON_A, 0, 0);
                                traceline(w_shotorg, w_shotorg + w_shotdir * 2048, MOVE_NORMAL, this);
                                if((trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT) || trace_fraction == 1)
                                {
@@ -351,7 +355,7 @@ float CheatCommand(entity this, int argc)
                                        entity e = spawn();
                                        e.model = strzone(argv(1));
                                        e.mdl = "rocket_explode";
-                                       e.health = 1000;
+                                       SetResourceAmountExplicit(e, RESOURCE_HEALTH, 1000);
                                        setorigin(e, trace_endpos);
                                        e.effects = EF_NOMODELFLAGS;
                                        if(f == 1)
@@ -706,18 +710,6 @@ float CheatCommand(entity this, int argc)
        END_CHEAT_FUNCTION();
 }
 
-float Drag(entity this, float force_allow_pick, float ischeat);
-void Drag_Begin(entity dragger, entity draggee, vector touchpoint);
-void Drag_Finish(entity dragger);
-float Drag_IsDraggable(entity draggee);
-float Drag_MayChangeAngles(entity draggee);
-void Drag_MoveForward(entity dragger);
-void Drag_SetSpeed(entity dragger, float s);
-void Drag_MoveBackward(entity dragger);
-void Drag_Update(entity dragger);
-float Drag_CanDrag(entity dragger);
-float Drag_IsDragging(entity dragger);
-void Drag_MoveDrag(entity from, entity to);
 .entity dragentity;
 
 float CheatFrame(entity this)
@@ -780,21 +772,21 @@ float Drag(entity this, float force_allow_pick, float ischeat)
                        {
                                if(PHYS_INPUT_BUTTON_DRAG(this))
                                {
-                                       if(this.impulse == 10 || this.impulse == 15 || this.impulse == 18)
+                                       if(CS(this).impulse == 10 || CS(this).impulse == 15 || CS(this).impulse == 18)
                                        {
                                                Drag_MoveForward(this);
-                                               this.impulse = 0;
+                                               CS(this).impulse = 0;
                                        }
-                                       else if(this.impulse == 12 || this.impulse == 16 || this.impulse == 19)
+                                       else if(CS(this).impulse == 12 || CS(this).impulse == 16 || CS(this).impulse == 19)
                                        {
                                                Drag_MoveBackward(this);
-                                               this.impulse = 0;
+                                               CS(this).impulse = 0;
                                        }
-                                       else if(this.impulse >= 1 && this.impulse <= 9)
+                                       else if(CS(this).impulse >= 1 && CS(this).impulse <= 9)
                                        {
-                                               Drag_SetSpeed(this, this.impulse - 1);
+                                               Drag_SetSpeed(this, CS(this).impulse - 1);
                                        }
-                                       else if(this.impulse == 14)
+                                       else if(CS(this).impulse == 14)
                                        {
                                                Drag_SetSpeed(this, 9);
                                        }