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 290 of file cheats.qc.

291{
293 string cmd = argv(0);
294 switch(cmd)
295 {
296 float effectnum, f;
297 vector start, end;
298
299 case "pointparticles":
300 IS_CHEAT(this, 0, argc, 0);
301 if(argc == 5)
302 {
303 f = stof(argv(2));
304 crosshair_trace(this); // particles can't go through warpzones
305 start = (1-f) * this.origin + f * trace_endpos;
306 end = stov(argv(3));
307 f = stof(argv(4));
308 Send_Effect_(argv(1), start, end, f);
309 DID_CHEAT();
310 break;
311 }
312 sprint(this, "Usage:^3 [sv_cheats 1; restart;] cmd pointparticles <effectname> <position> <velocity> <countmultiplier>\n");
313 sprint(this, " Where <position> is a number from 0 to 1 representing distance on the crosshair line,\n");
314 sprint(this, " and <velocity> is a vector \"x y z\"\n");
315 break;
316 case "trailparticles":
317 IS_CHEAT(this, 0, argc, 0);
318 if(argc == 2)
319 {
320 effectnum = _particleeffectnum(argv(1));
321 makevectors(this.v_angle); // W_SetupShot uses v_forward
322 W_SetupShot(this, weaponentities[0], false, false, SND_Null, CH_WEAPON_A, 0, 0);
324 DID_CHEAT();
325 break;
326 }
327 sprint(this, "Usage:^3 [sv_cheats 1; restart;] cmd trailparticles <effectname>\n");
328 break;
329 case "make":
330 IS_CHEAT(this, 0, argc, 0);
331 if(argc == 3)
332 {
333 f = stof(argv(2));
334 makevectors(this.v_angle); // W_SetupShot uses v_forward
335 W_SetupShot(this, weaponentities[0], false, false, SND_Null, CH_WEAPON_A, 0, 0);
338 sprint(this, "cannot make stuff there (bad surface)\n");
339 else
340 {
341 entity e = new(func_breakable);
342 e.model = strzone(argv(1));
343 e.mdl = "rocket_explode";
344 SetResourceExplicit(e, RES_HEALTH, 1000);
345 setorigin(e, trace_endpos);
346 e.effects = EF_NOMODELFLAGS;
347 if(f == 1)
348 {
350 e.angles = AnglesTransform_ApplyToAngles(e.angles, '-90 0 0'); // so unrotated models work
351 }
353 // now, is it valid?
354 if(f == 0)
355 {
356 tracebox(e.origin, e.mins, e.maxs, e.origin, MOVE_NOMONSTERS, e);
358 {
359 delete(e);
360 sprint(this, "cannot make stuff there (no space)\n");
361 }
362 else
363 DID_CHEAT();
364 }
365 else
366 DID_CHEAT();
367 }
368 }
369 else
370 {
371 sprint(this, "Usage:^3 [sv_cheats 1; restart;] cmd make <modelname> <mode>\n");
372 sprint(this, " where <mode> can be 0, 1 or 2\n");
373 }
374 break;
375 case "penalty":
376 IS_CHEAT(this, 0, argc, 0);
377 if(argc == 3)
378 {
379 race_ImposePenaltyTime(this, stof(argv(1)), argv(2));
380 DID_CHEAT();
381 break;
382 }
383 sprint(this, "Usage:^3 [sv_cheats 1; restart;] cmd penalty <duration> <reason>\n");
384 break;
385 case "dragbox_spawn": {
386 IS_CHEAT(this, 0, argc, 0);
387 entity e = new(dragbox_box);
389 e.nextthink = time;
390 e.solid = -1; // black
391 setmodel(e, MDL_Null); // network it
392 if(argc == 4)
393 e.cnt = stof(argv(1));
394 else
395 e.cnt = max(0, drag_lastcnt);
396
397 e.aiment = new(dragbox_corner_1);
398 e.aiment.owner = e;
399 setmodel(e.aiment, MDL_MARKER);
400 e.aiment.skin = 0;
401 setsize(e.aiment, '0 0 0', '0 0 0');
402 vector view_org = this.origin + this.view_ofs;
403 if(argc == 4)
404 setorigin(e.aiment, stov(argv(2)));
405 else
406 {
408 setorigin(e.aiment, trace_endpos);
410 }
411
412 e.enemy = new(dragbox_corner_2);
413 e.enemy.owner = e;
414 setmodel(e.enemy, MDL_MARKER);
415 e.enemy.skin = 1;
416 setsize(e.enemy, '0 0 0', '0 0 0');
417 end = normalize(view_org - e.aiment.origin);
418 end.x = (end.x > 0) * 2 - 1;
419 end.y = (end.y > 0) * 2 - 1;
420 end.z = (end.z > 0) * 2 - 1;
421 if(argc == 4)
422 setorigin(e.enemy, stov(argv(3)));
423 else
424 setorigin(e.enemy, e.aiment.origin + 32 * end);
425
426 e.killindicator = new(drag_digit);
427 e.killindicator.owner = e;
428 setattachment(e.killindicator, e, "");
429 setorigin(e.killindicator, '0 0 -8');
430 e.killindicator.killindicator = new(drag_digit);
431 e.killindicator.killindicator.owner = e;
432 setattachment(e.killindicator.killindicator, e, "");
433 setorigin(e.killindicator.killindicator, '0 0 8');
434 DID_CHEAT();
435 break;
436 }
437 case "dragpoint_spawn": {
438 IS_CHEAT(this, 0, argc, 0);
439 entity e = new(dragpoint);
441 e.nextthink = time;
442 e.solid = 0; // nothing special
443 setmodel(e, MDL_MARKER);
444 setsize(e, STAT(PL_MIN, this), STAT(PL_MAX, this));
445 e.skin = 2;
446 if(argc == 3)
447 e.cnt = stof(argv(1));
448 else
449 e.cnt = drag_lastcnt;
450 if(argc == 3)
451 setorigin(e, stov(argv(2)));
452 else
453 {
457 }
458
459 e.killindicator = new(drag_digit);
460 e.killindicator.owner = e;
461 setattachment(e.killindicator, e, "");
462 setorigin(e.killindicator, '0 0 40');
463 e.killindicator.killindicator = new(drag_digit);
464 e.killindicator.killindicator.owner = e;
465 setattachment(e.killindicator.killindicator, e, "");
466 setorigin(e.killindicator.killindicator, '0 0 56');
467 DID_CHEAT();
468 break;
469 }
470 case "drag_remove":
471 IS_CHEAT(this, 0, argc, 0);
474 // FIXME: vlens aren't warpzone-aware
475 for(entity e = NULL; (e = find(e, classname, "dragbox_box")); )
476 RandomSelection_AddEnt(e, 1, 1 / vlen(e.origin + (e.mins + e.maxs) * 0.5 - trace_endpos));
477 for(entity e = NULL; (e = find(e, classname, "dragpoint")); )
478 RandomSelection_AddEnt(e, 1, 1 / vlen(e.origin + (e.mins + e.maxs) * 0.5 - trace_endpos));
480 {
481 delete(RandomSelection_chosen_ent.killindicator.killindicator);
482 delete(RandomSelection_chosen_ent.killindicator);
484 delete(RandomSelection_chosen_ent.aiment);
486 delete(RandomSelection_chosen_ent.enemy);
488 }
489 DID_CHEAT();
490 break;
491 case "drag_setcnt":
492 IS_CHEAT(this, 0, argc, 0);
493 if(argc == 2)
494 {
497 // FIXME: vlens aren't warpzone-aware
498 for(entity e = NULL; (e = find(e, classname, "dragbox_box")); )
499 RandomSelection_AddEnt(e, 1, 1 / vlen(e.origin + (e.mins + e.maxs) * 0.5 - trace_endpos));
500 for(entity e = NULL; (e = find(e, classname, "dragpoint")); )
501 RandomSelection_AddEnt(e, 1, 1 / vlen(e.origin + (e.mins + e.maxs) * 0.5 - trace_endpos));
503 {
504 if(substring(argv(1), 0, 1) == "*")
506 else
508 }
509 DID_CHEAT();
510 break;
511 }
512 sprint(this, "Usage:^3 [sv_cheats 1; restart;] cmd dragbox_setcnt <cnt>\n");
513 break;
514 case "drag_save":
515 IS_CHEAT(this, 0, argc, 0);
516 if(argc == 2)
517 {
518 f = fopen(argv(1), FILE_WRITE);
519 fputs(f, "cmd drag_clear\n");
520 for(entity e = NULL; (e = find(e, classname, "dragbox_box")); )
521 {
522 fputs(f, strcat("cmd dragbox_spawn ", ftos(e.cnt), " \"", vtos(e.aiment.origin), "\" \"", vtos(e.enemy.origin), "\"\n"));
523 }
524 for(entity e = NULL; (e = find(e, classname, "dragpoint")); )
525 {
526 fputs(f, strcat("cmd dragpoint_spawn ", ftos(e.cnt), " \"", vtos(e.origin), "\"\n"));
527 }
528 fclose(f);
529 DID_CHEAT();
530 break;
531 }
532 sprint(this, "Usage:^3 [sv_cheats 1; restart;] cmd dragbox_save <filename>\n");
533 break;
534 case "drag_saveraceent":
535 IS_CHEAT(this, 0, argc, 0);
536 if(argc == 2)
537 {
538 f = fopen(argv(1), FILE_WRITE);
539 for(entity e = NULL; (e = find(e, classname, "dragbox_box")); )
540 {
541 fputs(f, "{\n");
542 fputs(f, "\"classname\" \"trigger_race_checkpoint\"\n");
543 fputs(f, strcat("\"origin\" \"", ftos(e.absmin.x), " ", ftos(e.absmin.y), " ", ftos(e.absmin.z), "\"\n"));
544 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"));
545 fputs(f, strcat("\"cnt\" \"", ftos(e.cnt), "\"\n"));
546 fputs(f, strcat("\"targetname\" \"checkpoint", ftos(e.cnt), "\"\n"));
547 fputs(f, "}\n");
548 }
549 for(entity e = NULL; (e = find(e, classname, "dragpoint")); )
550 {
551 start = '0 0 0';
552 effectnum = 0;
553 for(entity ent = NULL; (ent = find(ent, classname, "dragbox_box")); )
554 {
555 if((e.cnt <= 0 && ent.cnt == 0) || e.cnt == ent.cnt)
556 {
557 start += ent.origin;
558 ++effectnum;
559 }
560 }
561 start *= 1 / effectnum;
562 fputs(f, "{\n");
563 fputs(f, "\"classname\" \"info_player_race\"\n");
564 fputs(f, strcat("\"angle\" \"", ftos(vectoyaw(start - e.origin)), "\"\n"));
565 fputs(f, strcat("\"origin\" \"", ftos(e.origin.x), " ", ftos(e.origin.y), " ", ftos(e.origin.z), "\"\n"));
566 if(e.cnt == -2)
567 {
568 fputs(f, "\"target\" \"checkpoint0\"\n");
569 fputs(f, "\"race_place\" \"0\"\n");
570 }
571 else if(e.cnt == -1)
572 {
573 fputs(f, "\"target\" \"checkpoint0\"\n");
574 fputs(f, "\"race_place\" \"-1\"\n");
575 }
576 else
577 {
578 fputs(f, strcat("\"target\" \"checkpoint", ftos(e.cnt), "\"\n"));
579 if(e.cnt == 0)
580 {
581 // these need race_place
582 // counting...
583 effectnum = 1;
584 for(entity ent = NULL; (ent = find(ent, classname, "dragpoint")); )
585 if(ent.cnt == 0)
586 {
587 if(vlen2(ent.origin - start) < vlen2(e.origin - start))
588 ++effectnum;
589 else if(vlen2(ent.origin - start) == vlen2(e.origin - start) && etof(ent) < etof(e))
590 ++effectnum;
591 }
592 fputs(f, strcat("\"race_place\" \"", ftos(effectnum), "\"\n"));
593 }
594 }
595 fputs(f, "}\n");
596 }
597 fclose(f);
598 DID_CHEAT();
599 break;
600 }
601 sprint(this, "Usage:^3 [sv_cheats 1; restart;] cmd dragbox_save <filename>\n");
602 break;
603 case "drag_clear":
604 IS_CHEAT(this, 0, argc, 0);
605 for(entity e = NULL; (e = find(e, classname, "dragbox_box")); )
606 delete(e);
607 for(entity e = NULL; (e = find(e, classname, "dragbox_corner_1")); )
608 delete(e);
609 for(entity e = NULL; (e = find(e, classname, "dragbox_corner_2")); )
610 delete(e);
611 for(entity e = NULL; (e = find(e, classname, "dragpoint")); )
612 delete(e);
613 for(entity e = NULL; (e = find(e, classname, "drag_digit")); )
614 delete(e);
615 DID_CHEAT();
616 break;
617 case "god":
618 IS_CHEAT(this, 0, argc, 0);
620 if(this.flags & FL_GODMODE)
621 {
622 sprint(this, "godmode ON\n");
623 DID_CHEAT();
624 }
625 else
626 sprint(this, "godmode OFF\n");
627 break;
628 case "notarget":
629 IS_CHEAT(this, 0, argc, 0);
631 if(this.flags & FL_NOTARGET)
632 {
633 sprint(this, "notarget ON\n");
634 DID_CHEAT();
635 }
636 else
637 sprint(this, "notarget OFF\n");
638 break;
639 case "noclip":
640 IS_CHEAT(this, 0, argc, 0);
642 {
644 sprint(this, "noclip ON\n");
645 DID_CHEAT();
646 }
647 else
648 {
650 sprint(this, "noclip OFF\n");
651 }
652 break;
653 case "fly":
654 IS_CHEAT(this, 0, argc, 0);
655 if(this.move_movetype != MOVETYPE_FLY)
656 {
658 sprint(this, "flymode ON\n");
659 DID_CHEAT();
660 }
661 else
662 {
664 sprint(this, "flymode OFF\n");
665 }
666 break;
667 case "give":
668 IS_CHEAT(this, 0, argc, 0);
669 if(GiveItems(this, 1, argc))
670 DID_CHEAT();
671 break;
672 case "usetarget":
673 IS_CHEAT(this, 0, argc, 0);
674 entity e = spawn();
675 e.target = argv(1);
676 SUB_UseTargets(e, this, NULL);
677 delete(e);
678 DID_CHEAT();
679 break;
680 case "killtarget":
681 IS_CHEAT(this, 0, argc, 0);
682 entity e2 = spawn();
683 e2.killtarget = argv(1);
684 SUB_UseTargets(e2, this, NULL);
685 delete(e2);
686 DID_CHEAT();
687 break;
688 case "teleporttotarget":
689 IS_CHEAT(this, 0, argc, 0);
690 entity ent = new(cheattriggerteleport);
691 setorigin(ent, ent.origin);
692 ent.target = argv(1);
694 if(!wasfreed(ent))
695 {
696 Simple_TeleportPlayer(ent, this);
697 delete(ent);
698 DID_CHEAT();
699 }
700 break;
701 }
702
704}
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:1010
#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:289
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define setmodel(this, m)
Definition model.qh:26
vector v_angle
Definition player.qh:236
const int FL_NOTARGET
Definition constants.qh:68
const int FL_GODMODE
Definition constants.qh:67
string classname
float flags
const float MOVE_NOMONSTERS
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:160
SetResourceExplicit(ent, RES_ARMOR, ReadByte() *DEC_FACTOR)) ENTCS_PROP(NAME
void SUB_UseTargets(entity this, entity actor, entity trigger)
Definition triggers.qc:344
#define STAT(...)
Definition stats.qh:94
vector WarpZone_TransformOrigin(entity wz, vector org)
Transforms origin org across warpzone wz.
Definition common.qc:489
void WarpZone_TrailParticles(entity own, float eff, vector org, vector end)
Definition common.qc:446
#define WarpZone_TraceLine(org, end, nomonsters, forent)
Definition common.qh:51
entity WarpZone_trace_transform
Transform accumulator during a trace.
Definition common.qh:40
#define move_out_of_solid(e)
Definition common.qh:128
#define BITXOR_ASSIGN(a, b)
Definition common.qh:125
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:136
float move_movetype
Definition movetypes.qh:80
const int MOVETYPE_NOCLIP
Definition movetypes.qh:141
const int MOVETYPE_FLY
Definition movetypes.qh:138
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
#define NULL
Definition post.qh:14
#define makevectors
Definition post.qh:21
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:96
float GiveItems(entity e, float beginarg, float endarg)
Definition items.qc:1437
void race_ImposePenaltyTime(entity pl, float penalty, string reason)
Definition race.qc:1275
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:565
void WarpZone_crosshair_trace(entity pl)
Definition tracing.qc:602
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:245
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, makevectors, max(), max_shot_distance, move_movetype, MOVE_NOMONSTERS, 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_angle, v_forward, vector, vectoyaw(), view_ofs, vlen(), vlen2, vtos(), W_SetupShot, w_shotdir, w_shotorg, WarpZone_crosshair_trace(), WarpZone_trace_transform, WarpZone_TraceLine, WarpZone_TrailParticles(), WarpZone_TransformOrigin(), and weaponentities.

Referenced by CheatImpulse(), and SV_ParseClientCommand().

◆ CheatFrame()

float CheatFrame ( entity this)

Definition at line 708 of file cheats.qc.

709{
711
712 // Dragging can be used as either a cheat, or a function for some objects. If sv_cheats is active,
713 // the cheat dragging is used (unlimited pickup range and any entity can be carried). If sv_cheats
714 // is disabled, normal dragging is used (limited pickup range and only dragable objects can be carried),
715 // grabbing itself no longer being accounted as cheating.
716
717 switch(0)
718 {
719 default:
721 {
722 // use cheat dragging if cheats are enabled
723 //if(Drag_IsDragging(this))
724 //WarpZone_crosshair_trace_plusvisibletriggers(this);
725 Drag(this, true, true);
726 }
727 else
728 {
729 Drag(this, false, false); // execute dragging
730 }
731 break;
732 }
733
735}
bool maycheat
Definition cheats.qc:44
float Drag(entity this, float force_allow_pick, float ischeat)
Definition cheats.qc:753
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.

Referenced by PlayerFrame().

◆ CheatImpulse()

float CheatImpulse ( entity this,
int imp )

Definition at line 137 of file cheats.qc.

138{
140 switch(imp)
141 {
142 entity e, e2;
143
144 case CHIMPULSE_SPEEDRUN_INIT.impulse: // deploy personal waypoint
145 // shared with regular waypoint init, so this is not a cheat by itself
146 if(!this.personal)
147 {
148 this.personal = new(personal_wp);
149 }
150 this.personal.origin = this.origin;
151 this.personal.v_angle = this.v_angle;
152 this.personal.velocity = this.velocity;
153 SetResource(this.personal, RES_ROCKETS, GetResource(this, RES_ROCKETS));
154 SetResource(this.personal, RES_BULLETS, GetResource(this, RES_BULLETS));
155 SetResource(this.personal, RES_CELLS, GetResource(this, RES_CELLS));
156 SetResource(this.personal, RES_SHELLS, GetResource(this, RES_SHELLS));
157 SetResource(this.personal, RES_FUEL, GetResource(this, RES_FUEL));
158 SetResource(this.personal, RES_HEALTH, max(1, GetResource(this, RES_HEALTH)));
160 STAT(WEAPONS, this.personal) = STAT(WEAPONS, this);
162 this.personal.items = this.items;
163 this.personal.pauserotarmor_finished = this.pauserotarmor_finished;
164 this.personal.pauserothealth_finished = this.pauserothealth_finished;
165 this.personal.pauserotfuel_finished = this.pauserotfuel_finished;
166 this.personal.pauseregen_finished = this.pauseregen_finished;
167 this.personal.teleport_time = time;
168 break; // this part itself doesn't cheat, so let's not count this
169 case CHIMPULSE_CLONE_MOVING.impulse:
170 IS_CHEAT(this, imp, 0, 0);
171 makevectors (this.v_angle);
172 this.velocity += v_forward * 300;
173 CopyBody(this, 1);
174 ++this.lip;
175 this.velocity -= v_forward * 300;
176 DID_CHEAT();
177 break;
178 case CHIMPULSE_CLONE_STANDING.impulse:
179 IS_CHEAT(this, imp, 0, 0);
180 CopyBody(this, 0);
181 ++this.lip;
182 DID_CHEAT();
183 break;
184 case CHIMPULSE_GIVE_ALL.impulse:
185 IS_CHEAT(this, imp, 0, 0);
186 CheatCommand(this, tokenize_console("give all"));
187 break; // already counted as cheat
188 case CHIMPULSE_SPEEDRUN.impulse:
190 IS_CHEAT(this, imp, 0, 0);
191 if(this.personal)
192 {
193 this.speedrunning = true;
194 tracebox(this.personal.origin, this.mins, this.maxs, this.personal.origin, MOVE_WORLDONLY, this);
196 {
197 sprint(this, "Cannot move there, cheater - only waypoints set using waypoint_personal_here work\n");
198 }
199 else
200 {
201 // Abort speedrun, teleport back
202 setorigin(this, this.personal.origin);
203 this.oldvelocity = this.velocity = this.personal.velocity;
204 this.angles = this.personal.v_angle;
205 this.fixangle = true;
206
207 MUTATOR_CALLHOOK(AbortSpeedrun, this);
208 }
209
210 SetResource(this, RES_ROCKETS, GetResource(this.personal, RES_ROCKETS));
211 SetResource(this, RES_BULLETS, GetResource(this.personal, RES_BULLETS));
212 SetResource(this, RES_CELLS, GetResource(this.personal, RES_CELLS));
213 SetResource(this, RES_SHELLS, GetResource(this.personal, RES_SHELLS));
214 SetResource(this, RES_FUEL, GetResource(this.personal, RES_FUEL));
215 SetResource(this, RES_HEALTH, GetResource(this.personal, RES_HEALTH));
217 STAT(WEAPONS, this) = STAT(WEAPONS, this.personal);
218 this.items = this.personal.items;
219 this.pauserotarmor_finished = time + this.personal.pauserotarmor_finished - this.personal.teleport_time;
220 this.pauserothealth_finished = time + this.personal.pauserothealth_finished - this.personal.teleport_time;
221 this.pauserotfuel_finished = time + this.personal.pauserotfuel_finished - this.personal.teleport_time;
222 this.pauseregen_finished = time + this.personal.pauseregen_finished - this.personal.teleport_time;
223 StatusEffects_copy(this.personal, this.statuseffects, this.personal.teleport_time);
225
227 DID_CHEAT();
228 break;
229 }
230 if(IS_DEAD(this))
231 sprint(this, "UR DEAD AHAHAH))\n");
232 else
233 sprint(this, "No waypoint set, cheater (use waypoint_personal_here to set one)\n");
234 break;
235 case CHIMPULSE_TELEPORT.impulse:
236 IS_CHEAT(this, imp, 0, 0);
238 {
239 e = find(NULL, classname, "info_autoscreenshot");
240 if(e)
241 {
242 sprint(this, "Emergency teleport used info_autoscreenshot location\n");
243 setorigin(this, e.origin);
244 this.angles = e.angles;
245 delete(e);
246 // should we? this.angles_x = -this.angles_x;
247 this.fixangle = true;
248 this.velocity = '0 0 0';
249 DID_CHEAT();
250 break;
251 }
252 }
254 {
255 sprint(this, "Emergency teleport used random location\n");
256 this.angles_x = -this.angles.x;
257 this.fixangle = true;
258 this.velocity = '0 0 0';
259 DID_CHEAT();
260 break;
261 }
262 sprint(this, "Emergency teleport could not find a good location, forget it!\n");
263 break;
264 case CHIMPULSE_R00T.impulse:
265 IS_CHEAT(this, imp, 0, 0);
267 FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it) && DIFF_TEAM(it, this), { RandomSelection_AddEnt(it, 1, 1); });
270 else
271 e = this;
272
273 Send_Effect(EFFECT_ROCKET_EXPLODE, e.origin, '0 0 0', 1);
274 sound(e, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
275
276 e2 = spawn();
277 setorigin(e2, e.origin);
278 RadiusDamage(e2, this, 1000, 0, 128, NULL, NULL, 500, DEATH_CHEAT.m_id, DMG_NOWEP, e);
279 delete(e2);
280
281 LOG_INFO("404 Sportsmanship not found.");
282 DID_CHEAT();
283 break;
284 }
285
287}
#define MUTATOR_CALLHOOK(id,...)
Definition base.qh:143
float CheatCommand(entity this, int argc)
Definition cheats.qc:290
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:226
#define IS_DEAD(s)
Definition player.qh:244
#define IS_PLAYER(s)
Definition player.qh:242
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:937
#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:155
RES_ARMOR
Definition ent_cs.qc:155
ent angles
Definition ent_cs.qc:146
#define LOG_INFO(...)
Definition log.qh:62
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:52
float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, float badsurfaceflags, float attempts, float maxaboveground, float minviewdistance)
Definition world.qc:1251

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:2190
#define bprintf(...)
Definition util.qh:234

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 753 of file cheats.qc.

