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{
6 if (this.realowner.vehicle)
7 return;
8
9 setsize(this, PL_MIN_CONST - '16 16 16', PL_MAX_CONST + '16 16 16');
10
11 if (!move_out_of_solid(this))
12 {
13 sprint(this.realowner, "^1Couldn't move the translocator out of solid! origin: ", vtos(this.origin), "\n");
14 return;
15 }
16
17 vector locout = this.origin + '0 0 1' * (1 - this.realowner.mins.z - 24);
18 tracebox(locout, this.realowner.mins, this.realowner.maxs, locout, MOVE_NOMONSTERS, this.realowner);
19 locout = trace_endpos;
20
21 makevectors(this.realowner.angles);
22
23 MUTATOR_CALLHOOK(PortalTeleport, this.realowner);
24
25 TeleportPlayer(this, this.realowner, locout, this.realowner.angles, v_forward * vlen(this.realowner.velocity), '0 0 0', '0 0 0', TELEPORT_FLAGS_TELEPORTER);
26}
27
29{
30 if (STAT(NADE_BONUS_TYPE, this) == NADE_TYPE_TRANSLOCATE.m_id && autocvar_g_nades_translocate_destroy_damage > 0)
31 {
32 Damage(this.realowner, attacker, attacker,
34 DEATH_TOUCHEXPLODE.m_id,
36 this.realowner.origin,
37 '0 0 0'
38 );
39 W_PrepareExplosionByDamage(this, this.realowner, nade_boom); // Don't change the owner
40
41 return true;
42 }
43 return false;
44}
45#endif // SVQC
46#ifdef MENUQC
47METHOD(TranslocateNade, describe, string(TranslocateNade this))
48{
49 TC(TranslocateNade, this);
51 PAR(_("The %s detonates after a short delay, teleporting you to where it detonated."), COLORED_NAME(this));
52 PAR(_("A common use of this nade is saving yourself from the void in space maps, however mastering this is very tricky."));
53 PAR(_("If this grenade is destroyed by an attacker, it will deal some damage to them."));
54 return PAGE_TEXT;
55}
56#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:195
const vector PL_MIN_CONST
Definition constants.qh:56
const vector PL_MAX_CONST
Definition constants.qh:55
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:493
#define DMG_NOWEP
Definition damage.qh:104
#define TC(T, sym)
Definition _all.inc:82
#define STAT(...)
Definition stats.qh:82
#define move_out_of_solid(e)
Definition common.qh:110
void sprint(float clientnum, string text,...)
float vlen(vector v)
string vtos(vector v)
#define METHOD(cname, name, prototype)
Definition oo.qh:269
#define makevectors
Definition post.qh:21
vector
Definition self.qh:92
void W_PrepareExplosionByDamage(entity this, entity attacker, void(entity this) explode)
Definition common.qc:87
#define PAGE_TEXT
Definition string.qh:642
#define PAR(...)
Adds an individually translatable paragraph to PAGE_TEXT without having to deal with strcat and sprin...
Definition string.qh:648
#define PAGE_TEXT_INIT()
Definition string.qh:641
void nade_boom(entity this)
Definition sv_nades.qc:114
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:4
bool nade_translocate_DestroyDamage(entity this, entity attacker)
float autocvar_g_nades_translocate_destroy_damage
Definition translocate.qh:7