From d35f2000b6675bec432c1f144532367debe21648 Mon Sep 17 00:00:00 2001 From: terencehill Date: Mon, 13 Mar 2017 02:12:23 +0100 Subject: [PATCH] Allow bots to climb ladders up --- qcsrc/server/bot/default/navigation.qc | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/qcsrc/server/bot/default/navigation.qc b/qcsrc/server/bot/default/navigation.qc index 9f1d5d922..488da59d4 100644 --- a/qcsrc/server/bot/default/navigation.qc +++ b/qcsrc/server/bot/default/navigation.qc @@ -180,8 +180,14 @@ bool tracewalk(entity e, vector start, vector m1, vector m2, vector end, float m if(autocvar_bot_debug_tracewalk) debugnodestatus(trace_endpos, DEBUG_NODE_WARNING); - // check for doors + FOREACH_ENTITY_CLASS("func_ladder", true, + { it.solid = SOLID_BSP; }); + traceline( org, move, movemode, e); + + FOREACH_ENTITY_CLASS("func_ladder", true, + { it.solid = SOLID_TRIGGER; }); + if ( trace_ent.classname == "door_rotating" || trace_ent.classname == "door") { vector nextmove; @@ -193,6 +199,23 @@ bool tracewalk(entity e, vector start, vector m1, vector m2, vector end, float m move = nextmove; } } + else if (trace_ent.classname == "func_ladder") + { + vector ladder_bottom = trace_endpos - dir * m2.x; + vector ladder_top = ladder_bottom; + ladder_top.z = trace_ent.absmax.z + (-m1.z + 1); + tracebox(ladder_bottom, m1, m2, ladder_top, movemode, e); + if (trace_fraction < 1 || trace_startsolid) + { + if(autocvar_bot_debug_tracewalk) + debugnodestatus(trace_endpos, DEBUG_NODE_FAIL); + + return false; // failed + } + org = ladder_top + dir * m2.x; + move = org + dir * stepdist; + continue; + } else { if(autocvar_bot_debug_tracewalk) -- 2.39.2