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(autocvar_g_nades_translocate_destroy_damage > 0 && STAT(NADE_BONUS_TYPE, this) == NADE_TYPE_TRANSLOCATE.m_id)
31 {
32 Damage(this.realowner, attacker, attacker, autocvar_g_nades_translocate_destroy_damage, DEATH_TOUCHEXPLODE.m_id, DMG_NOWEP, this.realowner.origin, '0 0 0');
33 W_PrepareExplosionByDamage(this, this.realowner, nade_boom); // Don't change the owner
34
35 return true;
36 }
37 return false;
38}
39#endif // SVQC
40#ifdef MENUQC
41METHOD(TranslocateNade, describe, string(TranslocateNade this))
42{
43 TC(TranslocateNade, this);
45 PAR(_("The %s detonates after a short delay, teleporting you to where it detonated."), COLORED_NAME(this));
46 PAR(_("A common use of this nade is saving yourself from the void in space maps, however mastering this is very tricky."));
47 PAR(_("If this grenade is destroyed by an attacker, it will deal some damage to them."));
48 return PAGE_TEXT;
49}
50#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:503
#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:643
#define PAR(...)
Adds an individually translatable paragraph to PAGE_TEXT without having to deal with strcat and sprin...
Definition string.qh:649
#define PAGE_TEXT_INIT()
Definition string.qh:642
void nade_boom(entity this)
Definition sv_nades.qc:107
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