X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fcheats.qc;h=987a86db4f128f6a841b396847bb449961a6278c;hb=8cbf0e84432e075e617f43c037c645ea9846eba0;hp=b9928f0b91213da871dbd68baacb0c3c7dd5f46f;hpb=74cebbb48d9481bb83eccb4438283f319352cb74;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index b9928f0b9..987a86db4 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -33,7 +33,7 @@ void CopyBody(entity this, float keepvelocity); float CheatImpulse(entity this, int imp) { return 0; } float CheatCommand(entity this, int argc) { return 0; } -float CheatFrame() { return 0; } +float CheatFrame(entity this) { return 0; } void CheatInit() { cheatcount_total = world.cheatcount; } void CheatShutdown() { } void Drag_MoveDrag(entity from, entity to) { } @@ -110,7 +110,7 @@ void info_autoscreenshot_findtarget(entity this) e = find(world, targetname, this.target); if(!e) { - objerror("Missing target. FAIL!"); + objerror(this, "Missing target. FAIL!"); return; } vector a = vectoangles(e.origin - this.origin); @@ -123,7 +123,7 @@ spawnfunc(info_autoscreenshot) { if(++num_autoscreenshot > autocvar_g_max_info_autoscreenshot) { - objerror("Too many info_autoscreenshot entitites. FAIL!"); + objerror(this, "Too many info_autoscreenshot entitites. FAIL!"); return; } if(this.target != "") @@ -295,7 +295,6 @@ float CheatCommand(entity this, int argc) { float effectnum, f; vector start, end; - entity oldself; case "pointparticles": IS_CHEAT(this, 0, argc, 0); @@ -358,7 +357,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 } - WITHSELF(e, spawnfunc_func_breakable(e)); + spawnfunc_func_breakable(e); // now, is it valid? if(f == 0) { @@ -552,11 +551,11 @@ float CheatCommand(entity this, int argc) { start = '0 0 0'; effectnum = 0; - for(oldself = world; (oldself = find(oldself, classname, "dragbox_box")); ) + for(entity ent = world; (ent = find(ent, classname, "dragbox_box")); ) { - if(e.cnt <= 0 && oldself.cnt == 0 || e.cnt == oldself.cnt) + if(e.cnt <= 0 && ent.cnt == 0 || e.cnt == ent.cnt) { - start = start + oldself.origin; + start = start + ent.origin; ++effectnum; } } @@ -583,12 +582,12 @@ float CheatCommand(entity this, int argc) // these need race_place // counting... effectnum = 1; - for(oldself = world; (oldself = find(oldself, classname, "dragpoint")); ) - if(oldself.cnt == 0) + for(entity ent = world; (ent = find(ent, classname, "dragpoint")); ) + if(ent.cnt == 0) { - if(vlen(oldself.origin - start) < vlen(e.origin - start)) + if(vlen2(ent.origin - start) < vlen2(e.origin - start)) ++effectnum; - else if(vlen(oldself.origin - start) == vlen(e.origin - start) && etof(oldself) < etof(e)) + else if(vlen2(ent.origin - start) == vlen2(e.origin - start) && etof(ent) < etof(e)) ++effectnum; } fputs(f, strcat("\"race_place\" \"", ftos(effectnum), "\"\n")); @@ -719,8 +718,8 @@ float Drag_IsDragging(entity dragger); void Drag_MoveDrag(entity from, entity to); .entity dragentity; -float CheatFrame() -{SELFPARAM(); +float CheatFrame(entity this) +{ BEGIN_CHEAT_FUNCTION(); // Dragging can be used as either a cheat, or a function for some objects. If sv_cheats is active,