10 this.
team = actor.team;
34 float grav, sdist, zdist, vs, vz, jumpheight;
37 torg = tgt.origin + (tgt.mins + tgt.maxs) * 0.5;
40 if(pushed_entity && pushed_entity.gravity)
41 grav *= pushed_entity.gravity;
51 zdist = torg.z -
org.z;
52 sdist =
vlen(torg -
org - zdist *
'0 0 1');
56 jumpheight =
fabs(ht);
58 jumpheight = jumpheight + zdist;
82 vz =
sqrt(
fabs(2 * grav * jumpheight));
93 solution_y = solution.x;
95 solution_x = solution.y;
106 flighttime = solution.y;
113 flighttime = solution.y;
124 flighttime = solution.x;
131 flighttime = solution.y;
134 vs = sdist / flighttime;
137 return sdir * vs +
'0 0 1' * vz;
151 float zdir = pushed_entity.velocity.z;
152 if(zdir != 0) zdir =
copysign(1, zdir);
156 if (!is_playerdir_xy || !is_playerdir_z)
159 vs_tgt =
vec2(vel_tgt);
163 if (is_bidirectional_xy)
171 if (is_bidirectional_z)
211 if (is_clamp_negative_adds)
223 float vz_add = pushed_entity.velocity.z;
232 if (is_clamp_negative_adds)
242 return vs +
'0 0 1' * vz;
251 if(!WarpZoneLib_ExactTrigger_Touch(this, it, false))
252 it.last_pushed = NULL;
274 bool already_pushed =
false;
277 if(
this == targ.last_pushed || (targ.last_pushed && !
STAT(Q3COMPAT, targ)))
279 already_pushed =
true;
283 targ.last_pushed =
this;
332 objerror (
this,
"Jumppad with no target");
344 switch(targ.move_movetype)
362 targ.oldvelocity = targ.velocity;
373 Send_Effect(EFFECT_JUMPPAD, targ.origin, targ.velocity, 1);
383 if(targ.(jumppadsused[i]) ==
this)
388 targ.jumppadcount = targ.jumppadcount + 1;
398 targ.lastteleporttime =
time;
399 targ.lastteleport_origin = targ.origin;
406 targ.jumppadcount = 1;
413 if(this.
enemy.target)
419 targ.com_phys_gravity_factor = 1;
420 switch(targ.move_movetype)
479 setorigin(tracetest_ent,
org);
480 tracetoss(tracetest_ent, tracetest_ent);
493 tracetest_ent.velocity.z = 0;
494 setorigin(tracetest_ent, targ.origin + ofs);
495 tracetoss(tracetest_ent, tracetest_ent);
498 setorigin(tracetest_ent, targ.origin + ofs * 0.5);
499 tracetoss(tracetest_ent, tracetest_ent);
502 setorigin(tracetest_ent, targ.origin);
503 tracetoss(tracetest_ent, tracetest_ent);
515 setorigin(tracetest_ent,
org);
516 tracetoss(tracetest_ent, tracetest_ent);
556 return (v.z + v2.z) / grav;
564 float t = v.z / grav;
565 float jump_height = 1/2 * grav * (t ** 2);
566 float remaining_height =
org.z + jump_height - endpos.z;
567 float v2_z =
sqrt(2 * grav * remaining_height);
569 return (v.z + v2_z) / grav;
608 vector best_target =
'0 0 0';
609 vector best_org =
'0 0 0';
610 vector best_vel =
'0 0 0';
611 bool valid_best_target =
false;
624 if ((e.velocity.x != 0 || e.velocity.y != 0)
629 best_vel = e.velocity;
630 valid_best_target =
true;
636 if (dist.x || dist.y)
665 valid_best_target =
true;
668 if (ofs && new_org !=
org - ofs)
681 if (valid_best_target)
686 float cost =
vlen(
vec2(t.origin - best_org)) / velxy;
689 cost +=
vlen(
vec2(best_target - t.origin)) / velxy;
704 objerror (
this,
"Jumppad with nonexistant target");
831 this.
noise =
"misc/jumppad.wav";
859 this.
noise =
"misc/jumppad.wav";
881 if(trigger.classname ==
"trigger_push" || trigger ==
this)
897 setorigin(
this, this.
origin);
913 this.
absmin = trigger_ent.absmin;
914 this.
absmax = trigger_ent.absmax;
930 this.
noise =
"sound/misc/windfly.wav";
932 this.
noise =
"misc/jumppad.wav";
948NET_HANDLE(ENT_CLIENT_TRIGGER_PUSH,
bool isnew)
950 int mytm =
ReadByte();
if(mytm) { this.
team = mytm - 1; }
953 this.
height = ReadCoord();
966NET_HANDLE(ENT_CLIENT_TRIGGER_PUSH_VELOCITY,
bool isnew)
968 int mytm =
ReadByte();
if(mytm) { this.
team = mytm - 1; }
971 this.
speed = ReadCoord();
972 this.
count = ReadCoord();
984void target_push_remove(
entity this)
1000 setorigin(
this, this.
origin);
1003 this.entremove = target_push_remove;
void animdecide_setaction(entity e, float action, float restart)
const int ANIMACTION_JUMP
void waypoint_spawnforteleporter(entity e, vector destination, float timetaken, entity tracetest_ent)
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
float autocvar_sv_maxspeed
const vector PL_MIN_CONST
const int INITPRIO_FINDTARGET
const vector PL_MAX_CONST
const float SOLID_TRIGGER
float DPCONTENTS_PLAYERCLIP
const float EF_NODEPTHTEST
void UpdateCSQCProjectile(entity e)
void defer(entity this, float fdelay, void(entity) func)
Execute func() after time + fdelay.
void SUB_Remove(entity this)
Remove entity.
const int SF_TRIGGER_INIT
const int SF_TRIGGER_UPDATE
void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
#define IL_EACH(this, cond, body)
float trigger_push_send(entity this, entity to, float sf)
vector trigger_push_get_start_point(entity this)
void target_push_link(entity this)
bool trigger_push_testorigin(entity tracetest_ent, entity targ, entity jp, vector org)
bool trigger_push_testorigin_for_item(entity tracetest_ent, entity item, vector org)
void trigger_push_use(entity this, entity actor, entity trigger)
void target_push_init(entity this)
void trigger_push_findtarget(entity this)
bool trigger_push_test(entity this, entity item)
bool jumppad_push(entity this, entity targ, bool is_velocity_pad)
float trigger_push_get_push_time(entity this, vector endpos)
vector trigger_push_calculatevelocity(vector org, entity tgt, float ht, entity pushed_entity)
bool target_push_send(entity this, entity to, float sf)
void trigger_push_link(entity this)
void trigger_push_velocity_think(entity this)
float trigger_push_velocity_send(entity this, entity to, float sf)
void trigger_push_updatelink(entity this)
void trigger_push_velocity_link(entity this)
vector trigger_push_velocity_calculatevelocity(entity this, vector org, entity tgt, float speed, float count, entity pushed_entity, bool already_pushed)
void trigger_push_velocity_touch(entity this, entity toucher)
void target_push_use(entity this, entity actor, entity trigger)
void trigger_push_touch(entity this, entity toucher)
#define PUSH_VELOCITY_PLAYERDIR_Z
#define PUSH_VELOCITY_ADD_Z
void SUB_UseTargets(entity this, entity actor, entity trigger)
#define PUSH_VELOCITY_PLAYERDIR_XY
#define PUSH_VELOCITY_CLAMP_NEGATIVE_ADDS
const int NUM_JUMPPADSUSED
#define Q3_TARGET_PUSH_JUMPPAD
#define PUSH_VELOCITY_BIDIRECTIONAL_XY
#define PUSH_VELOCITY_BIDIRECTIONAL_Z
#define PUSH_VELOCITY_ADD_XY
#define NET_HANDLE(id, param)
#define ReadAngleVector()
#define WriteHeader(to, id)
#define REGISTER_NET_LINKED(id)
void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc)
#define EXACTTRIGGER_TOUCH(e, t)
#define BITSET_ASSIGN(a, b)
ERASEABLE vector solve_quadratic(float a, float b, float c)
ax^2 + bx + c = 0
float copysign(float e, float f)
void set_movetype(entity this, int mt)
const int MOVETYPE_BOUNCEMISSILE
#define UNSET_ONGROUND(s)
const int MOVETYPE_BOUNCE
ERASEABLE void RandomSelection_Init()
#define RandomSelection_AddEnt(e, weight, priority)
entity RandomSelection_chosen_ent
#define _sound(e, c, s, v, a)
void SetMovedir(entity this)
vector trigger_push_calculatevelocity(vector org, entity tgt, float ht, entity pushed_entity)
void trigger_link(entity this, bool(entity this, entity to, int sendflags) sendfunc)
bool isPushable(entity e)
void trigger_common_write(entity this, bool withtarget)
void trigger_remove_generic(entity this)
void trigger_common_read(entity this, bool withtarget)
void WarpZoneLib_ExactTrigger_Init(entity this, bool unsetmodel)
#define IS_REAL_CLIENT(v)
#define IS_BOT_CLIENT(v)
want: (IS_CLIENT(v) && !IS_REAL_CLIENT(v))
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
ERASEABLE float boxesoverlap(vector m1, vector m2, vector m3, vector m4)
requires that m2>m1 in all coordinates, and that m4>m3
void InitializeEntity(entity e, void(entity this) func, int order)
IntrusiveList g_moveables