Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
cheats.qh File Reference
Include dependency graph for cheats.qh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

 bool (entity this, entity dragger) draggable
float CheatCommand (entity this, int argc)
float CheatFrame (entity this)
float CheatImpulse (entity this, int imp)
void CheatInit ()
float CheatsAllowed (entity this, float impulse, int argc, float cheatframe, bool logattempt, bool ignoredead)
void CheatShutdown ()
float Drag (entity this, float force_allow_pick, float ischeat)
void Drag_Begin (entity dragger, entity draggee, vector touchpoint)
float Drag_CanDrag (entity dragger)
void Drag_Finish (entity dragger)
bool Drag_IsDraggable (entity draggee, entity dragger)
float Drag_IsDragging (entity dragger)
float Drag_MayChangeAngles (entity draggee)
void Drag_MoveBackward (entity dragger)
void Drag_MoveDrag (entity from, entity to)
void Drag_MoveForward (entity dragger)
void Drag_SetSpeed (entity dragger, float s)
bool drag_undraggable (entity draggee, entity dragger)
void Drag_Update (entity dragger)
void DragBox_Think (entity this)

Variables

float autocvar_g_grab_range
int autocvar_g_max_info_autoscreenshot
int autocvar_sv_cheats
int autocvar_sv_clones
float cheatcount
float cheatcount_total
const float CHRAME_DRAG = 8
int grab
entity personal
bool speedrunning

Function Documentation

◆ bool()

bool ( entity this,
entity dragger )

References entity(), and vector.

◆ CheatCommand()

float CheatCommand ( entity this,
int argc )

Definition at line 291 of file cheats.qc.

