Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
translocate.qc
Go to the documentation of this file.
1#include "translocate.qh"
2
3#ifdef SVQC
5
7{
8 if (this.realowner.vehicle)
9 return;
10
11 setsize(this, PL_MIN_CONST - '16 16 16', PL_MAX_CONST + '16 16 16');
12
13 if (!move_out_of_solid(this))
14 {
15 sprint(this.realowner, "^1Couldn't move the translocator out of solid! origin: ", vtos(this.origin), "\n");
16 return;
17 }
18
19 vector locout = this.origin;
20 locout.z += 1 - this.realowner.mins.z - 24;
21 tracebox(locout, this.realowner.mins, this.realowner.maxs, locout, MOVE_NOMONSTERS, this.realowner);
22 locout = trace_endpos;
23
24 makevectors(this.realowner.angles);
25 vector forward = v_forward;
26
27 MUTATOR_CALLHOOK(PortalTeleport, this.realowner);
28
29 TeleportPlayer(this, this.realowner, locout,
31 WarpZone_RefSys_TransformVelocity(this.realowner, this, forward * vlen(this.realowner.velocity)),
32 '0 0 0', '0 0 0', TELEPORT_FLAGS_TELEPORTER);
33}
34
36{
37 if (STAT(NADE_BONUS_TYPE, this) == NADE_TYPE_TRANSLOCATE.m_id && autocvar_g_nades_translocate_destroy_damage > 0)
38 {
39 Damage(this.realowner, attacker, attacker,
41 DEATH_TOUCHEXPLODE.m_id,
43 this.realowner.origin,
44 '0 0 0'
45 );
46 W_PrepareExplosionByDamage(this, this.realowner, nade_boom); // Don't change the owner
47
48 return true;
49 }
50 return false;
51}
52#endif // SVQC
53#ifdef MENUQC
54METHOD(TranslocateNade, describe, string(TranslocateNade this))
55{
56 TC(TranslocateNade, this);
58 PAR(_("The %s detonates after a short delay, teleporting you to where it detonated."), COLORED_NAME(this));
59 PAR(_("A common use of this nade is saving yourself from the void in space maps, however mastering this is very tricky."));
60 PAR(_("If this grenade is destroyed by an attacker, it will deal some damage to them."));
61 return PAGE_TEXT;
62}
63#endif // MENUQC
#define MUTATOR_CALLHOOK(id,...)
Definition base.qh:143
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define COLORED_NAME(this)
Definition color.qh:189
const vector PL_MIN_CONST
Definition constants.qh:53
const vector PL_MAX_CONST
Definition constants.qh:52
const float MOVE_NOMONSTERS
vector trace_endpos
vector v_forward
vector origin
void Damage(entity targ, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
Definition damage.qc:484
#define DMG_NOWEP
Definition damage.qh:104
#define TC(T, sym)
Definition _all.inc:82
#define STAT(...)
Definition stats.qh:94
vector WarpZone_RefSys_TransformVelocity(entity from, entity to, vector vel)
Transform velocity vel in from's reference into to's reference.
Definition common.qc:796
vector WarpZone_RefSys_TransformAngles(entity from, entity to, vector ang)
Transform angle ang in from's reference into to's reference.
Definition common.qc:805
#define move_out_of_solid(e)
Definition common.qh:128
void sprint(float clientnum, string text,...)
float vlen(vector v)
string vtos(vector v)
#define METHOD(cname, name, prototype)
Definition oo.qh:274
#define makevectors
Definition post.qh:21
vector
Definition self.qh:96
void W_PrepareExplosionByDamage(entity this, entity attacker, void(entity this) explode)
Definition common.qc:87
#define PAGE_TEXT
Definition string.qh:651
#define PAR(...)
Adds an individually translatable paragraph to PAGE_TEXT without having to deal with strcat and sprin...
Definition string.qh:657
#define PAGE_TEXT_INIT()
Definition string.qh:650
void nade_boom(entity this)
Definition sv_nades.qc:95
void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angles, vector to_velocity, vector telefragmin, vector telefragmax, float tflags)
#define TELEPORT_FLAGS_TELEPORTER
entity realowner
void nade_translocate_boom(entity this)
Definition translocate.qc:6
bool nade_translocate_DestroyDamage(entity this, entity attacker)
float autocvar_g_nades_translocate_destroy_damage
Definition translocate.qh:7