X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Ftriggers%2Ffunc%2Fladder.qc;h=42fe0b9d302519a6a7da8d66ab0b7a3aeb3e00ce;hp=d93b77b572e46a9d3a014592ffb71bd36bfbde80;hb=3d2ebf22f95da8bfd89208fa1748207c6e5cbffe;hpb=5921f17b0750d3666917008465afaf1b05d2088e diff --git a/qcsrc/common/triggers/func/ladder.qc b/qcsrc/common/triggers/func/ladder.qc index d93b77b57..42fe0b9d3 100644 --- a/qcsrc/common/triggers/func/ladder.qc +++ b/qcsrc/common/triggers/func/ladder.qc @@ -42,17 +42,34 @@ void func_ladder_link(entity this) void func_ladder_init(entity this) { settouch(this, func_ladder_touch); - trigger_init(this); func_ladder_link(this); if(min(this.absmax.x - this.absmin.x, this.absmax.y - this.absmin.y) > 100) return; + + 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); + if(trace_startsolid) + { + tracebox(top_max + stepheightvec, PL_MIN_CONST, PL_MAX_CONST, top_min, MOVE_NOMONSTERS, NULL); + if(trace_startsolid) + { + tracebox(top_max, PL_MIN_CONST, PL_MAX_CONST, top_min, MOVE_NOMONSTERS, NULL); + if(trace_startsolid) + return; + } + } + if(trace_endpos.z < this.absmax.z) + return; + this.bot_pickup = true; // allow bots to make use of this ladder - vector top = (this.absmin + this.absmax) / 2; - top.z = this.absmax.z + 1 - PL_MIN_CONST.z; - float cost = waypoint_getlinearcost(this.absmax.z - this.absmin.z); - waypoint_spawnforteleporter_boxes(this, WAYPOINTFLAG_LADDER, this.absmin, this.absmax, top, top, cost); + float cost = waypoint_getlinearcost(trace_endpos.z - this.absmin.z); + top_min = trace_endpos; + waypoint_spawnforteleporter_boxes(this, WAYPOINTFLAG_LADDER, this.absmin, this.absmax, top_min, top_min, cost); } spawnfunc(func_ladder)