Docs / Making content / Modding overview
Blind spot sensors: what the traffic sees
OMSI 2 scripts cannot ask the game what is around the vehicle, so a blind spot monitor in an add-on could only be faked (a timer, a fixed route trigger). openOMSI measures it: the AI traffic looks at the cars around the player's bus each frame and puts the result into six variables of the bus's varlists.
| Variable | What it holds |
|---|---|
BSM_Left, BSM_Right, BSM_Rear |
1 while a car is in that zone, 0 while it is clear |
BSM_Left_Dist, BSM_Right_Dist, BSM_Rear_Dist |
the gap to it in metres (0 while clear) |
The zones are the bus's own: 3.5 m out from each side along the body (plus 2 m past the
front so a car just pulling alongside counts), and 20 m behind the rear body line, all
within 3.5 m of the centre line. The gap is measured between the two bodies, not between
their centres. BSM_Left/BSM_Right are from the driver's seat, so they turn with the bus.
Declare only the variables the bus uses; a name the varlist does not have is not written at all, and a bus that declares none of them is not touched - OMSI 2 add-ons need no change:
[varlist]
BSM_Left
BSM_Left_DistThen light a mirror lamp or play a sound as usual:
(L.L.BSM_Right) 1 =
{if}
(L.L.BSM_Right_Dist) 3 <
{if}
(S.L.bsm_beep) 1 (S.L.mirror_lamp_right) 1
{endif}
{endif}What it does not do yet: no per-vehicle zone sizes (they are the same for every bus), no front zone, no object type (a car, a cyclist or a pedestrian reads the same) and no relative speed - the traffic's cars are all there is to see. Pedestrians and cyclists on foot are not in the zones.
Ticket validators#
OMSI 2 uses only the last [stamper] of a passengercabin.cfg. openOMSI keeps every
[stamper] of every section. A passenger stamps at the validator nearest to the door they came
in by.
- Write one
[stamper]block per validator: path point, then x, y, z of the device. - The validators are numbered from 0 in the order of the file.
When a ticket is stamped at validator N:
| Event | Kind |
|---|---|
ev_Stamper |
Sound trigger (as in OMSI 2) |
ev_Stamper<N> |
Sound trigger, so each validator can have its own sound |
PAX_Stamper_Used |
Script trigger |
PAX_Stamper<N>_Used |
Script trigger |
OMSI 2 still uses the last block and fires only ev_Stamper. A bus that gives each validator its
own sound can mute the ev_Stamper sound with a variable that the PAX_Stamper_Used trigger sets.
Something wrong or missing? Fix it on GitHub or open an issue.