centerprint(targ, this.message);
}
else
+ {
targ.lastteleporttime = time;
+ targ.lastteleport_origin = targ.origin;
+ }
if (!IS_DEAD(targ))
animdecide_setaction(targ, ANIMACTION_JUMP, true);
if(trace_startsolid)
return false;
- if(!jp.height)
+ if (!jp.height)
{
// since tracetoss starting from jumppad's origin often fails when target
// is very close to real destination, start it directly from target's
// origin instead
+ vector ofs = '0 0 0';
+ if (vdist(vec2(tracetest_ent.velocity), <, autocvar_sv_maxspeed))
+ ofs = stepheightvec;
+
tracetest_ent.velocity.z = 0;
- setorigin(tracetest_ent, targ.origin + stepheightvec);
+ setorigin(tracetest_ent, targ.origin + ofs);
tracetoss(tracetest_ent, tracetest_ent);
- if(trace_startsolid)
+ if (trace_startsolid && ofs.z)
{
- setorigin(tracetest_ent, targ.origin + stepheightvec / 2);
+ setorigin(tracetest_ent, targ.origin + ofs / 2);
tracetoss(tracetest_ent, tracetest_ent);
- if(trace_startsolid)
+ if (trace_startsolid && ofs.z)
{
setorigin(tracetest_ent, targ.origin);
tracetoss(tracetest_ent, tracetest_ent);
- if(trace_startsolid)
+ if (trace_startsolid)
return false;
}
}
{
// first calculate a typical start point for the jump
vector org = (this.absmin + this.absmax) * 0.5;
- org.z = this.absmax.z - PL_MIN_CONST.z;
+ org.z = this.absmax.z - PL_MIN_CONST.z - 7;
if (this.target)
{
WriteByte(MSG_ENTITY, this.active);
WriteCoord(MSG_ENTITY, this.height);
- WriteCoord(MSG_ENTITY, this.movedir_x);
- WriteCoord(MSG_ENTITY, this.movedir_y);
- WriteCoord(MSG_ENTITY, this.movedir_z);
+ WriteVector(MSG_ENTITY, this.movedir);
trigger_common_write(this, true);
WriteByte(MSG_ENTITY, this.cnt);
WriteString(MSG_ENTITY, this.targetname);
- WriteCoord(MSG_ENTITY, this.origin_x);
- WriteCoord(MSG_ENTITY, this.origin_y);
- WriteCoord(MSG_ENTITY, this.origin_z);
+ WriteVector(MSG_ENTITY, this.origin);
WriteAngle(MSG_ENTITY, this.angles_x);
WriteAngle(MSG_ENTITY, this.angles_y);
this.active = ReadByte();
this.height = ReadCoord();
- this.movedir_x = ReadCoord();
- this.movedir_y = ReadCoord();
- this.movedir_z = ReadCoord();
+ this.movedir = ReadVector();
trigger_common_read(this, true);
void target_push_remove(entity this)
{
- //if(this.classname)
- //strunzone(this.classname);
- //this.classname = string_null;
-
- if(this.targetname)
- strunzone(this.targetname);
- this.targetname = string_null;
+ // strfree(this.classname);
+ strfree(this.targetname);
}
NET_HANDLE(ENT_CLIENT_TARGET_PUSH, bool isnew)
this.classname = "push_target";
this.cnt = ReadByte();
this.targetname = strzone(ReadString());
- this.origin_x = ReadCoord();
- this.origin_y = ReadCoord();
- this.origin_z = ReadCoord();
+ this.origin = ReadVector();
this.angles_x = ReadAngle();
this.angles_y = ReadAngle();