292{
294 string cmd;
295 cmd = argv(0);
296 switch(cmd)
297 {
298 float effectnum, f;
299 vector start, end;
300
301 case "pointparticles":
302 IS_CHEAT(this, 0, argc, 0);
303 if(argc == 5)
304 {
305 f = stof(argv(2));
306 crosshair_trace(this);
307 start = (1-f) * this.origin + f * trace_endpos;
308 end = stov(argv(3));
309 f = stof(argv(4));
310 Send_Effect_(argv(1), start, end, f);
311 DID_CHEAT();
312 break;
313 }
314 sprint(this, "Usage:^3 sv_cheats 1; restart; cmd pointparticles <effectname> <position> <velocity> <countmultiplier>\n");
315 sprint(this, " Where <position> is a number from 0 to 1 representing distance on the crosshair line,\n");
316 sprint(this, " and <velocity> is a vector \"x y z\"\n");
317 break;
318 case "trailparticles":
319 IS_CHEAT(this, 0, argc, 0);
320 if(argc == 2)
321 {
322 // arguments:
323 // effectname
324 effectnum = _particleeffectnum(argv(1));
325 W_SetupShot(this, weaponentities[0], false, false, SND_Null, CH_WEAPON_A, 0, 0);
327 __trailparticles(this, effectnum, w_shotorg, trace_endpos);
328 DID_CHEAT();
329 break;
330 }
331 sprint(this, "Usage: sv_cheats 1; restart; cmd trailparticles <effectname>\n");
332 break;
333 case "make":
334 IS_CHEAT(this, 0, argc, 0);
335 if(argc == 3)
336 {
337 f = stof(argv(2));
338 W_SetupShot(this, weaponentities[0], false, false, SND_Null, CH_WEAPON_A, 0, 0);
339 traceline(w_shotorg, w_shotorg + w_shotdir * 2048, MOVE_NORMAL, this);
341 {
342 sprint(this, "cannot make stuff there (bad surface)\n");
343 }
344 else
345 {
346 entity e = new(func_breakable);
347 e.model = strzone(argv(1));
348 e.mdl = "rocket_explode";
349 SetResourceExplicit(e, RES_HEALTH, 1000);
350 setorigin(e, trace_endpos);
351 e.effects = EF_NOMODELFLAGS;
352 if(f == 1)
353 {
355 e.angles = AnglesTransform_ApplyToAngles(e.angles, '-90 0 0'); // so unrotated models work
356 }
358 // now, is it valid?
359 if(f == 0)
360 {
361 tracebox(e.origin, e.mins, e.maxs, e.origin, MOVE_NORMAL, e);
363 {
364 delete(e);
365 sprint(this, "cannot make stuff there (no space)\n");
366 }
367 else
368 DID_CHEAT();
369 }
370 else
371 DID_CHEAT();
372 }
373 }
374 else
375 {
376 sprint(this, "Usage:^3 sv_cheats 1; restart; cmd make <modelname> <mode>\n");
377 sprint(this, " where <mode> can be 0, 1 or 2\n");
378 }
379 break;
380 case "penalty":
381 IS_CHEAT(this, 0, argc, 0);
382 if(argc == 3)
383 {
384 race_ImposePenaltyTime(this, stof(argv(1)), argv(2));
385 DID_CHEAT();
386 break;
387 }
388 sprint(this, "Usage:^3 sv_cheats 1; restart; cmd penalty <duration> <reason>))\n");
389 break;
390 case "dragbox_spawn": {
391 IS_CHEAT(this, 0, argc, 0);
392 entity e = new(dragbox_box);
394 e.nextthink = time;
395 e.solid = -1; // black
396 setmodel(e, MDL_Null); // network it
397 if(argc == 4)
398 e.cnt = stof(argv(1));
399 else
400 e.cnt = max(0, drag_lastcnt);
401
402 e.aiment = new(dragbox_corner_1);
403 e.aiment.owner = e;
404 setmodel(e.aiment, MDL_MARKER);
405 e.aiment.skin = 0;
406 setsize(e.aiment, '0 0 0', '0 0 0');
407 if(argc == 4)
408 setorigin(e.aiment, stov(argv(2)));
409 else
410 {
411 crosshair_trace(this);
412 setorigin(e.aiment, trace_endpos);
413 }
414
415 e.enemy = new(dragbox_corner_2);
416 e.enemy.owner = e;
417 setmodel(e.enemy, MDL_MARKER);
418 e.enemy.skin = 1;
419 setsize(e.enemy, '0 0 0', '0 0 0');
420 end = normalize(this.origin + this.view_ofs - e.aiment.origin);
421 end.x = (end.x > 0) * 2 - 1;
422 end.y = (end.y > 0) * 2 - 1;
423 end.z = (end.z > 0) * 2 - 1;
424 if(argc == 4)
425 setorigin(e.enemy, stov(argv(3)));
426 else
427 setorigin(e.enemy, e.aiment.origin + 32 * end);
428
429 e.killindicator = new(drag_digit);
430 e.killindicator.owner = e;
431 setattachment(e.killindicator, e, "");
432 setorigin(e.killindicator, '0 0 -8');
433 e.killindicator.killindicator = new(drag_digit);
434 e.killindicator.killindicator.owner = e;
435 setattachment(e.killindicator.killindicator, e, "");
436 setorigin(e.killindicator.killindicator, '0 0 8');
437 DID_CHEAT();
438 break;
439 }
440 case "dragpoint_spawn": {
441 IS_CHEAT(this, 0, argc, 0);
442 entity e = new(dragpoint);
444 e.nextthink = time;
445 e.solid = 0; // nothing special
446 setmodel(e, MDL_MARKER);
447 setsize(e, STAT(PL_MIN, this), STAT(PL_MAX, this));
448 e.skin = 2;
449 if(argc == 3)
450 e.cnt = stof(argv(1));
451 else
452 e.cnt = drag_lastcnt;
453 if(argc == 3)
454 setorigin(e, stov(argv(2)));
455 else
456 {
457 crosshair_trace(this);
458 setorigin(e, trace_endpos + normalize(this.origin + this.view_ofs - trace_endpos));
460 }
461
462 e.killindicator = new(drag_digit);
463 e.killindicator.owner = e;
464 setattachment(e.killindicator, e, "");
465 setorigin(e.killindicator, '0 0 40');
466 e.killindicator.killindicator = new(drag_digit);
467 e.killindicator.killindicator.owner = e;
468 setattachment(e.killindicator.killindicator, e, "");
469 setorigin(e.killindicator.killindicator, '0 0 56');
470 DID_CHEAT();
471 break;
472 }
473 case "drag_remove":
474 IS_CHEAT(this, 0, argc, 0);
476 crosshair_trace(this);
477 for(entity e = NULL; (e = find(e, classname, "dragbox_box")); )
478 RandomSelection_AddEnt(e, 1, 1 / vlen(e.origin + (e.mins + e.maxs) * 0.5 - trace_endpos));
479 for(entity e = NULL; (e = find(e, classname, "dragpoint")); )
480 RandomSelection_AddEnt(e, 1, 1 / vlen(e.origin + (e.mins + e.maxs) * 0.5 - trace_endpos));
482 {
483 delete(RandomSelection_chosen_ent.killindicator.killindicator);
484 delete(RandomSelection_chosen_ent.killindicator);
486 delete(RandomSelection_chosen_ent.aiment);
488 delete(RandomSelection_chosen_ent.enemy);
490 }
491 DID_CHEAT();
492 break;
493 case "drag_setcnt":
494 IS_CHEAT(this, 0, argc, 0);
495 if(argc == 2)
496 {
498 crosshair_trace(this);
499 for(entity e = NULL; (e = find(e, classname, "dragbox_box")); )
500 RandomSelection_AddEnt(e, 1, 1 / vlen(e.origin + (e.mins + e.maxs) * 0.5 - trace_endpos));
501 for(entity e = NULL; (e = find(e, classname, "dragpoint")); )
502 RandomSelection_AddEnt(e, 1, 1 / vlen(e.origin + (e.mins + e.maxs) * 0.5 - trace_endpos));
504 {
505 if(substring(argv(1), 0, 1) == "*")
507 else
509 }
510 DID_CHEAT();
511 break;
512 }
513 sprint(this, "Usage:^3 sv_cheats 1; restart; cmd dragbox_setcnt <cnt>\n");
514 break;
515 case "drag_save":
516 IS_CHEAT(this, 0, argc, 0);
517 if(argc == 2)
518 {
519 f = fopen(argv(1), FILE_WRITE);
520 fputs(f, "cmd drag_clear\n");
521 for(entity e = NULL; (e = find(e, classname, "dragbox_box")); )
522 {
523 fputs(f, strcat("cmd dragbox_spawn ", ftos(e.cnt), " \"", vtos(e.aiment.origin), "\" \"", vtos(e.enemy.origin), "\"\n"));
524 }
525 for(entity e = NULL; (e = find(e, classname, "dragpoint")); )
526 {
527 fputs(f, strcat("cmd dragpoint_spawn ", ftos(e.cnt), " \"", vtos(e.origin), "\"\n"));
528 }
529 fclose(f);
530 DID_CHEAT();
531 break;
532 }
533 sprint(this, "Usage:^3 sv_cheats 1; restart; cmd dragbox_save <filename>\n");
534 break;
535 case "drag_saveraceent":
536 IS_CHEAT(this, 0, argc, 0);
537 if(argc == 2)
538 {
539 f = fopen(argv(1), FILE_WRITE);
540 for(entity e = NULL; (e = find(e, classname, "dragbox_box")); )
541 {
542 fputs(f, "{\n");
543 fputs(f, "\"classname\" \"trigger_race_checkpoint\"\n");
544 fputs(f, strcat("\"origin\" \"", ftos(e.absmin.x), " ", ftos(e.absmin.y), " ", ftos(e.absmin.z), "\"\n"));
545 fputs(f, strcat("\"maxs\" \"", ftos(e.absmax.x - e.absmin.x), " ", ftos(e.absmax.y - e.absmin.y), " ", ftos(e.absmax.z - e.absmin.z), "\"\n"));
546 fputs(f, strcat("\"cnt\" \"", ftos(e.cnt), "\"\n"));
547 fputs(f, strcat("\"targetname\" \"checkpoint", ftos(e.cnt), "\"\n"));
548 fputs(f, "}\n");
549 }
550 for(entity e = NULL; (e = find(e, classname, "dragpoint")); )
551 {
552 start = '0 0 0';
553 effectnum = 0;
554 for(entity ent = NULL; (ent = find(ent, classname, "dragbox_box")); )
555 {
556 if((e.cnt <= 0 && ent.cnt == 0) || e.cnt == ent.cnt)
557 {
558 start = start + ent.origin;
559 ++effectnum;
560 }
561 }
562 start *= 1 / effectnum;
563 fputs(f, "{\n");
564 fputs(f, "\"classname\" \"info_player_race\"\n");
565 fputs(f, strcat("\"angle\" \"", ftos(vectoyaw(start - e.origin)), "\"\n"));
566 fputs(f, strcat("\"origin\" \"", ftos(e.origin.x), " ", ftos(e.origin.y), " ", ftos(e.origin.z), "\"\n"));
567 if(e.cnt == -2)
568 {
569 fputs(f, "\"target\" \"checkpoint0\"\n");
570 fputs(f, "\"race_place\" \"0\"\n");
571 }
572 else if(e.cnt == -1)
573 {
574 fputs(f, "\"target\" \"checkpoint0\"\n");
575 fputs(f, "\"race_place\" \"-1\"\n");
576 }
577 else
578 {
579 fputs(f, strcat("\"target\" \"checkpoint", ftos(e.cnt), "\"\n"));
580 if(e.cnt == 0)
581 {
582 // these need race_place
583 // counting...
584 effectnum = 1;
585 for(entity ent = NULL; (ent = find(ent, classname, "dragpoint")); )
586 if(ent.cnt == 0)
587 {
588 if(vlen2(ent.origin - start) < vlen2(e.origin - start))
589 ++effectnum;
590 else if(vlen2(ent.origin - start) == vlen2(e.origin - start) && etof(ent) < etof(e))
591 ++effectnum;
592 }
593 fputs(f, strcat("\"race_place\" \"", ftos(effectnum), "\"\n"));
594 }
595 }
596 fputs(f, "}\n");
597 }
598 fclose(f);
599 DID_CHEAT();
600 break;
601 }
602 sprint(this, "Usage:^3 sv_cheats 1; restart; cmd dragbox_save <filename>\n");
603 break;
604 case "drag_clear":
605 IS_CHEAT(this, 0, argc, 0);
606 for(entity e = NULL; (e = find(e, classname, "dragbox_box")); )
607 delete(e);
608 for(entity e = NULL; (e = find(e, classname, "dragbox_corner_1")); )
609 delete(e);
610 for(entity e = NULL; (e = find(e, classname, "dragbox_corner_2")); )
611 delete(e);
612 for(entity e = NULL; (e = find(e, classname, "dragpoint")); )
613 delete(e);
614 for(entity e = NULL; (e = find(e, classname, "drag_digit")); )
615 delete(e);
616 DID_CHEAT();
617 break;
618 case "god":
619 IS_CHEAT(this, 0, argc, 0);
621 if(this.flags & FL_GODMODE)
622 {
623 sprint(this, "godmode ON\n");
624 DID_CHEAT();
625 }
626 else
627 sprint(this, "godmode OFF\n");
628 break;
629 case "notarget":
630 IS_CHEAT(this, 0, argc, 0);
632 if(this.flags & FL_NOTARGET)
633 {
634 sprint(this, "notarget ON\n");
635 DID_CHEAT();
636 }
637 else
638 sprint(this, "notarget OFF\n");
639 break;
640 case "noclip":
641 IS_CHEAT(this, 0, argc, 0);
643 {
645 sprint(this, "noclip ON\n");
646 DID_CHEAT();
647 }
648 else
649 {
651 sprint(this, "noclip OFF\n");
652 }
653 break;
654 case "fly":
655 IS_CHEAT(this, 0, argc, 0);
656 if(this.move_movetype != MOVETYPE_FLY)
657 {
659 sprint(this, "flymode ON\n");
660 DID_CHEAT();
661 }
662 else
663 {
665 sprint(this, "flymode OFF\n");
666 }
667 break;
668 case "give":
669 IS_CHEAT(this, 0, argc, 0);
670 if(GiveItems(this, 1, argc))
671 DID_CHEAT();
672 break;
673 case "usetarget":
674 IS_CHEAT(this, 0, argc, 0);
675 entity e = spawn();
676 e.target = argv(1);
677 SUB_UseTargets(e, this, NULL);
678 delete(e);
679 DID_CHEAT();
680 break;
681 case "killtarget":
682 IS_CHEAT(this, 0, argc, 0);
683 entity e2 = spawn();
684 e2.killtarget = argv(1);
685 SUB_UseTargets(e2, this, NULL);
686 delete(e2);
687 DID_CHEAT();
688 break;
689 case "teleporttotarget":
690 IS_CHEAT(this, 0, argc, 0);
691 entity ent = new(cheattriggerteleport);
692 setorigin(ent, ent.origin);
693 ent.target = argv(1);
695 if(!wasfreed(ent))
696 {
697 Simple_TeleportPlayer(ent, this);
698 delete(ent);
699 DID_CHEAT();
700 }
701 break;
702 }
703
705}
vector AnglesTransform_ApplyToAngles(vector transform, vector v)
#define fixedvectoangles2
void func_breakable_setup(entity this)
Definition breakable.qc:317
#define END_CHEAT_FUNCTION()
Definition cheats.qc:99
void DragBox_Think(entity this)
Definition cheats.qc:1016
#define DID_CHEAT()
Definition cheats.qc:94
#define IS_CHEAT(ent, i, argc, fr)
Definition cheats.qc:102
#define BEGIN_CHEAT_FUNCTION()
Definition cheats.qc:92
float drag_lastcnt
Definition cheats.qc:290
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
#define setmodel(this, m)
Definition model.qh:26
const int FL_NOTARGET
Definition constants.qh:76
const int FL_GODMODE
Definition constants.qh:75
string classname
float flags
const float MOVE_NORMAL
const float FILE_WRITE
float time
vector trace_endpos
float trace_startsolid
float trace_dphitq3surfaceflags
vector v_forward
vector origin
float trace_fraction
float Q3SURFACEFLAG_NOIMPACT
vector trace_plane_normal
#define spawn
float EF_NOMODELFLAGS
void Send_Effect_(string eff_name, vector eff_loc, vector eff_vel, int eff_cnt)
Definition all.qc:129
void SUB_UseTargets(entity this, entity actor, entity trigger)
Definition triggers.qc:344
#define STAT(...)
Definition stats.qh:82
#define move_out_of_solid(e)
Definition common.qh:110
#define BITXOR_ASSIGN(a, b)
Definition common.qh:107
void fclose(float fhandle)
float stof(string val,...)
void fputs(float fhandle, string s)
string substring(string s, float start, float length)
void sprint(float clientnum, string text,...)
float fopen(string filename, float mode)
entity find(entity start,.string field, string match)
float vectoyaw(vector v)
vector stov(string s)
float vlen(vector v)
void cmd(string command,...)
string vtos(vector v)
vector normalize(vector v)
string ftos(float f)
string strzone(string s)
string argv(float n)
float max(float f,...)
#define etof(e)
Definition misc.qh:25
void set_movetype(entity this, int mt)
Definition movetypes.qc:4
const int MOVETYPE_WALK
Definition movetypes.qh:132
float move_movetype
Definition movetypes.qh:76
const int MOVETYPE_NOCLIP
Definition movetypes.qh:137
const int MOVETYPE_FLY
Definition movetypes.qh:134
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
#define NULL
Definition post.qh:14
vector view_ofs
Definition progsdefs.qc:151
ERASEABLE void RandomSelection_Init()
Definition random.qc:4
#define RandomSelection_AddEnt(e, weight, priority)
Definition random.qh:14
entity RandomSelection_chosen_ent
Definition random.qh:5
#define setthink(e, f)
vector
Definition self.qh:92
float GiveItems(entity e, float beginarg, float endarg)
Definition items.qc:1593
void race_ImposePenaltyTime(entity pl, float penalty, string reason)
Definition race.qc:1301
const int CH_WEAPON_A
Definition sound.qh:7
void teleport_findtarget(entity this)
entity Simple_TeleportPlayer(entity teleporter, entity player)
void crosshair_trace(entity pl)
Definition tracing.qc:549
vector w_shotdir
Definition tracing.qh:20
vector w_shotorg
Definition tracing.qh:19
#define W_SetupShot(ent, wepent, antilag, recoil, snd, chan, maxdamage, deathtype)
Definition tracing.qh:34
#define vlen2(v)
Definition vector.qh:4
int max_shot_distance
Definition weapon.qh:203
entity weaponentities[MAX_WEAPONSLOTS]
Definition weapon.qh:17

