SwitchPad.component
README.md
gallery.SwitchPad
Part of the Bastion Works showcase world's own content, not part of turretsKit or projectileKit. A glowing pad on the floor that changes one setting of a turret.
Step onto it (or press E, or tap the screen, while standing on it) and the turret named
by turretName moves to the next value of field: its type, its tier, its targeting mode or
its style. field = "styleAll" changes the style of every turret at once (the world
default for auto turrets via TK.setStyle, and every turret's own synced style via
TK.setStyleAll). Changes go through turretsKit.api, so they work from any player's
machine and every player sees them.
The pad is local UI only: it is not synced, and it reads the turret's synced fields for
its sign: two lines, the title and the current value, plus "E / tap: next" while you
stand on the pad. The ring pulses on each press. In edit mode the sign still follows the
turret's current value. The gallery scene places five of them from gallery.layout.
Public fields (all NoSync)
| Field | Type | Default | Meaning |
|---|---|---|---|
turretName | string | "Workshop" | Name of the turret entity this pad changes. |
field | enum def tier targeting style styleAll | "def" | Which setting it steps through (def = the turret type). |
title | string | "TYPE" | What the pad's sign says. |
radius | number | 0.95 | How close (flat distance, metres) the local player must stand. |
color | color | { r = 1, g = 0.8, b = 0.25, a = 1 } | Colour of the glowing ring. |
signHeight | number | 0.95 | How high the sign floats over the pad, in metres. |
signSize | number | 0.42 | The sign's text height, in metres. |
signSize and signHeight can change while the pad runs and the sign follows; gallery.PhoneFraming uses that to size and stack the signs on a phone held upright.