X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fcheats.qc;h=c30e3d45a92160e842e1bfa63fdf3ab9be8bbb77;hb=cd3d62397dfaa03707d6b273538e8ce0157fbde9;hp=cdad6d9fea184ca1a8aaa5d484b9cf476b38bedc;hpb=5a87803e635f56d397f2685d5261620bbaa09013;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index cdad6d9fe..c30e3d45a 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -25,16 +25,15 @@ #include "../lib/warpzone/anglestransform.qh" #include "../lib/warpzone/util_server.qh" -void CopyBody(float keepvelocity); +void CopyBody(entity this, float keepvelocity); #ifdef NOCHEATS -float CheatImpulse(float i) { return 0; } +float CheatImpulse(int imp) { return 0; } float CheatCommand(float argc) { return 0; } float CheatFrame() { return 0; } void CheatInit() { cheatcount_total = world.cheatcount; } void CheatShutdown() { } -void CheatInitClient() { } void CheatShutdownClient() { } void Drag_MoveDrag(entity from, entity to) { } @@ -54,10 +53,6 @@ void CheatShutdown() { } -void CheatInitClient() -{ -} - void CheatShutdownClient() { } @@ -65,7 +60,7 @@ void CheatShutdownClient() float CheatsAllowed(float i, float argc, float fr) // the cheat gets passed as argument for possible future ACL checking {SELFPARAM(); // dead people cannot cheat - if(self.deadflag != DEAD_NO) + if(IS_DEAD(self)) return 0; if(gamestart_sv_cheats < 2 && !IS_PLAYER(self)) return 0; @@ -139,10 +134,10 @@ spawnfunc(info_autoscreenshot) // this one just has to exist } -float CheatImpulse(float i) +float CheatImpulse(int imp) {SELFPARAM(); BEGIN_CHEAT_FUNCTION(); - switch(i) + switch(imp) { entity e, e2; @@ -174,26 +169,26 @@ float CheatImpulse(float i) self.personal.teleport_time = time; break; // this part itself doesn't cheat, so let's not count this case CHIMPULSE_CLONE_MOVING.impulse: - IS_CHEAT(i, 0, 0); + IS_CHEAT(imp, 0, 0); makevectors (self.v_angle); self.velocity = self.velocity + v_forward * 300; - CopyBody(1); + CopyBody(self, 1); self.lip += 1; self.velocity = self.velocity - v_forward * 300; DID_CHEAT(); break; case CHIMPULSE_CLONE_STANDING.impulse: - IS_CHEAT(i, 0, 0); - CopyBody(0); + IS_CHEAT(imp, 0, 0); + CopyBody(self, 0); self.lip += 1; DID_CHEAT(); break; case CHIMPULSE_GIVE_ALL.impulse: - IS_CHEAT(i, 0, 0); + IS_CHEAT(imp, 0, 0); CheatCommand(tokenize_console("give all")); break; // already counted as cheat case CHIMPULSE_SPEEDRUN.impulse: - IS_CHEAT(i, 0, 0); + IS_CHEAT(imp, 0, 0); if(self.personal) { self.speedrunning = true; @@ -233,13 +228,13 @@ float CheatImpulse(float i) DID_CHEAT(); break; } - if(self.deadflag != DEAD_NO) + if(IS_DEAD(self)) sprint(self, "UR DEAD AHAHAH))\n"); else sprint(self, "No waypoint set, cheater (use g_waypointsprite_personal to set one)\n"); break; case CHIMPULSE_TELEPORT.impulse: - IS_CHEAT(i, 0, 0); + IS_CHEAT(imp, 0, 0); if(self.movetype == MOVETYPE_NOCLIP) { e = find(world, classname, "info_autoscreenshot"); @@ -268,12 +263,9 @@ float CheatImpulse(float i) sprint(self, "Emergency teleport could not find a good location, forget it!\n"); break; case CHIMPULSE_R00T.impulse: - IS_CHEAT(i, 0, 0); + IS_CHEAT(imp, 0, 0); RandomSelection_Init(); - FOR_EACH_PLAYER(e) - if(e.deadflag == DEAD_NO) - if(DIFF_TEAM(e, self)) - RandomSelection_Add(e, 0, string_null, 1, 1); + FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it) && DIFF_TEAM(it, self), LAMBDA(RandomSelection_Add(it, 0, string_null, 1, 1))); if(RandomSelection_chosen_ent) e = RandomSelection_chosen_ent; else @@ -456,7 +448,7 @@ float CheatCommand(float argc) e.nextthink = time; e.solid = 0; // nothing special setmodel(e, MDL_MARKER); - setsize(e, PL_MIN, PL_MAX); + setsize(e, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL)); e.skin = 2; if(argc == 3) e.cnt = stof(argv(1)); @@ -888,7 +880,7 @@ void Drag_Begin(entity dragger, entity draggee, vector touchpoint) draggee.draggravity = draggee.gravity; draggee.movetype = MOVETYPE_WALK; draggee.gravity = 0.00001; - draggee.flags &= ~FL_ONGROUND; + UNSET_ONGROUND(draggee); draggee.draggedby = dragger; dragger.dragentity = draggee; @@ -932,7 +924,7 @@ void Drag_Finish(entity dragger) if((draggee.flags & FL_ITEM) && (vlen(draggee.velocity) < 32)) { draggee.velocity = '0 0 0'; - draggee.flags |= FL_ONGROUND; // floating items are FUN + SET_ONGROUND(draggee); // floating items are FUN } } @@ -993,7 +985,7 @@ void Drag_Update(entity dragger) entity draggee; draggee = dragger.dragentity; - draggee.flags &= ~FL_ONGROUND; + UNSET_ONGROUND(draggee); curorigin = gettaginfo(draggee, 0); curorigin = curorigin + v_forward * dragger.draglocalvector.x + v_right * dragger.draglocalvector.y + v_up * dragger.draglocalvector.z; @@ -1026,7 +1018,7 @@ void Drag_Update(entity dragger) float Drag_CanDrag(entity dragger) { - return (dragger.deadflag == DEAD_NO) || (IS_PLAYER(dragger)); + return (!IS_DEAD(dragger)) || (IS_PLAYER(dragger)); } float Drag_IsDragging(entity dragger)