if(min(this.absmax.x - this.absmin.x, this.absmax.y - this.absmin.y) > 100)
return;
+ entity tracetest_ent = spawn();
+ setsize(tracetest_ent, PL_MIN_CONST, PL_MAX_CONST);
+ tracetest_ent.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP;
+
vector top_min = (this.absmin + this.absmax) / 2;
top_min.z = this.absmax.z;
vector top_max = top_min;
top_max.z += PL_MAX_CONST.z - PL_MIN_CONST.z;
- tracebox(top_max + jumpstepheightvec, PL_MIN_CONST, PL_MAX_CONST, top_min, MOVE_NOMONSTERS, NULL);
+ tracebox(top_max + jumpstepheightvec, PL_MIN_CONST, PL_MAX_CONST, top_min, MOVE_NOMONSTERS, tracetest_ent);
if(trace_startsolid)
{
- tracebox(top_max + stepheightvec, PL_MIN_CONST, PL_MAX_CONST, top_min, MOVE_NOMONSTERS, NULL);
+ tracebox(top_max + stepheightvec, PL_MIN_CONST, PL_MAX_CONST, top_min, MOVE_NOMONSTERS, tracetest_ent);
if(trace_startsolid)
{
- tracebox(top_max, PL_MIN_CONST, PL_MAX_CONST, top_min, MOVE_NOMONSTERS, NULL);
+ tracebox(top_max, PL_MIN_CONST, PL_MAX_CONST, top_min, MOVE_NOMONSTERS, tracetest_ent);
if(trace_startsolid)
{
if(this.absmax.x - this.absmin.x > PL_MAX_CONST.x - PL_MIN_CONST.x
// move top on one side
top_max.x = top_min.x = this.absmin.x + (PL_MAX_CONST.x - PL_MIN_CONST.x) * 0.75;
}
- tracebox(top_max, PL_MIN_CONST, PL_MAX_CONST, top_min, MOVE_NOMONSTERS, NULL);
+ tracebox(top_max, PL_MIN_CONST, PL_MAX_CONST, top_min, MOVE_NOMONSTERS, tracetest_ent);
if(trace_startsolid)
{
if(this.absmax.x - this.absmin.x > PL_MAX_CONST.x - PL_MIN_CONST.x
// alternatively on the other side
top_max.x = top_min.x = this.absmax.x - (PL_MAX_CONST.x - PL_MIN_CONST.x) * 0.75;
}
- tracebox(top_max, PL_MIN_CONST, PL_MAX_CONST, top_min, MOVE_NOMONSTERS, NULL);
- if(trace_startsolid)
- return;
+ tracebox(top_max, PL_MIN_CONST, PL_MAX_CONST, top_min, MOVE_NOMONSTERS, tracetest_ent);
}
}
}
}
- if(trace_endpos.z < this.absmax.z)
+ if(trace_startsolid || trace_endpos.z < this.absmax.z)
+ {
+ delete(tracetest_ent);
return;
+ }
this.bot_pickup = true; // allow bots to make use of this ladder
float cost = waypoint_getlinearcost(trace_endpos.z - this.absmin.z);
++n;
#ifdef SVQC
if(e.move_movetype == MOVETYPE_NONE)
- waypoint_spawnforteleporter(this, e.origin, 0);
+ {
+ entity tracetest_ent = spawn();
+ setsize(tracetest_ent, PL_MIN_CONST, PL_MAX_CONST);
+ tracetest_ent.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP;
+ waypoint_spawnforteleporter(this, e.origin, 0, tracetest_ent);
+ delete(tracetest_ent);
+ }
if(e.classname != "info_teleport_destination")
LOG_INFO("^3MAPPER ERROR: teleporter does target an invalid teleport destination entity. Angles will not work.\n");
#endif
entity e = spawn();
setsize(e, PL_MIN_CONST, PL_MAX_CONST);
+ e.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP;
e.velocity = trigger_push_calculatevelocity(org, t, this.height);
vel = e.velocity;
vector best_target = '0 0 0';
if(velxy < autocvar_sv_maxspeed)
velxy = autocvar_sv_maxspeed;
cost += vlen(vec2(best_target - t.origin)) / velxy;
- waypoint_spawnforteleporter(this, best_target, cost);
+ waypoint_spawnforteleporter(this, best_target, cost, e);
}
}
delete(e);
else
{
entity e = spawn();
- setorigin(e, org);
setsize(e, PL_MIN_CONST, PL_MAX_CONST);
+ e.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP;
+ setorigin(e, org);
e.velocity = this.movedir;
tracetoss(e, e);
if (!(boxesoverlap(this.absmin, this.absmax + eZ * 50, trace_endpos + PL_MIN_CONST, trace_endpos + PL_MAX_CONST)))
- waypoint_spawnforteleporter(this, trace_endpos, vlen(trace_endpos - org) / vlen(e.velocity));
+ waypoint_spawnforteleporter(this, trace_endpos, vlen(trace_endpos - org) / vlen(e.velocity), e);
delete(e);
}
void waypoint_schedulerelink(entity wp);
void waypoint_spawnforitem(entity e);
void waypoint_spawnforitem_force(entity e, vector org);
-void waypoint_spawnforteleporter(entity e, vector destination, float timetaken);
-void waypoint_spawnforteleporter_v(entity e, vector org, vector destination, float timetaken);
+void waypoint_spawnforteleporter(entity e, vector destination, float timetaken, entity tracetest_ent);
+void waypoint_spawnforteleporter_wz(entity e, vector org, vector destination, float timetaken, entity tracetest_ent);
void waypoint_spawn_fromeditor(entity pl);
entity waypoint_spawn(vector m1, vector m2, float f);
void waypoint_unreachable(entity pl);
return cwp + cwb;
}
-vector waypoint_fixorigin(vector position)
+vector waypoint_fixorigin(vector position, entity tracetest_ent)
{
- tracebox(position + '0 0 1' * (1 - PL_MIN_CONST.z), PL_MIN_CONST, PL_MAX_CONST, position + '0 0 -512', MOVE_NOMONSTERS, NULL);
+ tracebox(position + '0 0 1' * (1 - PL_MIN_CONST.z), PL_MIN_CONST, PL_MAX_CONST, position + '0 0 -512', MOVE_NOMONSTERS, tracetest_ent);
if(trace_fraction < 1)
position = trace_endpos;
- //traceline(position, position + '0 0 -512', MOVE_NOMONSTERS, NULL);
- //print("position is ", ftos(trace_endpos_z - position_z), " above solid\n");
return position;
}
void waypoint_spawnforitem_force(entity e, vector org)
{
// Fix the waypoint altitude if necessary
- org = waypoint_fixorigin(org);
+ org = waypoint_fixorigin(org, NULL);
// don't spawn an item spawnfunc_waypoint if it already exists
IL_EACH(g_waypoints, true,
e.nearestwaypointtimeout = -1;
}
-void waypoint_spawnforteleporter_v(entity e, vector org, vector destination, float timetaken)
+void waypoint_spawnforteleporter_wz(entity e, vector org, vector destination, float timetaken, entity tracetest_ent)
{
- org = waypoint_fixorigin(org);
- destination = waypoint_fixorigin(destination);
+ org = waypoint_fixorigin(org, tracetest_ent);
+ destination = waypoint_fixorigin(destination, tracetest_ent);
waypoint_spawnforteleporter_boxes(e, WAYPOINTFLAG_TELEPORT, org, org, destination, destination, timetaken);
}
-void waypoint_spawnforteleporter(entity e, vector destination, float timetaken)
+void waypoint_spawnforteleporter(entity e, vector destination, float timetaken, entity tracetest_ent)
{
- destination = waypoint_fixorigin(destination);
+ destination = waypoint_fixorigin(destination, tracetest_ent);
waypoint_spawnforteleporter_boxes(e, WAYPOINTFLAG_TELEPORT, e.absmin - PL_MAX_CONST + '1 1 1', e.absmax - PL_MIN_CONST + '-1 -1 -1', destination, destination, timetaken);
}
// drop the waypoint to a proper location:
// first move it up by a player height
// then move it down to hit the floor with player bbox size
- position = waypoint_fixorigin(position);
+ position = waypoint_fixorigin(position, this);
w = waypoint_spawn(position, position, WAYPOINTFLAG_GENERATED | WAYPOINTFLAG_PERSONAL);
w.nearestwaypoint = NULL;
void waypoint_spawnforitem_force(entity e, vector org);
void waypoint_spawnforitem(entity e);
-void waypoint_spawnforteleporter(entity e, vector destination, float timetaken);
-void waypoint_spawnforteleporter_v(entity e, vector org, vector destination, float timetaken);
+void waypoint_spawnforteleporter(entity e, vector destination, float timetaken, entity tracetest_ent);
+void waypoint_spawnforteleporter_wz(entity e, vector org, vector destination, float timetaken, entity tracetest_ent);
void botframe_showwaypointlinks();
float waypoint_loadall();
void waypoint_unreachable(entity pl);
-vector waypoint_fixorigin(vector position);
+vector waypoint_fixorigin(vector position, entity tracetest_ent);
void botframe_autowaypoints();
void waypoint_schedulerelink(entity wp) { }
void waypoint_spawnforitem(entity e) { }
void waypoint_spawnforitem_force(entity e, vector org) { }
-void waypoint_spawnforteleporter(entity e, vector destination, float timetaken) { }
-void waypoint_spawnforteleporter_v(entity e, vector org, vector destination, float timetaken) { }
+void waypoint_spawnforteleporter(entity e, vector destination, float timetaken, entity tracetest_ent) { }
+void waypoint_spawnforteleporter_wz(entity e, vector org, vector destination, float timetaken, entity tracetest_ent) { }
void waypoint_spawn_fromeditor(entity pl) { }
entity waypoint_spawn(vector m1, vector m2, float f) { return NULL; }
#endif
void WarpZone_PostInitialize_Callback()
{
// create waypoint links for warpzones
+ entity tracetest_ent = spawn();
+ setsize(tracetest_ent, PL_MIN_CONST, PL_MAX_CONST);
+ tracetest_ent.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP;
//for(entity e = warpzone_first; e; e = e.warpzone_next)
for(entity e = NULL; (e = find(e, classname, "trigger_warpzone")); )
{
dst = (e.enemy.absmin + e.enemy.absmax) * 0.5;
makevectors(e.enemy.warpzone_angles);
dst = dst + ((e.enemy.warpzone_origin - dst) * v_forward) * v_forward - 16 * v_right;
- waypoint_spawnforteleporter_v(e, src, dst, 0);
+ waypoint_spawnforteleporter_wz(e, src, dst, 0, tracetest_ent);
}
+ delete(tracetest_ent);
}