References AnglesTransform_ApplyToAngles(), argv(), BEGIN_CHEAT_FUNCTION, BITXOR_ASSIGN, CH_WEAPON_A, classname, cmd(), crosshair_trace(), DID_CHEAT, drag_lastcnt, DragBox_Think(), EF_NOMODELFLAGS, END_CHEAT_FUNCTION, entity(), etof, fclose(), FILE_WRITE, find(), fixedvectoangles2, FL_GODMODE, FL_NOTARGET, flags, fopen(), fputs(), ftos(), func_breakable_setup(), GiveItems(), IS_CHEAT, max(), max_shot_distance, move_movetype, MOVE_NORMAL, move_out_of_solid, MOVETYPE_FLY, MOVETYPE_NOCLIP, MOVETYPE_WALK, normalize(), NULL, origin, Q3SURFACEFLAG_NOIMPACT, race_ImposePenaltyTime(), RandomSelection_AddEnt, RandomSelection_chosen_ent, RandomSelection_Init(), Send_Effect_(), set_movetype(), setmodel, SetResourceExplicit(), setthink, Simple_TeleportPlayer(), spawn, sprint(), STAT, stof(), stov(), strcat(), strzone(), SUB_UseTargets(), substring(), teleport_findtarget(), time, trace_dphitq3surfaceflags, trace_endpos, trace_fraction, trace_plane_normal, trace_startsolid, v_forward, vector, vectoyaw(), view_ofs, vlen(), vlen2, vtos(), W_SetupShot, w_shotdir, w_shotorg, and weaponentities.

