Route
SetTarget and SetMaxSpeed change how a drone moves.
Things to know
SetTarget(id, nodeId)points a drone at an air node but does not start it. A drone that is off keeps the new target until you callSetActive(id, true). It returnstruewhen the drone’s target is now that node. It returnsfalsefor an unknown drone, an unknown node id, an empty id, or while a save is loading or being written. (It finds the drone and the node, then callsDrone.SetTarget, which only assignstargetNode.)SetMaxSpeed(id, maxSpeed)sets how fast the drone may fly, and it must be above 0. It returnsfalsefor zero, a negative number, a value that is not a real number, an infinite value, an unknown drone, or while a save is loading or being written. A zero speed would break the drone’s movement, so it is always refused. (It callsDrone.SetMaxSpeed, which assigns the publicmaxSpeed. A zero would divide by zero inUpdate.)- The target is saved. The game saves a drone’s target as the node’s save id, and finds the node again when the save loads. A node with no save id is saved as nothing and loads with no target. (The target is saved through
targetNodeRef, which storesAir_Node.GUIDand resolves it on load throughAir_Node.GetNode.)
Limits
- You can’t clear a drone’s target. Passing a null node is refused. A drone with no target switches itself off on its next update, so clearing would stop the drone as a side effect, and the framework does not start that. (With
deActivateOnPathEndset (the default), a nulltargetNodeturns the drone off inUpdate.) - A target node can override your
SetMaxSpeedvalue: if the node has its own top speed above 0, that one wins. - The top speed should be saved too, but that has not been confirmed. (
maxSpeedis a public field without[fsIgnore], so the save code is expected to keep it.)