754{
756
757 // returns true when an entity has been picked up
758 // If pick is true, the object can also be picked up if it's not being held already
759 // If pick is false, only keep dragging the object if it's already being held
760
761 switch(0)
762 {
763 default:
764 if(Drag_IsDragging(this))
765 {
766 if(PHYS_INPUT_BUTTON_DRAG(this))
767 {
768 if(CS(this).impulse == 10 || CS(this).impulse == 15 || CS(this).impulse == 18)
769 {
770 Drag_MoveForward(this);
771 CS(this).impulse = 0;
772 }
773 else if(CS(this).impulse == 12 || CS(this).impulse == 16 || CS(this).impulse == 19)
774 {
775 Drag_MoveBackward(this);
776 CS(this).impulse = 0;
777 }
778 else if(CS(this).impulse >= 1 && CS(this).impulse <= 9)
779 {
780 Drag_SetSpeed(this, CS(this).impulse - 1);
781 }
782 else if(CS(this).impulse == 14)
783 {
784 Drag_SetSpeed(this, 9);
785 }
786
787 if(frametime)
788 Drag_Update(this);
789 }
790 else
791 {
792 Drag_Finish(this);
793 }
794 }
795 else if(Drag_CanDrag(this) && PHYS_INPUT_BUTTON_DRAG(this))
796 {
798 entity e = trace_ent;
799 float pick = force_allow_pick;
800 if (e && !pick && vdist(this.origin - e.origin, <=, autocvar_g_grab_range))
801 {
802 // pick is true if the object can be picked up. While an object is being carried, the Drag() function
803 // must execute for it either way, otherwise it would cause bugs if it went out of the player's trace.
804 // This also makes sure that an object can only pe picked up if in range, but does not get dropped if
805 // it goes out of range while slinging it around.
806
807 switch(e.grab)
808 {
809 case 0: // can't grab
810 break;
811 case 1: // owner can grab
812 if(e.owner == this || e.realowner == this)
813 pick = true;
814 break;
815 case 2: // owner and teammates can grab
816 if(SAME_TEAM(e.owner, this) || SAME_TEAM(e.realowner, this) || e.team == this.team)
817 pick = true;
818 break;
819 case 3: // anyone can grab
820 pick = true;
821 break;
822 default:
823 break;
824 }
825 }
826 // Find e and pick
827 if(e && pick && Drag_IsDraggable(e, this))
828 {
829 if(ischeat)
830 IS_CHEAT(this, 0, 0, CHRAME_DRAG);
831 if(e.draggedby)
832 Drag_Finish(e.draggedby);
833 if(e.tag_entity)
835 Drag_Begin(this, e, trace_endpos);
836 if(ischeat)
837 DID_CHEAT();
838 return true;
839 }
840 }
841 break;
842 }
843 return false;
844}
float Drag_CanDrag(entity dragger)
Definition cheats.qc:978
void Drag_MoveBackward(entity dragger)
Definition cheats.qc:939
void Drag_Finish(entity dragger)
Definition cheats.qc:870
void Drag_Update(entity dragger)
Definition cheats.qc:944
void Drag_Begin(entity dragger, entity draggee, vector touchpoint)
Definition cheats.qc:846
float Drag_IsDraggable(entity draggee, entity dragger)
Definition cheats.qc:908
void Drag_SetSpeed(entity dragger, float s)
Definition cheats.qc:934
void Drag_MoveForward(entity dragger)
Definition cheats.qc:929
float Drag_IsDragging(entity dragger)
Definition cheats.qc:983
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:159
void detach_sameorigin(entity e)
Definition util.qc:2109
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:571
#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 846 of file cheats.qc.