Referenced by CheatImpulse(), and SV_ParseClientCommand().

◆ CheatFrame()

float CheatFrame ( entity this)

Definition at line 709 of file cheats.qc.

710{
712
713 // Dragging can be used as either a cheat, or a function for some objects. If sv_cheats is active,
714 // the cheat dragging is used (unlimited pickup range and any entity can be carried). If sv_cheats
715 // is disabled, normal dragging is used (limited pickup range and only dragable objects can be carried),
716 // grabbing itself no longer being accounted as cheating.
717
718 switch(0)
719 {
720 default:
722 {
723 // use cheat dragging if cheats are enabled
724 //if(Drag_IsDragging(this))
725 //crosshair_trace_plusvisibletriggers(this);
726 Drag(this, true, true);
727 }
728 else
729 {
730 Drag(this, false, false); // execute dragging
731 }
732 break;
733 }
734
736}
bool maycheat
Definition cheats.qc:44
float Drag(entity this, float force_allow_pick, float ischeat)
Definition cheats.qc:754
float gamestart_sv_cheats
Definition cheats.qc:45
int autocvar_sv_cheats
Definition cheats.qh:5

References autocvar_sv_cheats, BEGIN_CHEAT_FUNCTION, Drag(), END_CHEAT_FUNCTION, entity(), gamestart_sv_cheats, and maycheat.

◆ CheatImpulse()

float CheatImpulse ( entity this,
int imp )

Definition at line 138 of file cheats.qc.

