From 5e5a562156938ca814f01f380397221b6ba1517d Mon Sep 17 00:00:00 2001 From: terencehill Date: Fri, 9 Aug 2019 16:26:56 +0200 Subject: [PATCH] Bot waypoints: add "wpeditor lock" command that replaces the usage of the 'use' button and works instantly --- qcsrc/server/bot/default/waypoints.qc | 10 +++++++--- qcsrc/server/command/cmd.qc | 6 ++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/qcsrc/server/bot/default/waypoints.qc b/qcsrc/server/bot/default/waypoints.qc index 84def4a8f..0b06a9593 100644 --- a/qcsrc/server/bot/default/waypoints.qc +++ b/qcsrc/server/bot/default/waypoints.qc @@ -260,6 +260,13 @@ vector waypoint_getSymmetricalPoint(vector org, int ctf_flags) return new_org; } +void crosshair_trace_waypoints(entity pl); +void waypoint_lock(entity pl) +{ + crosshair_trace_waypoints(pl); + pl.wp_locked = trace_ent; +} + bool waypoint_has_hardwiredlinks(entity wp) { if (!wp) @@ -504,7 +511,6 @@ void waypoint_clear_start_wp_globals(entity pl, bool warn) LOG_INFO("^xf80Start waypoint has been cleared.\n"); } -void crosshair_trace_waypoints(entity pl); void waypoint_start_hardwiredlink(entity pl, bool at_crosshair) { entity wp = pl.nearestwaypoint; @@ -2087,8 +2093,6 @@ void botframe_showwaypointlinks() it.wp_aimed = NULL; if (wasfreed(it.wp_locked)) it.wp_locked = NULL; - if (PHYS_INPUT_BUTTON_USE(it)) - it.wp_locked = it.wp_aimed; entity head = it.wp_locked; if (!head) head = navigation_findnearestwaypoint(it, false); diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index ea4cb9022..39c2190bf 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -205,6 +205,11 @@ void ClientCommand_wpeditor(entity caller, int request, int argc) waypoint_start_hardwiredlink(caller, (s == "crosshair")); return; } + else if (argv(1) == "lock") + { + waypoint_lock(caller); + return; + } else if (argv(1) == "unreachable") { if (!IS_PLAYER(caller)) @@ -259,6 +264,7 @@ void ClientCommand_wpeditor(entity caller, int request, int argc) sprint(caller, " ^5spawn support^7: spawns a support waypoint (spawn another waypoint to create destination from which all incoming links are removed), useful to replace links to preblematic jumppad/teleport waypoints\n"); sprint(caller, " ^5hardwire^7: marks the nearest waypoint as origin of a new hardwired link (spawn another waypoint over an existing one to create destination)\n"); sprint(caller, " ^5hardwire crosshair^7: marks the waypoint at crosshair instead of the nearest waypoint\n"); + sprint(caller, " ^5lock^7: locks link display of the aimed waypoint (unlocks if no waypoint is found at crosshair's position)\n"); sprint(caller, " ^5symorigin get|set\n"); sprint(caller, " ^5symorigin get|set p1 p2 ... pX\n"); sprint(caller, " ^5symaxis get|set p1 p2\n"); -- 2.39.2