847{
848 float tagscale;
849
850 draggee.dragmovetype = draggee.move_movetype;
851 draggee.draggravity = draggee.gravity;
852 set_movetype(draggee, MOVETYPE_WALK);
853 draggee.gravity = 0.00001;
854 UNSET_ONGROUND(draggee);
855 draggee.draggedby = dragger;
856
857 dragger.dragentity = draggee;
858
859 dragger.dragdistance = vlen(touchpoint - dragger.origin - dragger.view_ofs);
860 dragger.draglocalangle = draggee.angles.y - dragger.v_angle.y;
861 touchpoint -= gettaginfo(draggee, 0);
862 tagscale = (vlen(v_forward) ** -2);
863 dragger.draglocalvector_x = touchpoint * v_forward * tagscale;
864 dragger.draglocalvector_y = touchpoint * v_right * tagscale;
865 dragger.draglocalvector_z = touchpoint * v_up * tagscale;
866
867 dragger.dragspeed = 64;
868}
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 978 of file cheats.qc.

979{
980 return (!IS_DEAD(dragger)) || (IS_PLAYER(dragger));
981}

References entity(), IS_DEAD, and IS_PLAYER.

Referenced by Drag(), and Drag_IsDragging().

◆ Drag_Finish()

void Drag_Finish ( entity dragger)