139{
141 switch(imp)
142 {
143 entity e, e2;
144
145 case CHIMPULSE_SPEEDRUN_INIT.impulse: // deploy personal waypoint
146 // shared with regular waypoint init, so this is not a cheat by itself
147 if(!this.personal)
148 {
149 this.personal = new(personal_wp);
150 }
151 this.personal.origin = this.origin;
152 this.personal.v_angle = this.v_angle;
153 this.personal.velocity = this.velocity;
154 SetResource(this.personal, RES_ROCKETS, GetResource(this, RES_ROCKETS));
155 SetResource(this.personal, RES_BULLETS, GetResource(this, RES_BULLETS));
156 SetResource(this.personal, RES_CELLS, GetResource(this, RES_CELLS));
157 SetResource(this.personal, RES_SHELLS, GetResource(this, RES_SHELLS));
158 SetResource(this.personal, RES_FUEL, GetResource(this, RES_FUEL));
159 SetResource(this.personal, RES_HEALTH, max(1, GetResource(this, RES_HEALTH)));
161 STAT(WEAPONS, this.personal) = STAT(WEAPONS, this);
163 this.personal.items = this.items;
164 this.personal.pauserotarmor_finished = this.pauserotarmor_finished;
165 this.personal.pauserothealth_finished = this.pauserothealth_finished;
166 this.personal.pauserotfuel_finished = this.pauserotfuel_finished;
167 this.personal.pauseregen_finished = this.pauseregen_finished;
168 this.personal.teleport_time = time;
169 break; // this part itself doesn't cheat, so let's not count this
170 case CHIMPULSE_CLONE_MOVING.impulse:
171 IS_CHEAT(this, imp, 0, 0);
172 makevectors (this.v_angle);
173 this.velocity = this.velocity + v_forward * 300;
174 CopyBody(this, 1);
175 this.lip += 1;
176 this.velocity = this.velocity - v_forward * 300;
177 DID_CHEAT();
178 break;
179 case CHIMPULSE_CLONE_STANDING.impulse:
180 IS_CHEAT(this, imp, 0, 0);
181 CopyBody(this, 0);
182 this.lip += 1;
183 DID_CHEAT();
184 break;
185 case CHIMPULSE_GIVE_ALL.impulse:
186 IS_CHEAT(this, imp, 0, 0);
187 CheatCommand(this, tokenize_console("give all"));
188 break; // already counted as cheat
189 case CHIMPULSE_SPEEDRUN.impulse:
191 IS_CHEAT(this, imp, 0, 0);
192 if(this.personal)
193 {
194 this.speedrunning = true;
195 tracebox(this.personal.origin, this.mins, this.maxs, this.personal.origin, MOVE_WORLDONLY, this);
197 {
198 sprint(this, "Cannot move there, cheater - only waypoints set using g_waypointsprite_personal work\n");
199 }
200 else
201 {
202 // Abort speedrun, teleport back
203 setorigin(this, this.personal.origin);
204 this.oldvelocity = this.velocity = this.personal.velocity;
205 this.angles = this.personal.v_angle;
206 this.fixangle = true;
207
208 MUTATOR_CALLHOOK(AbortSpeedrun, this);
209 }
210
211 SetResource(this, RES_ROCKETS, GetResource(this.personal, RES_ROCKETS));
212 SetResource(this, RES_BULLETS, GetResource(this.personal, RES_BULLETS));
213 SetResource(this, RES_CELLS, GetResource(this.personal, RES_CELLS));
214 SetResource(this, RES_SHELLS, GetResource(this.personal, RES_SHELLS));
215 SetResource(this, RES_FUEL, GetResource(this.personal, RES_FUEL));
216 SetResource(this, RES_HEALTH, GetResource(this.personal, RES_HEALTH));
218 STAT(WEAPONS, this) = STAT(WEAPONS, this.personal);
219 this.items = this.personal.items;
220 this.pauserotarmor_finished = time + this.personal.pauserotarmor_finished - this.personal.teleport_time;
221 this.pauserothealth_finished = time + this.personal.pauserothealth_finished - this.personal.teleport_time;
222 this.pauserotfuel_finished = time + this.personal.pauserotfuel_finished - this.personal.teleport_time;
223 this.pauseregen_finished = time + this.personal.pauseregen_finished - this.personal.teleport_time;
224 StatusEffects_copy(this.personal, this.statuseffects, this.personal.teleport_time);
226
228 DID_CHEAT();
229 break;
230 }
231 if(IS_DEAD(this))
232 sprint(this, "UR DEAD AHAHAH))\n");
233 else
234 sprint(this, "No waypoint set, cheater (use g_waypointsprite_personal to set one)\n");
235 break;
236 case CHIMPULSE_TELEPORT.impulse:
237 IS_CHEAT(this, imp, 0, 0);
239 {
240 e = find(NULL, classname, "info_autoscreenshot");
241 if(e)
242 {
243 sprint(this, "Emergency teleport used info_autoscreenshot location\n");
244 setorigin(this, e.origin);
245 this.angles = e.angles;
246 delete(e);
247 // should we? this.angles_x = -this.angles_x;
248 this.fixangle = true;
249 this.velocity = '0 0 0';
250 DID_CHEAT();
251 break;
252 }
253 }
255 {
256 sprint(this, "Emergency teleport used random location\n");
257 this.angles_x = -this.angles.x;
258 this.fixangle = true;
259 this.velocity = '0 0 0';
260 DID_CHEAT();
261 break;
262 }
263 sprint(this, "Emergency teleport could not find a good location, forget it!\n");
264 break;
265 case CHIMPULSE_R00T.impulse:
266 IS_CHEAT(this, imp, 0, 0);
268 FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it) && DIFF_TEAM(it, this), { RandomSelection_AddEnt(it, 1, 1); });
271 else
272 e = this;
273
274 Send_Effect(EFFECT_ROCKET_EXPLODE, e.origin, '0 0 0', 1);
275 sound(e, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
276
277 e2 = spawn();
278 setorigin(e2, e.origin);
279 RadiusDamage(e2, this, 1000, 0, 128, NULL, NULL, 500, DEATH_CHEAT.m_id, DMG_NOWEP, e);
280 delete(e2);
281
282 LOG_INFO("404 Sportsmanship not found.");
283 DID_CHEAT();
284 break;
285 }
286
288}
#define MUTATOR_CALLHOOK(id,...)
Definition base.qh:143
float CheatCommand(entity this, int argc)
Definition cheats.qc:291
bool speedrunning
Definition cheats.qh:22
entity personal
Definition cheats.qh:24
void SetResource(entity e, Resource res_type, float amount)
Sets the current amount of resource the given entity will have.
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
int items
Definition player.qh:227
#define IS_DEAD(s)
Definition player.qh:245
vector v_angle
Definition player.qh:237
#define IS_PLAYER(s)
Definition player.qh:243
float Q3SURFACEFLAG_SKY
float DPCONTENTS_SKY
float DPCONTENTS_DONOTENTER
float DPCONTENTS_SOLID
float DPCONTENTS_CORPSE
vector velocity
float DPCONTENTS_BODY
float DPCONTENTS_PLAYERCLIP
float DPCONTENTS_SLIME
float MOVE_WORLDONLY
float DPCONTENTS_LAVA
float RadiusDamage(entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype,.entity weaponentity, entity directhitentity)
Definition damage.qc:981
#define DMG_NOWEP
Definition damage.qh:104
#define tokenize_console
void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
Definition all.qc:124
RES_ARMOR
Definition ent_cs.qc:130
ent angles
Definition ent_cs.qc:121
#define LOG_INFO(...)
Definition log.qh:65
#define makevectors
Definition post.qh:21
float fixangle
Definition progsdefs.qc:160
float pauserotfuel_finished
Definition client.qh:340
float pauseregen_finished
Definition client.qh:337
float pauserothealth_finished
Definition client.qh:338
float pauserotarmor_finished
Definition client.qh:339
int int int imp
Definition impulse.qc:90
vector oldvelocity
Definition main.qh:42
void CopyBody(entity this, float keepvelocity)
Definition player.qc:64
bool autocvar_g_allow_checkpoints
Definition race.qh:3
const float VOL_BASE
Definition sound.qh:36
const int CH_SHOTS
Definition sound.qh:14
const float ATTEN_NORM
Definition sound.qh:30
#define sound(e, c, s, v, a)
Definition sound.qh:52
void StatusEffects_copy(StatusEffect this, entity store, float time_offset)
StatusEffect statuseffects
Entity statuseffects.
void StatusEffects_update(entity e)
float lip
Definition subs.qh:40
#define DIFF_TEAM(a, b)
Definition teams.qh:242
#define FOREACH_CLIENT(cond, body)
Definition utils.qh:50
float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, float badsurfaceflags, float attempts, float maxaboveground, float minviewdistance)
Definition world.qc:1231

References angles, ATTEN_NORM, autocvar_g_allow_checkpoints, BEGIN_CHEAT_FUNCTION, CH_SHOTS, CheatCommand(), classname, CopyBody(), DID_CHEAT, DIFF_TEAM, DMG_NOWEP, DPCONTENTS_BODY, DPCONTENTS_CORPSE, DPCONTENTS_DONOTENTER, DPCONTENTS_LAVA, DPCONTENTS_PLAYERCLIP, DPCONTENTS_SKY, DPCONTENTS_SLIME, DPCONTENTS_SOLID, END_CHEAT_FUNCTION, entity(), find(), fixangle, FOREACH_CLIENT, gamestart_sv_cheats, GetResource(), imp, IS_CHEAT, IS_DEAD, IS_PLAYER, items, lip, LOG_INFO, makevectors, max(), move_movetype, MOVE_WORLDONLY, MoveToRandomMapLocation(), MOVETYPE_NOCLIP, MUTATOR_CALLHOOK, NULL, oldvelocity, origin, pauseregen_finished, pauserotarmor_finished, pauserotfuel_finished, pauserothealth_finished, personal, Q3SURFACEFLAG_SKY, RadiusDamage(), RandomSelection_AddEnt, RandomSelection_chosen_ent, RandomSelection_Init(), RES_ARMOR, Send_Effect(), SetResource(), sound, spawn, speedrunning, sprint(), STAT, statuseffects, StatusEffects_copy(), StatusEffects_update(), time, tokenize_console, trace_startsolid, v_angle, v_forward, velocity, and VOL_BASE.

Referenced by ImpulseCommands(), and SpecialCommand().

