jengine-route
Pointer-drawn routes flown by the engine’s steering components, and Crosswind (air-traffic landing).
| Kind | Project package: linked into the builds of the projects that list it |
| Source | packages/jengine-route |
| Version | 0.1.0 |
| Entry point | jengine_route::RoutePackage |
| Script namespace | Route |
| Listed by | projects/arcade-classics |
Using it
Section titled “Using it”List it in the top-level "packages" array of project.jengine:
{ "packages": [ { "name": "jengine-route", "source": { "type": "path", "path": "../../packages/jengine-route" } } ]}Then rebuild the editor viewport for the project (jengine viewport-build projects/<name>, or the
editor’s Rebuild viewport banner). Native and web builds link it on their own.
A scene that uses its components must be a v2 scene ("version": 2): a v1 scene has no field
for a package component and keeps it as inert custom data.
A script can check that the package is linked with if Route == nil then return end.
Components
Section titled “Components”| Scene key | Rust type | |
|---|---|---|
cw_sky | Sky | package only: needs a v2 scene |
Script commands
Section titled “Script commands”Commands run in every runtime and return nothing; a package publishes what scripts read onto components (see the notes below). The flat name also works.
| Call | Flat name |
|---|---|
Route.start(e) | cw_start |
Route.stop(e) | cw_stop |
Route.press(e, x, y) | cw_press |
Route.drag(e, x, y) | cw_drag |
Route.release(e) | cw_release |
Scenes that use it
Section titled “Scenes that use it”projects/arcade-classics/assets/scenes/crosswind.scene
From packages/jengine-route/src/lib.rs.
Routes drawn by hand, and flown by the engine’s own steering - and Crosswind, the air-traffic game built on them.
route is the reusable part: a line drawn with a pointer, simplified as
it is drawn, eaten as a follower passes along it, and a carrot a fixed
distance ahead on what is left. Nothing here moves a follower. A plane is
an ordinary entity with velocity, seek_target aimed at a carrot entity,
and face_velocity; this package only slides the carrot along the route,
and the engine’s steering - which no game had used - does the flying. That
is what gives a plane momentum and a turn instead of a sprite sliding along
a polyline.
What it draws, it draws as vector_paths: every route, and every runway,
from the same numbers the landing rule reads. Vector paths used to be a
pass of their own after every sprite, so a route could not lie under the
plane flying it; this game is why they sort with sprites now.
One cw_sky on a manager entity: runways, arrivals, separation,
atlas, art and colors per plane kind, and the steering numbers. An
entity tagged balloon (Crosswind’s drift on patrol_path loops) is an
obstacle: touching one is a crash.
Script commands
Section titled “Script commands”| Call | Does |
|---|---|
Route.start(e) | clear the sky and begin a shift |
Route.stop(e) | clear the sky |
Route.press(e, x, y) | pick up the nearest plane under the pointer and start its route |
Route.drag(e, x, y) | extend the route being drawn |
Route.release(e) | finish it |
What scripts read
Section titled “What scripts read”cw_sky bag: running, landed, over, crash_x, crash_y, planes
({ id, x, y, kind, warn, drawing, routed, locked }) and events
(arrived, landed, locked, crash).