Definition at line 870 of file cheats.qc.

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

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 908 of file cheats.qc.

909{
910 // TODO add more checks for bad stuff here
911 if(draggee == NULL)
912 return false;
913 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)
914 return false; // probably due to BSP collision
915 //if(draggee.model == "")
916 // return false;
917
918 return ((draggee.draggable) ? draggee.draggable(draggee, dragger) : true);
919}

References entity(), and NULL.

Referenced by Drag(), and Drag_IsDragging().

◆ Drag_IsDragging()

float Drag_IsDragging ( entity dragger)

Definition at line 983 of file cheats.qc.

984{
985 if(!dragger.dragentity)
986 return false;
987 if(wasfreed(dragger.dragentity) || dragger.dragentity.draggedby != dragger)
988 {
989 dragger.dragentity = NULL;
990 return false;
991 }
992 if(!Drag_CanDrag(dragger) || !Drag_IsDraggable(dragger.dragentity, dragger))
993 {
994 Drag_Finish(dragger);
995 return false;
996 }
997 return true;
998}

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

Referenced by Drag().

◆ Drag_MayChangeAngles()

float Drag_MayChangeAngles ( entity draggee)

Definition at line 921 of file cheats.qc.

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

References entity(), and substring().

Referenced by Drag_Update().

◆ Drag_MoveBackward()