◆ CheatInit()

void CheatInit ( )

Definition at line 49 of file cheats.qc.

References autocvar_sv_cheats, and gamestart_sv_cheats.

Referenced by spawnfunc().

◆ CheatsAllowed()

float CheatsAllowed ( entity this,
float impulse,
int argc,
float cheatframe,
bool logattempt,
bool ignoredead )

Definition at line 59 of file cheats.qc.

60{
61 if(!ignoredead && IS_DEAD(this))
62 return 0;
63 if(gamestart_sv_cheats < 2 && !IS_PLAYER(this))
64 return 0;
65
66 if(imp == CHIMPULSE_CLONE_MOVING.impulse || imp == CHIMPULSE_CLONE_STANDING.impulse)
67 if(this.lip < autocvar_sv_clones)
68 return 1;
69
70 // haha
71 if(this.maycheat)
72 return 1;
73
75 return 1;
76
77 if (logattempt)
78 {
79 // if we get here, player is not allowed to cheat. Log it.
80 if(imp)
81 bprintf("Player %s^7 tried to use cheat 'impulse %d'\n", playername(this.netname, this.team, false), imp);
82 else if(argc)
83 bprintf("Player %s^7 tried to use cheat '%s'\n", playername(this.netname, this.team, false), argv(0));
84 else if(cheatframe)
85 bprintf("Player %s^7 tried to use cheat frame %d\n", playername(this.netname, this.team, false), cheatframe);
86 else
87 bprintf("Player %s^7 tried to use an unknown cheat\n", playername(this.netname, this.team, false));
88 }
89 return 0;
90}
int autocvar_sv_clones
Definition cheats.qh:8
string netname
Definition powerups.qc:20
int team
Definition main.qh:188
string playername(string thename, int teamid, bool team_colorize)
Definition util.qc:2082
#define bprintf(...)
Definition util.qh:232

References argv(), autocvar_sv_cheats, autocvar_sv_clones, bprintf, entity(), gamestart_sv_cheats, imp, IS_DEAD, IS_PLAYER, lip, maycheat, netname, playername(), and team.

Referenced by PlayerThink().

◆ CheatShutdown()

void CheatShutdown ( )

Definition at line 54 of file cheats.qc.

55{
56}

Referenced by Shutdown().

◆ Drag()

float Drag ( entity this,
float force_allow_pick,
float ischeat )

Definition at line 754 of file cheats.qc.

755{
757
758 // returns true when an entity has been picked up
759 // If pick is true, the object can also be picked up if it's not being held already
760 // If pick is false, only keep dragging the object if it's already being held
761
762 switch(0)
763 {
764 default:
765 if(Drag_IsDragging(this))
766 {
767 if(PHYS_INPUT_BUTTON_DRAG(this))
768 {
769 if(CS(this).impulse == 10 || CS(this).impulse == 15 || CS(this).impulse == 18)
770 {
771 Drag_MoveForward(this);
772 CS(this).impulse = 0;
773 }
774 else if(CS(this).impulse == 12 || CS(this).impulse == 16 || CS(this).impulse == 19)
775 {
776 Drag_MoveBackward(this);
777 CS(this).impulse = 0;
778 }
779 else if(CS(this).impulse >= 1 && CS(this).impulse <= 9)
780 {
781 Drag_SetSpeed(this, CS(this).impulse - 1);
782 }
783 else if(CS(this).impulse == 14)
784 {
785 Drag_SetSpeed(this, 9);
786 }
787
788 if(frametime)
789 Drag_Update(this);
790 }
791 else
792 {
793 Drag_Finish(this);
794 }
795 }
796 else if(Drag_CanDrag(this) && PHYS_INPUT_BUTTON_DRAG(this))
797 {
799 entity e = trace_ent;
800 float pick = force_allow_pick;
801 if (e && !pick && vdist(this.origin - e.origin, <=, autocvar_g_grab_range))
802 {
803 // pick is true if the object can be picked up. While an object is being carried, the Drag() function
804 // must execute for it either way, otherwise it would cause bugs if it went out of the player's trace.
805 // This also makes sure that an object can only pe picked up if in range, but does not get dropped if
806 // it goes out of range while slinging it around.
807
808 switch(e.grab)
809 {
810 case 0: // can't grab
811 break;
812 case 1: // owner can grab
813 if(e.owner == this || e.realowner == this)
814 pick = true;
815 break;
816 case 2: // owner and teammates can grab
817 if(SAME_TEAM(e.owner, this) || SAME_TEAM(e.realowner, this) || e.team == this.team)
818 pick = true;
819 break;
820 case 3: // anyone can grab
821 pick = true;
822 break;
823 default:
824 break;
825 }
826 }
827 // Find e and pick
828 if(e && pick && Drag_IsDraggable(e, this))
829 {
830 if(ischeat)
831 IS_CHEAT(this, 0, 0, CHRAME_DRAG);
832 if(e.draggedby)
833 Drag_Finish(e.draggedby);
834 if(e.tag_entity)
836 Drag_Begin(this, e, trace_endpos);
837 if(ischeat)
838 DID_CHEAT();
839 return true;
840 }
841 }
842 break;
843 }
844 return false;
845}
float Drag_CanDrag(entity dragger)
Definition cheats.qc:984
void Drag_MoveBackward(entity dragger)
Definition cheats.qc:941
void Drag_Finish(entity dragger)
Definition cheats.qc:871
void Drag_Update(entity dragger)
Definition cheats.qc:946
void Drag_Begin(entity dragger, entity draggee, vector touchpoint)
Definition cheats.qc:847
float Drag_IsDraggable(entity draggee, entity dragger)
Definition cheats.qc:910
void Drag_SetSpeed(entity dragger, float s)
Definition cheats.qc:936
void Drag_MoveForward(entity dragger)
Definition cheats.qc:931
float Drag_IsDragging(entity dragger)
Definition cheats.qc:989
const float CHRAME_DRAG
Definition cheats.qh:19
float autocvar_g_grab_range
Definition cheats.qh:6
#define PHYS_INPUT_BUTTON_DRAG(s)
Definition player.qh:157
void detach_sameorigin(entity e)
Definition util.qc:2000
entity trace_ent
float frametime
float impulse
Definition progsdefs.qc:158
ClientState CS(Client this)
Definition state.qh:47
#define SAME_TEAM(a, b)
Definition teams.qh:241
void crosshair_trace_plusvisibletriggers(entity pl)
Definition tracing.qc:554
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
Definition vector.qh:8

References autocvar_g_grab_range, BEGIN_CHEAT_FUNCTION, CHRAME_DRAG, crosshair_trace_plusvisibletriggers(), CS(), detach_sameorigin(), DID_CHEAT, Drag_Begin(), Drag_CanDrag(), Drag_Finish(), Drag_IsDraggable(), Drag_IsDragging(), Drag_MoveBackward(), Drag_MoveForward(), Drag_SetSpeed(), Drag_Update(), entity(), frametime, impulse, IS_CHEAT, origin, PHYS_INPUT_BUTTON_DRAG, SAME_TEAM, trace_endpos, trace_ent, and vdist.

