From: terencehill Date: Mon, 5 Nov 2018 15:19:55 +0000 (+0100) Subject: Bot waypoints: allow to lock the currently aimed waypoint with the use key (keeping... X-Git-Tag: xonotic-v0.8.5~1704^2~2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=46f04b61cffb30abdcba162728cae06359cdc8ba;p=xonotic%2Fxonotic-data.pk3dir.git Bot waypoints: allow to lock the currently aimed waypoint with the use key (keeping it pressed for a short while); unlock with the use key without aiming at any waypoint --- diff --git a/qcsrc/server/bot/default/waypoints.qc b/qcsrc/server/bot/default/waypoints.qc index a4fdfcab3..65a75e304 100644 --- a/qcsrc/server/bot/default/waypoints.qc +++ b/qcsrc/server/bot/default/waypoints.qc @@ -1428,10 +1428,14 @@ void botframe_showwaypointlinks() FOREACH_CLIENT(IS_PLAYER(it) && !it.isbot, { int display_type = 0; - entity head = navigation_findnearestwaypoint(it, false); + if (PHYS_INPUT_BUTTON_USE(it)) + it.wp_locked = it.wp_aimed; + entity head = it.wp_locked; + if (!head) + head = navigation_findnearestwaypoint(it, false); it.nearestwaypoint = head; // mainly useful for debug it.nearestwaypointtimeout = time + 2; // while I'm at it... - if (IS_ONGROUND(it) || it.waterlevel > WATERLEVEL_NONE) + if (IS_ONGROUND(it) || it.waterlevel > WATERLEVEL_NONE || it.wp_locked) display_type = 1; // default else if(head && (head.wphardwired)) display_type = 2; // only hardwired diff --git a/qcsrc/server/bot/default/waypoints.qh b/qcsrc/server/bot/default/waypoints.qh index e661c672d..0b69dcbb8 100644 --- a/qcsrc/server/bot/default/waypoints.qh +++ b/qcsrc/server/bot/default/waypoints.qh @@ -29,6 +29,7 @@ float botframe_cachedwaypointlinks; .float wpfire, wpcost, wpconsidered, wpisbox, wplinked, wphardwired; .int wpflags; .entity wp_aimed; +.entity wp_locked; .vector wpnearestpoint;