void waypoint_spawn_fromeditor(entity pl, bool at_crosshair, bool is_jump_wp, bool is_crouch_wp, bool is_support_wp);
entity waypoint_spawn(vector m1, vector m2, float f);
void waypoint_unreachable(entity pl);
-void waypoint_start_hardwiredlink(entity pl);
+void waypoint_start_hardwiredlink(entity pl, bool at_crosshair);
void waypoint_getSymmetricalOrigin_cmd(entity caller, bool save, int arg_idx);
void waypoint_getSymmetricalAxis_cmd(entity caller, bool save, int arg_idx);
}
void crosshair_trace_waypoints(entity pl);
-void waypoint_start_hardwiredlink(entity pl)
+void waypoint_start_hardwiredlink(entity pl, bool at_crosshair)
{
entity wp = pl.nearestwaypoint;
- if ((!start_wp_is_spawned || start_wp_is_hardwired) && wp && !(wp.wpflags & WPFLAGMASK_NORELINK))
+ if (at_crosshair)
+ {
+ crosshair_trace_waypoints(pl);
+ wp = trace_ent;
+ }
+ string err = "";
+ if (start_wp_is_spawned && !start_wp_is_hardwired)
+ err = "can't hardwire while in the process of creating a special link";
+ else if (!wp)
+ {
+ if (at_crosshair)
+ err = "couldn't find any waypoint at crosshair";
+ else
+ err = "couldn't find any waypoint nearby";
+ }
+ else if (wp.wpflags & WPFLAGMASK_NORELINK)
+ err = "can't hardwire a waypoint with special links";
+
+ if (err == "")
{
start_wp_is_hardwired = true;
start_wp_is_spawned = true;
start_wp_origin = wp.origin;
pl.wp_locked = wp;
- LOG_INFOF("^x80fNearest waypoint %s marked as hardwired link origin.\n", vtos(wp.origin));
+ LOG_INFOF("^x80fWaypoint %s marked as hardwired link origin.\n", vtos(wp.origin));
}
else
+ {
start_wp_is_hardwired = false;
+ LOG_INFO("Error: ", err, "\n");
+ }
}
void waypoint_spawn_fromeditor(entity pl, bool at_crosshair, bool is_jump_wp, bool is_crouch_wp, bool is_support_wp)
}
else if (argv(1) == "hardwire")
{
- waypoint_start_hardwiredlink(caller);
+ string s = argv(2);
+ waypoint_start_hardwiredlink(caller, (s == "crosshair"));
return;
}
else if (argv(1) == "unreachable")
sprint(caller, " ^5unreachable^7: useful to reveal waypoints and items unreachable from the current position and spawnpoints without a nearest waypoint\n");
sprint(caller, " ^5saveall^7: saves all waypoints and links to file\n");
sprint(caller, " ^5relinkall^7: relink all waypoints as if they were respawned\n");
- sprint(caller, " ^5spawn crosshair^7: spawns a waypoint at crosshair's position (useful to spawn custom jumppad waypoints (spawn another waypoint to create destination))\n");
+ sprint(caller, " ^5spawn crosshair^7: spawns a waypoint at crosshair's position (in general useful to create special and hardwired links with ease from existing waypoints, in particular it's the only way to create custom jumppad waypoints (spawn another waypoint to create destination))\n");
sprint(caller, " ^5spawn jump^7: spawns a jump waypoint (spawn another waypoint to create destination)\n");
sprint(caller, " ^5spawn crouch^7: spawns a crouch waypoint\n");
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, " ^5symorigin get|set\n");
sprint(caller, " ^5symorigin get|set p1 p2 ... pX\n");
sprint(caller, " ^5symaxis get|set p1 p2\n");