Referenced by CheatFrame().

◆ Drag_Begin()

void Drag_Begin ( entity dragger,
entity draggee,
vector touchpoint )

Definition at line 847 of file cheats.qc.

848{
849 float tagscale;
850
851 draggee.dragmovetype = draggee.move_movetype;
852 draggee.draggravity = draggee.gravity;
853 set_movetype(draggee, MOVETYPE_WALK);
854 draggee.gravity = 0.00001;
855 UNSET_ONGROUND(draggee);
856 draggee.draggedby = dragger;
857
858 dragger.dragentity = draggee;
859
860 dragger.dragdistance = vlen(touchpoint - dragger.origin - dragger.view_ofs);
861 dragger.draglocalangle = draggee.angles.y - dragger.v_angle.y;
862 touchpoint = touchpoint - gettaginfo(draggee, 0);
863 tagscale = (vlen(v_forward) ** -2);
864 dragger.draglocalvector_x = touchpoint * v_forward * tagscale;
865 dragger.draglocalvector_y = touchpoint * v_right * tagscale;
866 dragger.draglocalvector_z = touchpoint * v_up * tagscale;
867
868 dragger.dragspeed = 64;
869}
vector v_up
vector v_right
#define UNSET_ONGROUND(s)
Definition movetypes.qh:18
#define gettaginfo
Definition post.qh:32

References entity(), gettaginfo, MOVETYPE_WALK, set_movetype(), UNSET_ONGROUND, v_forward, v_right, v_up, vector, and vlen().

Referenced by Drag().

◆ Drag_CanDrag()

float Drag_CanDrag ( entity dragger)

Definition at line 984 of file cheats.qc.

985{
986 return (!IS_DEAD(dragger)) || (IS_PLAYER(dragger));
987}

References entity(), IS_DEAD, and IS_PLAYER.

Referenced by Drag(), and Drag_IsDragging().

◆ Drag_Finish()

void Drag_Finish ( entity dragger)

Definition at line 871 of file cheats.qc.

872{
873 entity draggee;
874 draggee = dragger.dragentity;
875 if(dragger)
876 dragger.dragentity = NULL;
877 draggee.draggedby = NULL;
878 set_movetype(draggee, draggee.dragmovetype);
879 draggee.gravity = draggee.draggravity;
880
881 switch(draggee.move_movetype)
882 {
883 case MOVETYPE_TOSS:
884 case MOVETYPE_WALK:
885 case MOVETYPE_STEP:
887 case MOVETYPE_BOUNCE:
889 case MOVETYPE_PHYSICS:
890 break;
891 default:
892 draggee.velocity = '0 0 0';
893 break;
894 }
895
896 if((draggee.flags & FL_ITEM) && (vdist(draggee.velocity, <, 32)))
897 {
898 draggee.velocity = '0 0 0';
899 SET_ONGROUND(draggee); // floating items are FUN
900 }
901}
const int FL_ITEM
Definition constants.qh:77
const int MOVETYPE_STEP
Definition movetypes.qh:133
const int MOVETYPE_FLYMISSILE
Definition movetypes.qh:138
#define SET_ONGROUND(s)
Definition movetypes.qh:17
const int MOVETYPE_BOUNCEMISSILE
Definition movetypes.qh:140
const int MOVETYPE_PHYSICS
Definition movetypes.qh:142
const int MOVETYPE_TOSS
Definition movetypes.qh:135
const int MOVETYPE_BOUNCE
Definition movetypes.qh:139

References entity(), FL_ITEM, MOVETYPE_BOUNCE, MOVETYPE_BOUNCEMISSILE, MOVETYPE_FLYMISSILE, MOVETYPE_PHYSICS, MOVETYPE_STEP, MOVETYPE_TOSS, MOVETYPE_WALK, NULL, set_movetype(), SET_ONGROUND, and vdist.

Referenced by Drag(), and Drag_IsDragging().

◆ Drag_IsDraggable()

bool Drag_IsDraggable ( entity draggee,
entity dragger )

Definition at line 910 of file cheats.qc.

911{
912 // TODO add more checks for bad stuff here
913 if(draggee == NULL)
914 return false;
915 if(draggee.classname == "door") // FIXME find out why these must be excluded, or work around the problem (trying to drag these causes like 4 fps)
916 return false; // probably due to BSP collision
917 //if(draggee.model == "")
918 // return false;
919
920 return ((draggee.draggable) ? draggee.draggable(draggee, dragger) : true);
921}

References entity(), and NULL.

Referenced by Drag(), and Drag_IsDragging().

◆ Drag_IsDragging()

float Drag_IsDragging ( entity dragger)

Definition at line 989 of file cheats.qc.

990{
991 if(!dragger.dragentity)
992 return false;
993 if(wasfreed(dragger.dragentity) || dragger.dragentity.draggedby != dragger)
994 {
995 dragger.dragentity = NULL;
996 return false;
997 }
998 if(!Drag_CanDrag(dragger) || !Drag_IsDraggable(dragger.dragentity, dragger))
999 {
1000 Drag_Finish(dragger);
1001 return false;
1002 }
1003 return true;
1004}

References Drag_CanDrag(), Drag_Finish(), Drag_IsDraggable(), entity(), and NULL.

Referenced by Drag().

◆ Drag_MayChangeAngles()

float Drag_MayChangeAngles ( entity draggee)

Definition at line 923 of file cheats.qc.

924{
925 // TODO add more checks for bad stuff here
926 if(substring(draggee.model, 0, 1) == "*")
927 return false;
928 return true;
929}

References entity(), and substring().

Referenced by Drag_Update().

◆ Drag_MoveBackward()

void Drag_MoveBackward ( entity dragger)

Definition at line 941 of file cheats.qc.

942{
943 dragger.dragdistance = max(0, dragger.dragdistance - dragger.dragspeed);
944}

References entity(), and max().

Referenced by Drag().

◆ Drag_MoveDrag()

void Drag_MoveDrag ( entity from,
entity to )

Definition at line 1006 of file cheats.qc.

1007{
1008 if(from.draggedby)
1009 {
1010 to.draggedby = from.draggedby;
1011 to.draggedby.dragentity = to;
1012 from.draggedby = NULL;
1013 }
1014}

References entity(), and NULL.

Referenced by CopyBody().

◆ Drag_MoveForward()

void Drag_MoveForward ( entity dragger)

Definition at line 931 of file cheats.qc.

932{
933 dragger.dragdistance += dragger.dragspeed;
934}

References entity().

Referenced by Drag().

◆ Drag_SetSpeed()

void Drag_SetSpeed ( entity dragger,
float s )

Definition at line 936 of file cheats.qc.

