X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fcheats.qc;h=9ec7cc69a637466cfc9759ac3fe398cc5a02558c;hb=103d3525a1dde2c3bed5281808f748417460f7c3;hp=9d5cc1d42e3a051760ad5c528382d6448b465a2a;hpb=d44927502027bfa3ccd6ccc98d9b7d6285c182c3;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index 9d5cc1d42..9ec7cc69a 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -1,43 +1,33 @@ #include "cheats.qh" -#include -#include -#include -#include -#include -#include - -#include "damage.qh" -#include "clientkill.qh" -#include "player.qh" -#include "race.qh" -#include "../common/mapobjects/teleporters.qh" - -#include - #include "weapons/tracing.qh" - -#include "../common/constants.qh" -#include "../common/deathtypes/all.qh" -#include "../common/util.qh" - -#include - -#include "../common/monsters/_mod.qh" - +#include +#include +#include #include - -#include - -#include "../common/mapobjects/subs.qh" +#include +#include +#include #include - -#include "../common/mapobjects/func/breakable.qh" - -#include "../lib/csqcmodel/sv_model.qh" - -#include "../lib/warpzone/anglestransform.qh" -#include "../lib/warpzone/util_server.qh" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #ifdef NOCHEATS @@ -72,7 +62,7 @@ float CheatsAllowed(entity this, float i, int argc, float fr) // the cheat gets return 0; if(i == CHIMPULSE_CLONE_MOVING.impulse || i == CHIMPULSE_CLONE_STANDING.impulse) - if(this.lip < sv_clones) + if(this.lip < autocvar_sv_clones) return 1; // haha @@ -84,13 +74,13 @@ float CheatsAllowed(entity this, float i, int argc, float fr) // the cheat gets // if we get here, player is not allowed to cheat. Log it. if(i) - bprintf("Player %s^7 tried to use cheat 'impulse %d'\n", playername(this, false), i); + bprintf("Player %s^7 tried to use cheat 'impulse %d'\n", playername(this.netname, this.team, false), i); else if(argc) - bprintf("Player %s^7 tried to use cheat '%s'\n", playername(this, false), argv(0)); + bprintf("Player %s^7 tried to use cheat '%s'\n", playername(this.netname, this.team, false), argv(0)); else if(fr) - bprintf("Player %s^7 tried to use cheat frame %d\n", playername(this, false), fr); + bprintf("Player %s^7 tried to use cheat frame %d\n", playername(this.netname, this.team, false), fr); else - bprintf("Player %s^7 tried to use an unknown cheat\n", playername(this, false)); + bprintf("Player %s^7 tried to use an unknown cheat\n", playername(this.netname, this.team, false)); return 0; } @@ -162,15 +152,12 @@ float CheatImpulse(entity this, int imp) SetResource(this.personal, RES_HEALTH, max(1, GetResource(this, RES_HEALTH))); SetResource(this.personal, RES_ARMOR, GetResource(this, RES_ARMOR)); STAT(WEAPONS, this.personal) = STAT(WEAPONS, this); - STAT(BUFFS, this.personal) = STAT(BUFFS, this); - STAT(BUFF_TIME, this.personal) = STAT(BUFF_TIME, this); + StatusEffects_copy(this.statuseffects, this.personal, 0); this.personal.items = this.items; this.personal.pauserotarmor_finished = this.pauserotarmor_finished; this.personal.pauserothealth_finished = this.pauserothealth_finished; this.personal.pauserotfuel_finished = this.pauserotfuel_finished; this.personal.pauseregen_finished = this.pauseregen_finished; - STAT(STRENGTH_FINISHED, this.personal) = STAT(STRENGTH_FINISHED, this); - STAT(INVINCIBLE_FINISHED, this.personal) = STAT(INVINCIBLE_FINISHED, this); this.personal.teleport_time = time; break; // this part itself doesn't cheat, so let's not count this case CHIMPULSE_CLONE_MOVING.impulse: @@ -223,15 +210,13 @@ float CheatImpulse(entity this, int imp) SetResource(this, RES_HEALTH, GetResource(this.personal, RES_HEALTH)); SetResource(this, RES_ARMOR, GetResource(this.personal, RES_ARMOR)); STAT(WEAPONS, this) = STAT(WEAPONS, this.personal); - STAT(BUFFS, this) = STAT(BUFFS, this.personal); - STAT(BUFF_TIME, this) = STAT(BUFF_TIME, 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; this.pauserotfuel_finished = time + this.personal.pauserotfuel_finished - this.personal.teleport_time; this.pauseregen_finished = time + this.personal.pauseregen_finished - this.personal.teleport_time; - STAT(STRENGTH_FINISHED, this) = time + STAT(STRENGTH_FINISHED, this.personal) - this.personal.teleport_time; - STAT(INVINCIBLE_FINISHED, this) = time + STAT(INVINCIBLE_FINISHED, this.personal) - this.personal.teleport_time; + StatusEffects_copy(this.personal, this.statuseffects, this.personal.teleport_time); + StatusEffects_update(this); if(!autocvar_g_allow_checkpoints) DID_CHEAT(); @@ -311,11 +296,6 @@ float CheatCommand(entity this, int argc) IS_CHEAT(this, 0, argc, 0); if(argc == 5) { - // arguments: - // effectname - // origin (0..1, on crosshair line) - // velocity - // howmany f = stof(argv(2)); crosshair_trace(this); start = (1-f) * this.origin + f * trace_endpos; @@ -325,7 +305,9 @@ float CheatCommand(entity this, int argc) DID_CHEAT(); break; } - sprint(this, "Usage: sv_cheats 1; restart; cmd pointparticles effectname position(0..1) velocityvector multiplier\n"); + sprint(this, "Usage:^3 sv_cheats 1; restart; cmd pointparticles \n"); + sprint(this, " Where is a number from 0 to 1 representing distance on the crosshair line,\n"); + sprint(this, " and is a vector \"x y z\"\n"); break; case "trailparticles": IS_CHEAT(this, 0, argc, 0); @@ -340,14 +322,12 @@ float CheatCommand(entity this, int argc) DID_CHEAT(); break; } - sprint(this, "Usage: sv_cheats 1; restart; cmd trailparticles effectname\n"); + sprint(this, "Usage: sv_cheats 1; restart; cmd trailparticles \n"); break; case "make": IS_CHEAT(this, 0, argc, 0); if(argc == 3) { - // arguments: - // modelname mode f = stof(argv(2)); 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); @@ -357,7 +337,7 @@ float CheatCommand(entity this, int argc) } else { - entity e = spawn(); + entity e = new(func_breakable); e.model = strzone(argv(1)); e.mdl = "rocket_explode"; SetResourceExplicit(e, RES_HEALTH, 1000); @@ -368,7 +348,7 @@ float CheatCommand(entity this, int argc) e.angles = fixedvectoangles2(trace_plane_normal, v_forward); e.angles = AnglesTransform_ApplyToAngles(e.angles, '-90 0 0'); // so unrotated models work } - spawnfunc_func_breakable(e); + func_breakable_setup(e); // now, is it valid? if(f == 0) { @@ -386,7 +366,10 @@ float CheatCommand(entity this, int argc) } } else - sprint(this, "Usage: sv_cheats 1; restart; cmd make models/... 0/1/2\n"); + { + sprint(this, "Usage:^3 sv_cheats 1; restart; cmd make \n"); + sprint(this, " where can be 0, 1 or 2\n"); + } break; case "penalty": IS_CHEAT(this, 0, argc, 0); @@ -396,7 +379,7 @@ float CheatCommand(entity this, int argc) DID_CHEAT(); break; } - sprint(this, "Usage: sv_cheats 1; restart; cmd penalty 5.0 AHAHAHAHAHAHAH))\n"); + sprint(this, "Usage:^3 sv_cheats 1; restart; cmd penalty ))\n"); break; case "dragbox_spawn": { IS_CHEAT(this, 0, argc, 0); @@ -521,7 +504,7 @@ float CheatCommand(entity this, int argc) DID_CHEAT(); break; } - sprint(this, "Usage: sv_cheats 1; restart; cmd dragbox_setcnt cnt\n"); + sprint(this, "Usage:^3 sv_cheats 1; restart; cmd dragbox_setcnt \n"); break; case "drag_save": IS_CHEAT(this, 0, argc, 0); @@ -541,7 +524,7 @@ float CheatCommand(entity this, int argc) DID_CHEAT(); break; } - sprint(this, "Usage: sv_cheats 1; restart; cmd dragbox_save filename\n"); + sprint(this, "Usage:^3 sv_cheats 1; restart; cmd dragbox_save \n"); break; case "drag_saveraceent": IS_CHEAT(this, 0, argc, 0); @@ -610,7 +593,7 @@ float CheatCommand(entity this, int argc) DID_CHEAT(); break; } - sprint(this, "Usage: sv_cheats 1; restart; cmd dragbox_save filename\n"); + sprint(this, "Usage:^3 sv_cheats 1; restart; cmd dragbox_save \n"); break; case "drag_clear": IS_CHEAT(this, 0, argc, 0);