Add widget item type with editable sound and spatial controls
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
```json
|
||||
{
|
||||
"id": "string",
|
||||
"type": "radio_station | dice | wheel | clock",
|
||||
"type": "radio_station | dice | wheel | clock | widget",
|
||||
"title": "string",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
@@ -24,17 +24,17 @@
|
||||
- `useSound`: optional client-played one-shot sound when item `use` succeeds; global item field and not user-editable in V1.
|
||||
- `emitSound`: optional continuously-looping spatial sound emitted from the item on the grid; global item field and not user-editable in V1.
|
||||
- `capabilities`, `useSound`, and `emitSound` are derived from global item-type definitions at runtime (not stored per-instance in persisted state).
|
||||
- `useCooldownMs`: global per item type (`radio_station=1000`, `dice=1000`, `wheel=4000`, `clock=1000`), not per-instance editable.
|
||||
- `emitRange`: global spatial range default per item type (`radio_station=20`, `dice=15`, `wheel=15`, `clock=10`).
|
||||
- `useCooldownMs`: global per item type (`radio_station=1000`, `dice=1000`, `wheel=4000`, `clock=1000`, `widget=1000`), not per-instance editable.
|
||||
- `emitRange`: global spatial range default per item type (`radio_station=20`, `dice=15`, `wheel=15`, `clock=10`, `widget=15`).
|
||||
- `radio_station` can override this per instance via `params.emitRange` (`5..20`).
|
||||
- `directional`: global directional attenuation flag per item type (`radio_station=true`, others `false`), not per-instance editable.
|
||||
- `directional`: global directional attenuation flag per item type (`radio_station=true`, others `false`); `widget` can override per instance via `params.directional`.
|
||||
|
||||
## Persisted Item State (`server/runtime/items.json`)
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "string",
|
||||
"type": "radio_station | dice | wheel | clock",
|
||||
"type": "radio_station | dice | wheel | clock | widget",
|
||||
"title": "string",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
@@ -128,6 +128,26 @@
|
||||
- `use24Hour`: boolean (or `on/off` in updates), default `false`.
|
||||
- Global defaults: `useSound=none`, `emitSound=sounds/clock.ogg`.
|
||||
|
||||
### `widget`
|
||||
|
||||
```json
|
||||
{
|
||||
"enabled": true,
|
||||
"directional": false,
|
||||
"facing": 0,
|
||||
"emitRange": 15,
|
||||
"useSound": "",
|
||||
"emitSound": ""
|
||||
}
|
||||
```
|
||||
|
||||
- `enabled`: boolean (or `on/off` in updates), default `true`.
|
||||
- `directional`: boolean (or `on/off` in updates), default `false`.
|
||||
- `facing`: number, range `0-360`, precision `0.1`.
|
||||
- `emitRange`: integer, range `1-20`, default `15`.
|
||||
- `useSound`: empty, filename (assumed under `sounds/`), or full URL.
|
||||
- `emitSound`: empty, filename (assumed under `sounds/`), or full URL.
|
||||
|
||||
## Packet Shapes
|
||||
|
||||
- `item_upsert`:
|
||||
|
||||
@@ -110,6 +110,35 @@ This is behavior-focused documentation for item types and their defaults.
|
||||
- `timeZone`: one of `CLOCK_TIME_ZONE_OPTIONS` in `server/app/item_catalog.py`
|
||||
- `use24Hour`: boolean or on/off style input
|
||||
|
||||
## `widget`
|
||||
|
||||
### Defaults
|
||||
- Title: `widget`
|
||||
- Params:
|
||||
- `enabled=true`
|
||||
- `directional=false`
|
||||
- `facing=0`
|
||||
- `emitRange=15`
|
||||
- `useSound=""`
|
||||
- `emitSound=""`
|
||||
- Global:
|
||||
- `useSound=none`
|
||||
- `emitSound=none`
|
||||
- `useCooldownMs=1000`
|
||||
- `emitRange=15`
|
||||
- `directional=false`
|
||||
|
||||
### Use
|
||||
- `use` toggles `enabled` on/off and plays `useSound` when configured.
|
||||
|
||||
### Validation
|
||||
- `enabled`: boolean or on/off style input
|
||||
- `directional`: boolean or on/off style input
|
||||
- `facing`: number `0..360` with `0.1` precision
|
||||
- `emitRange`: integer `1..20`
|
||||
- `useSound`: empty, filename (assumed under `sounds/`), or full URL
|
||||
- `emitSound`: empty, filename (assumed under `sounds/`), or full URL
|
||||
|
||||
## Adding A New Item Type (Registry V1)
|
||||
|
||||
Item types are currently code-registered on both server and client. Server item logic is split per item module and wired through one registry.
|
||||
|
||||
Reference in New Issue
Block a user