937{
938 dragger.dragspeed = (2 ** s);
939}

References entity().

Referenced by Drag().

◆ drag_undraggable()

bool drag_undraggable ( entity draggee,
entity dragger )

Definition at line 903 of file cheats.qc.

904{
905 // stuff probably shouldn't need this, we should figure out why they do!
906 // exceptions of course are observers and weapon entities, where things mess up
907 return false;
908}

References entity().

Referenced by CL_SpawnWeaponentity(), PutObserverInServer(), spawnfunc(), spawnfunc(), and spawnfunc().

◆ Drag_Update()

void Drag_Update ( entity dragger)

Definition at line 946 of file cheats.qc.

947{
948 vector curorigin, neworigin, goodvelocity;
949 float f;
950 entity draggee;
951
952 draggee = dragger.dragentity;
953 UNSET_ONGROUND(draggee);
954
955 curorigin = gettaginfo(draggee, 0);
956 curorigin = curorigin + v_forward * dragger.draglocalvector.x + v_right * dragger.draglocalvector.y + v_up * dragger.draglocalvector.z;
957 makevectors(dragger.v_angle);
958 neworigin = dragger.origin + dragger.view_ofs + v_forward * dragger.dragdistance;
959 goodvelocity = (neworigin - curorigin) * (1 / frametime);
960
961 while(draggee.angles.y - dragger.v_angle.y - dragger.draglocalangle > 180)
962 dragger.draglocalangle += 360;
963 while(draggee.angles.y - dragger.v_angle.y - dragger.draglocalangle <= -180)
964 dragger.draglocalangle -= 360;
965
966 f = min(frametime * 10, 1);
967 draggee.velocity = draggee.velocity * (1 - f) + goodvelocity * f;
968
969 if(Drag_MayChangeAngles(draggee))
970 draggee.angles_y = draggee.angles.y * (1 - f) + (dragger.v_angle.y + dragger.draglocalangle) * f;
971
972 draggee.ltime = max(servertime + serverframetime, draggee.ltime); // fixes func_train breakage
973
974 vector vecs = '0 0 0';
975 .entity weaponentity = weaponentities[0]; // TODO: unhardcode
976 if(dragger.(weaponentity).movedir.x > 0)
977 vecs = dragger.(weaponentity).movedir;
978
979 vector dv = v_right * -vecs_y + v_up * vecs_z;
980
981 te_lightning1(draggee, dragger.origin + dragger.view_ofs + dv, curorigin);
982}
float Drag_MayChangeAngles(entity draggee)
Definition cheats.qc:923
float servertime
Definition net.qh:348
vector movedir
Definition viewloc.qh:18
float min(float f,...)
float serverframetime
Definition main.qh:39

References Drag_MayChangeAngles(), entity(), frametime, gettaginfo, makevectors, max(), min(), movedir, serverframetime, servertime, UNSET_ONGROUND, v_forward, v_right, v_up, vector, and weaponentities.

Referenced by Drag().

◆ DragBox_Think()

void DragBox_Think ( entity this)

Definition at line 1016 of file cheats.qc.

1017{
1018 if(this.aiment && this.enemy)
1019 {
1020 this.origin_x = (this.aiment.origin.x + this.enemy.origin.x) * 0.5;
1021 this.origin_y = (this.aiment.origin.y + this.enemy.origin.y) * 0.5;
1022 this.origin_z = (this.aiment.origin.z + this.enemy.origin.z) * 0.5;
1023 this.maxs_x = fabs(this.aiment.origin.x - this.enemy.origin.x) * 0.5;
1024 this.maxs_y = fabs(this.aiment.origin.y - this.enemy.origin.y) * 0.5;
1025 this.maxs_z = fabs(this.aiment.origin.z - this.enemy.origin.z) * 0.5;
1026 this.mins = -1 * this.maxs;
1027 setorigin(this, this.origin);
1028 setsize(this, this.mins, this.maxs); // link edict
1029 }
1030
1031 if(this.cnt == -1) // actually race_place -1
1032 {
1033 // show "10 10" for qualifying spawns
1034 setmodel(this.killindicator, MDL_NUM(10));
1035 setmodel(this.killindicator.killindicator, MDL_NUM(10));
1036 }
1037 else if(this.cnt == -2) // actually race_place 0
1038 {
1039 // show "10 0" for loser spawns
1040 setmodel(this.killindicator, MDL_NUM(10));
1041 setmodel(this.killindicator.killindicator, MDL_NUM(0));
1042 }
1043 else
1044 {
1045 setmodel(this.killindicator, MDL_NUM(this.cnt % 10));
1046 setmodel(this.killindicator.killindicator, MDL_NUM(floor(this.cnt / 10)));
1047 }
1048
1049 this.nextthink = time;
1050}
float cnt
Definition powerups.qc:24
entity killindicator
Definition clientkill.qh:7
vector mins
vector maxs
float nextthink
float fabs(float f)
float floor(float f)
Model MDL_NUM(int i)
Definition all.inc:229
entity aiment
Definition movetypes.qh:90
entity enemy
Definition sv_ctf.qh:153

References aiment, cnt, enemy, entity(), fabs(), floor(), killindicator, maxs, MDL_NUM(), mins, nextthink, origin, setmodel, and time.

Referenced by CheatCommand().

Variable Documentation

◆ autocvar_g_grab_range

float autocvar_g_grab_range

Definition at line 6 of file cheats.qh.

Referenced by Drag().

◆ autocvar_g_max_info_autoscreenshot

int autocvar_g_max_info_autoscreenshot

Definition at line 7 of file cheats.qh.

Referenced by spawnfunc().

◆ autocvar_sv_cheats

int autocvar_sv_cheats

Definition at line 5 of file cheats.qh.

Referenced by CampaignPreInit(), CheatFrame(), CheatInit(), CheatsAllowed(), and SpecialCommand().

◆ autocvar_sv_clones

int autocvar_sv_clones

Definition at line 8 of file cheats.qh.

Referenced by CheatsAllowed().

◆ cheatcount

float cheatcount

Definition at line 11 of file cheats.qh.

◆ cheatcount_total

float cheatcount_total

Definition at line 10 of file cheats.qh.

Referenced by CampaignPreIntermission(), and Shutdown().

◆ CHRAME_DRAG

const float CHRAME_DRAG = 8

Definition at line 19 of file cheats.qh.

Referenced by Drag().

◆ grab

int grab

Definition at line 26 of file cheats.qh.

Referenced by Monster_Spawn(), and sandbox_ObjectFunction_Think().

◆ personal

entity personal

Definition at line 24 of file cheats.qh.

Referenced by CheatImpulse(), ClientDisconnect(), IMPULSE(), IMPULSE(), and PlayerThink().

◆ speedrunning

bool speedrunning

Definition at line 22 of file cheats.qh.

Referenced by CheatImpulse(), ctf_FlagThink(), and PutPlayerInServer().