void Drag_MoveBackward ( entity dragger)

Definition at line 939 of file cheats.qc.

940{
941 dragger.dragdistance = max(0, dragger.dragdistance - dragger.dragspeed);
942}

References entity(), and max().

Referenced by Drag().

◆ Drag_MoveDrag()

void Drag_MoveDrag ( entity from,
entity to )

Definition at line 1000 of file cheats.qc.

1001{
1002 if(from.draggedby)
1003 {
1004 to.draggedby = from.draggedby;
1005 to.draggedby.dragentity = to;
1006 from.draggedby = NULL;
1007 }
1008}

References entity(), and NULL.

Referenced by CopyBody().

◆ Drag_MoveForward()

void Drag_MoveForward ( entity dragger)

Definition at line 929 of file cheats.qc.

930{
931 dragger.dragdistance += dragger.dragspeed;
932}

References entity().

Referenced by Drag().

◆ Drag_SetSpeed()

void Drag_SetSpeed ( entity dragger,
float s )

Definition at line 934 of file cheats.qc.

935{
936 dragger.dragspeed = (2 ** s);
937}

References entity().

Referenced by Drag().

◆ drag_undraggable()

bool drag_undraggable ( entity draggee,
entity dragger )

Definition at line 901 of file cheats.qc.

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

