10 this.
team = actor.team;
33 float grav, sdist, zdist, vs, vz, jumpheight;
36 torg = tgt.origin + (tgt.mins + tgt.maxs) * 0.5;
38 grav = PHYS_GRAVITY(
NULL);
39 if(pushed_entity && pushed_entity.gravity)
40 grav *= pushed_entity.gravity;
42 zdist = torg.z - org.z;
43 sdist =
vlen(torg - org - zdist *
'0 0 1');
44 sdir =
normalize(torg - org - zdist *
'0 0 1');
47 jumpheight =
fabs(ht);
49 jumpheight = jumpheight + zdist;
73 vz =
sqrt(
fabs(2 * grav * jumpheight));
84 solution_y = solution.x;
86 solution_x = solution.y;
97 flighttime = solution.y;
104 flighttime = solution.y;
115 flighttime = solution.x;
122 flighttime = solution.y;
125 vs = sdist / flighttime;
128 return sdir * vs +
'0 0 1' * vz;
140 org.z += targ.mins_z;
169 if (targ.flags & FL_PROJECTILE)
172 switch(targ.move_movetype)
190 targ.oldvelocity = targ.velocity;
197 Send_Effect(EFFECT_JUMPPAD, targ.origin, targ.velocity, 1);
205 if(targ.(jumppadsused[i]) ==
this)
210 targ.jumppadcount = targ.jumppadcount + 1;
220 targ.lastteleporttime =
time;
221 targ.lastteleport_origin = targ.origin;
228 targ.jumppadcount = 1;
235 if(this.
enemy.target)
238 if (targ.flags & FL_PROJECTILE)
241 targ.com_phys_gravity_factor = 1;
242 switch(targ.move_movetype)
284 void trigger_push_link(
entity this);
285 void trigger_push_updatelink(
entity this);
289 tracetoss(tracetest_ent, tracetest_ent);
299 if (
vdist(
vec2(tracetest_ent.velocity), <, autocvar_sv_maxspeed))
302 tracetest_ent.velocity.z = 0;
303 setorigin(tracetest_ent, targ.origin + ofs);
304 tracetoss(tracetest_ent, tracetest_ent);
307 setorigin(tracetest_ent, targ.origin + ofs / 2);
308 tracetoss(tracetest_ent, tracetest_ent);
312 tracetoss(tracetest_ent, tracetest_ent);
325 tracetoss(tracetest_ent, tracetest_ent);
346 org.z = this.
absmax.z - PL_MIN_CONST.z - 7;
352 vector org = trigger_push_get_start_point(
this);
354 float grav = PHYS_GRAVITY(
NULL);
360 setsize(e, PL_MIN_CONST, PL_MAX_CONST);
365 return (v.z + v2.z) / grav;
373 float t = v.z / grav;
374 float jump_height = 1/2 * grav * (t ** 2);
375 float remaining_height = org.z + jump_height - endpos.z;
376 float v2_z =
sqrt(2 * grav * remaining_height);
378 return (v.z + v2_z) / grav;
390 vector org = trigger_push_get_start_point(
this);
411 setsize(e, PL_MIN_CONST, PL_MAX_CONST);
416 vector best_target =
'0 0 0';
417 vector best_org =
'0 0 0';
418 vector best_vel =
'0 0 0';
419 bool valid_best_target =
false;
422 if (!trigger_push_testorigin_for_item(e, item, org))
430 if (trigger_push_testorigin(e, t,
this, org))
434 best_vel = e.velocity;
435 valid_best_target =
true;
440 vector dist = t.origin - org;
441 if (dist.x || dist.y)
454 if (!trigger_push_testorigin_for_item(e, item, new_org))
463 if (
vdist(
vec2(e.velocity), <, autocvar_sv_maxspeed))
464 e.velocity = autocvar_sv_maxspeed * flatdir;
465 if (trigger_push_testorigin(e, t,
this, new_org) && (!valid_best_target ||
trace_endpos.z > best_target.z + 50))
470 valid_best_target =
true;
473 if (ofs && new_org != org - ofs)
486 if (valid_best_target)
491 float cost =
vlen(
vec2(t.origin - best_org)) / velxy;
492 if(velxy < autocvar_sv_maxspeed)
493 velxy = autocvar_sv_maxspeed;
494 cost +=
vlen(
vec2(best_target - t.origin)) / velxy;
509 objerror (
this,
"Jumppad with nonexistant target");
534 setsize(e, PL_MIN_CONST, PL_MAX_CONST);
553 defer(
this, 0.1, trigger_push_updatelink);
566 WriteHeader(MSG_ENTITY, ENT_CLIENT_TRIGGER_PUSH);
573 trigger_common_write(
this,
true);
578 void trigger_push_updatelink(
entity this)
583 void trigger_push_link(
entity this)
585 trigger_link(
this, trigger_push_send);
607 this.
use = trigger_push_use;
616 this.
noise =
"misc/jumppad.wav";
619 trigger_push_link(
this);
630 WriteHeader(MSG_ENTITY, ENT_CLIENT_TARGET_PUSH);
634 WriteVector(MSG_ENTITY, this.
origin);
636 WriteAngleVector(MSG_ENTITY, this.
angles);
643 if(trigger.classname ==
"trigger_push" || trigger ==
this)
649 void target_push_link(
entity this)
652 Net_LinkEntity(
this,
false, 0, target_push_send);
656 void target_push_init(
entity this)
660 target_push_link(
this);
663 void target_push_init2(
entity this)
668 this.
use = target_push_use;
671 target_push_init(
this);
676 target_push_init2(
this);
681 target_push_init(
this);
685 target_push_init(
this);
690 NET_HANDLE(ENT_CLIENT_TRIGGER_PUSH,
bool isnew)
692 int mytm = ReadByte();
if(mytm) { this.
team = mytm - 1; }
695 this.
height = ReadCoord();
697 trigger_common_read(
this,
true);
699 this.entremove = trigger_remove_generic;
708 void target_push_remove(
entity this)
714 NET_HANDLE(ENT_CLIENT_TARGET_PUSH,
bool isnew)
716 this.
cnt = ReadByte();
718 this.
origin = ReadVector();
720 this.
angles = ReadAngleVector();
727 this.entremove = target_push_remove;
void trigger_push_touch(entity this, entity toucher)
#define REGISTER_NET_LINKED(id)
ERASEABLE vector solve_quadratic(float a, float b, float c)
ax^2 + bx + c = 0
const int SF_TRIGGER_INIT
bool jumppad_push(entity this, entity targ)
ERASEABLE void RandomSelection_Init()
const int ANIMACTION_JUMP
#define EXACTTRIGGER_TOUCH(e, t)
float MOVETYPE_BOUNCEMISSILE
float trigger_push_get_push_time(entity this, vector endpos)
void SUB_UseTargets(entity this, entity actor, entity trigger)
#define NET_HANDLE(id, param)
float DPCONTENTS_PLAYERCLIP
vector trigger_push_calculatevelocity(vector org, entity tgt, float ht, entity pushed_entity)
spawnfunc(info_player_attacker)
const float EF_NODEPTHTEST
#define UNSET_ONGROUND(s)
const int NUM_JUMPPADSUSED
#define BITSET_ASSIGN(a, b)
#define IS_REAL_CLIENT(v)
#define RandomSelection_AddEnt(e, weight, priority)
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
void UpdateCSQCProjectile(entity e)
ERASEABLE float boxesoverlap(vector m1, vector m2, vector m3, vector m4)
requires that m2>m1 in all coordinates, and that m4>m3
void animdecide_setaction(entity e, float action, float restart)
entity RandomSelection_chosen_ent
void waypoint_spawnforteleporter(entity e, vector destination, float timetaken, entity tracetest_ent)
vector(float skel, float bonenum) _skel_get_boneabs_hidden
void InitializeEntity(entity e, void(entity this) func, int order)
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
#define _sound(e, c, s, v, a)
const float SOLID_TRIGGER
#define IS_BOT_CLIENT(v)
want: (IS_CLIENT(v) && !IS_REAL_CLIENT(v))
bool trigger_push_test(entity this, entity item)
if (item != NULL) returns true if the item can be reached by using this jumppad, false otherwise if (...
void trigger_push_findtarget(entity this)
bool isPushable(entity e)
void set_movetype(entity this, int mt)
const int SF_TRIGGER_UPDATE