openOMSI GitHub Discord

Docs / Routes and rail / Trolleybuses

The mouse's hand on a pole

2 min readEdit this pagedocs/TROLLEYBUS.md

A click on the cab's pole switch (a plain OMSI 2 trolleybus: cp_SHTANGALEV, cp_SHTANGAPRAV or what its model calls it) takes that pole in hand. The tip of the boom follows the mouse: it goes to the wire the cursor points at (as the R key's gaze does), or to where the cursor points when no wire is near.

The next click lets go, and the spring lifts the shoe into the wire it was aimed at; a wire missed, the pole flies loose and the motor's retriever (if it has one) pulls it down. One hand: one pole at a time. T still pulls a pole down by its rope.

From outside the cab (the outside, free or foot view) a click on a pole is the hand on its rope: the pole is taken where it is, the mouse up lets it rise, down pulls it down, sideways swings it, with no help to the wire.

The next click lets go, and the spring lifts the shoe from where it was held: into the wire just above it, or loose past it. Pushed up through a wire the shoe takes it and the hand lets go; let go a little over its hook, the pole catches on it.

A pole on the wire is taken off it the same way (an arc, as for any dewiring under current).

A model can hold the ropes itself, through its own [mouseevent]s on the boom and the rope, as OMSI 2 trolleybuses do: its script declares and writes, per pole k,

Variable Meaning
Trolley_Pole<k>_Rope 1 the rope is held (the press of its mouse event), -1 pulled down (a retriever), 0 let go
Trolley_Pole<k>_Rope_X, _Rope_Y the mouse's movement while held, in pixels ((L.S.mouse_x) / _y of its _drag, added up): the game takes them each step and sets them to 0

A pole with these takes no click of the game's own; the hand works as above, held while the mouse button is.

From the driver's seat the poles are behind the head and the wire is out of the cursor's reach, so a click on the switch has the motor raise the pole to the wire nearest its tip (the hand lets go when it is up).

A plain trolleybus draws no boom of its own: the model's raised pole mesh is turned about its hinge by Trolley_Pole<k>_Elev and _Azim (two [newanim]-style animations made when the model is loaded), and the cab's switch reads 0 with the pole on its hook (the folded mesh) and 1 otherwise.

Something wrong or missing? Fix it on GitHub or open an issue.

↑↓ to move↵ to open