References entity().

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

◆ Drag_Update()

void Drag_Update ( entity dragger)

Definition at line 944 of file cheats.qc.

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

1011{
1012 if(this.aiment && this.enemy)
1013 {
1014 this.origin_x = (this.aiment.origin.x + this.enemy.origin.x) * 0.5;
1015 this.origin_y = (this.aiment.origin.y + this.enemy.origin.y) * 0.5;
1016 this.origin_z = (this.aiment.origin.z + this.enemy.origin.z) * 0.5;
1017 this.maxs_x = fabs(this.aiment.origin.x - this.enemy.origin.x) * 0.5;
1018 this.maxs_y = fabs(this.aiment.origin.y - this.enemy.origin.y) * 0.5;
1019 this.maxs_z = fabs(this.aiment.origin.z - this.enemy.origin.z) * 0.5;
1020 this.mins = -1 * this.maxs;
1021 setorigin(this, this.origin);
1022 setsize(this, this.mins, this.maxs); // link edict
1023 }
1024
1025 if(this.cnt == -1) // actually race_place -1
1026 {
1027 // show "10 10" for qualifying spawns
1028 setmodel(this.killindicator, MDL_NUM(10));
1029 setmodel(this.killindicator.killindicator, MDL_NUM(10));
1030 }
1031 else if(this.cnt == -2) // actually race_place 0
1032 {
1033 // show "10 0" for loser spawns
1034 setmodel(this.killindicator, MDL_NUM(10));
1035 setmodel(this.killindicator.killindicator, MDL_NUM(0));
1036 }
1037 else
1038 {
1039 setmodel(this.killindicator, MDL_NUM(this.cnt % 10));
1040 setmodel(this.killindicator.killindicator, MDL_NUM(floor(this.cnt / 10)));
1041 }
1042
1043 this.nextthink = time;
1044}
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:94
entity enemy
Definition sv_ctf.qh:152

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().