threedog 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (244) hide show
  1. package/README.md +4 -4
  2. package/core/Animator.js +1 -0
  3. package/core/Assets.js +28 -0
  4. package/core/DebugOverrides.js +143 -0
  5. package/core/Describe.js +14 -3
  6. package/core/Engine.js +44 -72
  7. package/core/Events.js +59 -1
  8. package/core/I18n.js +2 -2
  9. package/core/Inspect.js +12 -32
  10. package/core/InspectScene.js +7 -3
  11. package/core/MaterialInfo.js +32 -0
  12. package/core/Ops.js +43 -59
  13. package/core/Saves.js +5 -4
  14. package/core/UrlState.js +3 -2
  15. package/core/Vars.js +1 -0
  16. package/core/Views.js +49 -0
  17. package/core/actor.js +2 -2
  18. package/core/assetReport.js +83 -0
  19. package/core/catalog.js +169 -0
  20. package/core/checks.js +67 -0
  21. package/core/claims.js +51 -0
  22. package/core/debugView.js +76 -0
  23. package/core/describeRender.js +51 -0
  24. package/core/describeText.js +11 -4
  25. package/core/errorCodes.js +33 -0
  26. package/core/errorHints.js +6 -1
  27. package/core/grid.js +127 -0
  28. package/core/gridLoad.js +19 -0
  29. package/core/holds.js +106 -0
  30. package/core/lifecycle.js +1 -0
  31. package/core/lightWatch.js +23 -3
  32. package/core/look/coreParts.js +112 -0
  33. package/core/look/layers.js +136 -0
  34. package/core/look/part.js +173 -0
  35. package/core/look/report.js +79 -0
  36. package/core/look/write.js +86 -0
  37. package/core/loop.js +22 -16
  38. package/core/modules.js +19 -5
  39. package/core/opsAtomic.js +31 -0
  40. package/core/opsCheck.js +25 -14
  41. package/core/opsFail.js +20 -0
  42. package/core/opsHistory.js +6 -6
  43. package/core/opsRun.js +77 -0
  44. package/core/params.js +132 -0
  45. package/core/renamed.js +22 -0
  46. package/core/saveApply.js +2 -2
  47. package/core/sceneMethods.js +9 -34
  48. package/core/services.js +73 -0
  49. package/core/startup.js +3 -1
  50. package/core/styleParts.js +11 -9
  51. package/core/thingExplain.js +68 -0
  52. package/core/thingOps.js +35 -24
  53. package/core/things.js +15 -1
  54. package/core/util.js +11 -0
  55. package/core/validate.js +23 -7
  56. package/docs/AI.md +93 -114
  57. package/docs/API.md +8 -9
  58. package/docs/CODEMAP.md +67 -53
  59. package/docs/COMMANDS.md +21 -7
  60. package/docs/CONVENTIONS.md +22 -11
  61. package/docs/THREE.md +3 -3
  62. package/docs/api/assets.md +3 -0
  63. package/docs/api/characters.md +5 -2
  64. package/docs/api/collision.md +4 -0
  65. package/docs/api/content.md +1 -0
  66. package/docs/api/engine.md +23 -14
  67. package/docs/api/events.md +5 -1
  68. package/docs/api/post.md +5 -4
  69. package/docs/api/saves.md +2 -1
  70. package/docs/api/sky.md +3 -3
  71. package/docs/api/style.md +8 -8
  72. package/docs/api/tools.md +5 -2
  73. package/docs/api/vegetation.md +1 -0
  74. package/docs/api/weather.md +1 -1
  75. package/docs/recipes/01-new-game.md +41 -43
  76. package/docs/recipes/02-npc.md +38 -22
  77. package/docs/recipes/03-items-pickups.md +4 -4
  78. package/docs/recipes/04-quests.md +23 -23
  79. package/docs/recipes/05-props-bake.md +5 -5
  80. package/docs/recipes/06-clock-events.md +13 -0
  81. package/docs/recipes/07-flow-scenes-pause.md +6 -2
  82. package/docs/recipes/08-weather-sky.md +6 -6
  83. package/docs/recipes/09-style-pack.md +35 -100
  84. package/docs/recipes/12-navmesh.md +22 -0
  85. package/docs/recipes/13-animation.md +25 -6
  86. package/docs/recipes/14-custom-module.md +6 -7
  87. package/docs/recipes/15-perf.md +9 -1
  88. package/docs/recipes/16-dev-bridge.md +52 -18
  89. package/docs/recipes/18-world.md +5 -2
  90. package/docs/recipes/19-shooting-picking.md +9 -8
  91. package/docs/recipes/20-content-actions-save.md +10 -10
  92. package/docs/recipes/21-camera.md +51 -2
  93. package/docs/recipes/22-shop-gold.md +16 -16
  94. package/docs/recipes/23-ops.md +46 -10
  95. package/docs/recipes/27-net.md +3 -3
  96. package/docs/recipes/28-terrain.md +2 -2
  97. package/docs/recipes/29-grid.md +47 -27
  98. package/docs/recipes/34-environment-lighting.md +11 -10
  99. package/docs/recipes/35-style-from-reference.md +41 -46
  100. package/docs/recipes/36-sky-ground-plant-looks.md +22 -20
  101. package/docs/recipes/37-terrain-look-hooks.md +34 -13
  102. package/docs/recipes/38-environment-look-hooks.md +49 -42
  103. package/docs/recipes/40-scene.md +29 -0
  104. package/docs/recipes/41-thing-registry.md +29 -0
  105. package/docs/recipes/42-terrain-shape.md +1 -1
  106. package/docs/recipes/43-shader-patches-surface-looks.md +37 -20
  107. package/docs/recipes/44-water-weather-look-hooks.md +11 -9
  108. package/docs/recipes/45-cascaded-shadows.md +2 -2
  109. package/docs/recipes/46-blender-art-route.md +26 -4
  110. package/docs/recipes/47-island-snow-backdrop.md +4 -3
  111. package/docs/recipes/48-make-material.md +70 -0
  112. package/docs/recipes/49-game-module-contract.md +71 -0
  113. package/docs/recipes/50-own-renderer.md +12 -0
  114. package/docs/recipes/51-capability-catalog.md +63 -0
  115. package/docs/recipes/52-look.md +146 -0
  116. package/docs/recipes/53-ground-up-close.md +58 -0
  117. package/examples/action/GAMEMAP.md +7 -7
  118. package/examples/action/content/index.js +2 -1
  119. package/examples/action/content/views.js +6 -0
  120. package/examples/action/main.js +3 -2
  121. package/examples/sheepisland/GAMEMAP.md +3 -4
  122. package/examples/styletest/GAMEMAP.md +3 -3
  123. package/examples/styletest/content/npcs.js +1 -1
  124. package/examples/styletest/main.js +2 -2
  125. package/examples/styletest/panel.js +3 -3
  126. package/examples/world/GAMEMAP.md +3 -3
  127. package/examples/world/content/npcs.js +1 -1
  128. package/examples/world/main.js +1 -1
  129. package/index.d.ts +35 -2
  130. package/index.js +6 -3
  131. package/llms.txt +13 -7
  132. package/modules/ambience/Ambience.js +5 -2
  133. package/modules/camera/FirstPersonCamera.js +3 -5
  134. package/modules/camera/FixedCamera.js +19 -12
  135. package/modules/camera/FollowCamera.js +14 -8
  136. package/modules/camera/RtsCamera.js +3 -5
  137. package/modules/camera/common.js +40 -10
  138. package/modules/camera/index.js +1 -1
  139. package/modules/camera/projection.js +34 -0
  140. package/modules/characters/Character.js +45 -31
  141. package/modules/characters/assetModel.js +35 -7
  142. package/modules/characters/astar.js +14 -7
  143. package/modules/characters/index.js +6 -3
  144. package/modules/characters/movers/simple.js +6 -1
  145. package/modules/characters/npcSim.js +8 -2
  146. package/modules/characters/pathAsync.js +12 -6
  147. package/modules/characters/pathJob.js +2 -1
  148. package/modules/characters/proceduralRig.js +50 -11
  149. package/modules/characters/useModel.js +22 -0
  150. package/modules/characters/walkTo.js +58 -0
  151. package/modules/collision/Collision.js +102 -4
  152. package/modules/content/explain.js +13 -0
  153. package/modules/content/index.js +3 -1
  154. package/modules/content/loader.js +3 -0
  155. package/modules/content/rules.js +1 -0
  156. package/modules/debug/DebugPanel.js +11 -5
  157. package/modules/entities/Entities.js +6 -2
  158. package/modules/flow/index.js +5 -2
  159. package/modules/gameplay/Dialogue.js +5 -2
  160. package/modules/gameplay/Interactions.js +12 -2
  161. package/modules/gameplay/Inventory.js +21 -11
  162. package/modules/gameplay/Quests.js +13 -3
  163. package/modules/gameplay/pickups.js +6 -4
  164. package/modules/grid/Layer.js +1 -1
  165. package/modules/grid/index.js +1 -1
  166. package/modules/grid/tiles.js +9 -5
  167. package/modules/hlod/index.js +5 -2
  168. package/modules/hud/index.js +5 -2
  169. package/modules/level/index.js +5 -3
  170. package/modules/lights/index.js +5 -2
  171. package/modules/music/Music.js +6 -2
  172. package/modules/nav/index.js +5 -3
  173. package/modules/net/Client.js +4 -3
  174. package/modules/net/Host.js +2 -2
  175. package/modules/net/index.js +5 -3
  176. package/modules/particles/Particles.js +1 -1
  177. package/modules/photo/Photo.js +10 -7
  178. package/modules/rigid/RigidBodies.js +5 -2
  179. package/modules/settings/Settings.js +6 -3
  180. package/modules/settings/apply.js +2 -1
  181. package/modules/sky/Sky.js +21 -19
  182. package/modules/sky/cascades.js +6 -6
  183. package/modules/sky/domeLayers.js +1 -1
  184. package/modules/sky/environment.js +39 -13
  185. package/modules/sky/fog.js +9 -6
  186. package/modules/sky/frame.js +4 -3
  187. package/modules/sky/look.js +3 -2
  188. package/modules/sky/lookFog.js +80 -0
  189. package/modules/sky/lookShadow.js +50 -0
  190. package/modules/sky/lookSky.js +108 -0
  191. package/modules/sky/shader.js +2 -2
  192. package/modules/sky/shadow.js +4 -10
  193. package/modules/sky/skyModule.js +4 -3
  194. package/modules/terrain/ChunkManager.js +2 -33
  195. package/modules/terrain/chunkLevels.js +40 -0
  196. package/modules/terrain/index.js +10 -2
  197. package/modules/terrain/lookGround.js +61 -0
  198. package/modules/timeline/Timeline.js +7 -3
  199. package/modules/timeline/Tween.js +3 -7
  200. package/modules/timeline/shots.js +6 -4
  201. package/modules/triggers/index.js +9 -2
  202. package/modules/vegetation/Vegetation.js +17 -4
  203. package/modules/vegetation/index.js +7 -4
  204. package/modules/vegetation/lookWind.js +37 -0
  205. package/modules/vegetation/nearFade.js +39 -0
  206. package/modules/water/Water.js +19 -3
  207. package/modules/water/look.js +80 -0
  208. package/modules/weather/Weather.js +22 -31
  209. package/modules/weather/look.js +75 -0
  210. package/modules/weather/particles.js +1 -1
  211. package/modules/weather/strings.js +15 -0
  212. package/modules/world/explain.js +11 -0
  213. package/modules/world/index.js +11 -4
  214. package/modules/world/thingSource.js +44 -0
  215. package/package.json +2 -1
  216. package/render/PostFX.js +48 -51
  217. package/render/detail.js +39 -15
  218. package/render/effects.js +4 -2
  219. package/render/fuse.js +12 -0
  220. package/render/lights.js +4 -2
  221. package/render/lookSurface.js +161 -0
  222. package/render/materials.js +27 -10
  223. package/render/postLook.js +86 -0
  224. package/render/surface.js +3 -1
  225. package/types/core.d.ts +223 -29
  226. package/types/gameplay.d.ts +22 -6
  227. package/types/generated/core/DebugOverrides.d.ts +52 -0
  228. package/types/generated/core/Events.d.ts +43 -0
  229. package/types/generated/core/Ops.d.ts +62 -21
  230. package/types/generated/core/Saves.d.ts +1 -0
  231. package/types/generated/core/Views.d.ts +33 -0
  232. package/types/generated/modules/debug/DebugPanel.d.ts +2 -2
  233. package/types/generated/modules/grid/Layer.d.ts +1 -0
  234. package/types/generated/modules/sky/Sky.d.ts +10 -17
  235. package/types/generated/modules/weather/Weather.d.ts +5 -15
  236. package/types/generated/render/PostFX.d.ts +20 -23
  237. package/types/generated/render/materials.d.ts +10 -0
  238. package/types/physics.d.ts +8 -0
  239. package/types/style.d.ts +35 -20
  240. package/types/world.d.ts +7 -1
  241. package/ui/Parts.js +6 -2
  242. package/ui/UI.js +1 -1
  243. package/ui/defaults.js +1 -1
  244. package/docs/api/debug.md +0 -10
@@ -4,15 +4,21 @@
4
4
  * Inside an op use ctx.actor (world record id, default engine.actor = 'player'), never engine.player: NPCs and network peers run the same op as themselves.
5
5
  */
6
6
  export class Ops {
7
+ /** Counter bumped on each committed op (an op that failed or rolled back does not bump it); every run result carries it, so "did anything change since I looked" is one compare */
8
+ revision: number;
7
9
  set historySize(n: number);
8
10
  /** History entries kept (ring, default 256); setting it clears the history */
9
11
  get historySize(): number;
10
12
  /**
11
13
  * Register an op. Name it noun.verb. run changes state; can (optional) is read-only and returns true or a reason string; offers (optional) lists the arg sets possible now (for list / describe / the dev bridge `ops` command).
12
14
  * args shape types: string number int bool position id any, suffix ? for optional. net: 'peer' lets remote players request it (default: host only);
15
+ * or { type, default, min, max, values, desc } (default is filled in, engine.catalog shows it).
16
+ * atomic: true = world records, inventory containers and vars written by run are rolled back if run fails or throws (events and other state are not; see recipe 23); after(e, args, value, ctx): sound / animation, runs only once the op committed.
17
+ * run (and can) may fail with { ok: false, code, facts, nextActions } (facts: object or list [{ id, field, actual, expected? }]); nextActions are the game's own suggestions.
13
18
  * owner (optional, checked by net() for peer requests): args => world record id whose `owner` field must equal the requesting actor.
14
19
  * @param {string} name
15
- * @param {{ run: (e: any, args: any, ctx: OpContext) => any, can?: (e: any, args: any, ctx: OpContext) => true | string, args?: Record<string, string>, offers?: (e: any, ctx: OpContext) => object[], reasons?: Record<string, string>, desc?: string, undo?: (e: any, args: any, value: any) => void, net?: 'peer' | 'local', owner?: (args: any) => string }} def
20
+ * targets (optional): the thing ids, kinds or template names this op is for; engine.thing(id).explain().ops lists it ('*' = any thing).
21
+ * @param {{ run: (e: any, args: any, ctx: OpContext) => any, can?: (e: any, args: any, ctx: OpContext) => true | string | { code: string, facts?: object, nextActions?: { op: string, args?: object }[] }, targets?: string | string[], args?: Record<string, string | { type: string, default?: any, min?: number, max?: number, values?: any[], desc?: string, optional?: boolean }>, offers?: (e: any, ctx: OpContext) => object[], reasons?: Record<string, string>, desc?: string, undo?: (e: any, args: any, value: any) => void, net?: 'peer' | 'local', owner?: (args: any) => string, atomic?: boolean, after?: (e: any, args: any, value: any, ctx: OpContext) => void }} def
16
22
  * @returns {{ remove(): void }}
17
23
  * @example
18
24
  * const PRICE = { bread: 5 };
@@ -34,28 +40,46 @@ export class Ops {
34
40
  */
35
41
  define(name: string, def: {
36
42
  run: (e: any, args: any, ctx: OpContext) => any;
37
- can?: (e: any, args: any, ctx: OpContext) => true | string;
38
- args?: Record<string, string>;
43
+ can?: (e: any, args: any, ctx: OpContext) => true | string | {
44
+ code: string;
45
+ facts?: object;
46
+ nextActions?: {
47
+ op: string;
48
+ args?: object;
49
+ }[];
50
+ };
51
+ targets?: string | string[];
52
+ args?: Record<string, string | {
53
+ type: string;
54
+ default?: any;
55
+ min?: number;
56
+ max?: number;
57
+ values?: any[];
58
+ desc?: string;
59
+ optional?: boolean;
60
+ }>;
39
61
  offers?: (e: any, ctx: OpContext) => object[];
40
62
  reasons?: Record<string, string>;
41
63
  desc?: string;
42
64
  undo?: (e: any, args: any, value: any) => void;
43
65
  net?: "peer" | "local";
44
66
  owner?: (args: any) => string;
67
+ atomic?: boolean;
68
+ after?: (e: any, args: any, value: any, ctx: OpContext) => void;
45
69
  }): {
46
70
  remove(): void;
47
71
  };
48
72
  /**
49
- * Run an op now (synchronously): checks args (dev), calls can, then run, and logs it. Returns { ok: true, value } or { ok: false, reason }.
73
+ * Run an op now (synchronously): checks args (dev), calls can, then run, and logs it. Returns { ok: true, value, revision } or { ok: false, code, facts, nextActions, revision } (revision = ops.revision, counts committed ops); can may also return { code, facts?, nextActions? }.
50
74
  * Pass a fresh args object each call (it is kept in the history; in dev it is frozen). opts.source: 'player' | 'game' | 'bridge' | 'test' | 'replay' | 'net'
51
75
  * (default: 'game' inside a fixed step, 'player' between steps); opts.actor: who does it (world record id, default engine.actor, which is 'player' unless the game hands control elsewhere).
52
76
  * @param {string} name
53
77
  * @param {object} [args]
54
78
  * @param {{ source?: string, actor?: string }} [opts]
55
- * @returns {{ ok: boolean, value?: any, reason?: string }}
79
+ * @returns {{ ok: boolean, value?: any, revision: number, code?: string, facts?: object, nextActions?: { op: string, args?: object }[] }}
56
80
  * @example
57
81
  * const r = engine.ops.run('shop.buy', { shop: 'bakery', item: 'bread' });
58
- * if (!r.ok) showHint(engine.t('op.shop.buy.' + r.reason));
82
+ * if (!r.ok) showHint(engine.t('op.shop.buy.' + r.code));
59
83
  * // from a fixed step, for an input-driven action: e.ops.run('combat.roll', { dir }, { source: 'player' })
60
84
  */
61
85
  run(name: string, args?: object, opts?: {
@@ -64,31 +88,42 @@ export class Ops {
64
88
  }): {
65
89
  ok: boolean;
66
90
  value?: any;
67
- reason?: string;
91
+ revision: number;
92
+ code?: string;
93
+ facts?: object;
94
+ nextActions?: {
95
+ op: string;
96
+ args?: object;
97
+ }[];
68
98
  };
69
99
  /**
70
100
  * Reverse a finished op with the undo(e, args, value) its definition declared: pass the same args and the value run returned.
71
- * Returns { ok: true }, or { ok: false, reason: 'noUndo' } when the op did not declare undo. The undo runs as an op write (the dev guard stays quiet).
101
+ * Returns { ok: true }, or { ok: false, code: 'noUndo', facts: { op }, nextActions } when the op did not declare undo. The undo runs as an op write (the dev guard stays quiet).
72
102
  * @example const r = engine.ops.run('inventory.trade', { take: 'rusty_key', give: 'gold_key' }); engine.ops.undo('inventory.trade', { take: 'rusty_key', give: 'gold_key' }, r.value);
73
103
  * @param {string} name
74
104
  * @param {object} args
75
105
  * @param {any} value
76
106
  * @param {{ actor?: string }} [opts]
77
- * @returns {{ ok: boolean, reason?: string }}
107
+ * @returns {{ ok: boolean, code?: string, facts?: object, nextActions?: { op: string, args?: object }[] }}
78
108
  */
79
109
  undo(name: string, args: object, value: any, opts?: {
80
110
  actor?: string;
81
111
  }): {
82
112
  ok: boolean;
83
- reason?: string;
113
+ code?: string;
114
+ facts?: object;
115
+ nextActions?: {
116
+ op: string;
117
+ args?: object;
118
+ }[];
84
119
  };
85
120
  /**
86
121
  * Ask without doing: runs only can (no state change, no history). For greying out buttons and input buffers.
87
122
  * @param {string} name
88
123
  * @param {object} [args]
89
124
  * @param {{ actor?: string, source?: string }} [opts]
90
- * @returns {{ ok: boolean, reason?: string }}
91
- * @example const { ok, reason } = engine.ops.can('shop.buy', { shop: 'bakery', item: 'bread' });
125
+ * @returns {{ ok: boolean, code?: string, facts?: object, nextActions?: { op: string, args?: object }[] }}
126
+ * @example const { ok, code } = engine.ops.can('shop.buy', { shop: 'bakery', item: 'bread' });
92
127
  * button.disabled = !ok;
93
128
  */
94
129
  can(name: string, args?: object, opts?: {
@@ -96,14 +131,19 @@ export class Ops {
96
131
  source?: string;
97
132
  }): {
98
133
  ok: boolean;
99
- reason?: string;
134
+ code?: string;
135
+ facts?: object;
136
+ nextActions?: {
137
+ op: string;
138
+ args?: object;
139
+ }[];
100
140
  };
101
141
  /**
102
142
  * What exists, or with { available: true } what is possible now: every arg set from each op's offers checked with can
103
143
  * (an op with neither offers nor args is checked once with {}; one with args but no offers is skipped, since its args are free-form).
104
144
  * @param {{ available?: boolean, actor?: string }} [opts]
105
- * @returns {{ name: string, desc?: string, args?: any, ok?: boolean, reason?: string }[]}
106
- * @example engine.ops.list({ available: true }); // [{ name: 'shop.buy', args: { shop: 'bakery', item: 'bread' }, ok: false, reason: 'noMoney' }, ...]
145
+ * @returns {{ name: string, desc?: string, args?: any, atomic: boolean, ok?: boolean, code?: string }[]}
146
+ * @example engine.ops.list({ available: true }); // [{ name: 'shop.buy', args: { shop: 'bakery', item: 'bread' }, ok: false, code: 'noMoney' }, ...]
107
147
  */
108
148
  list({ available, actor }?: {
109
149
  available?: boolean;
@@ -112,15 +152,16 @@ export class Ops {
112
152
  name: string;
113
153
  desc?: string;
114
154
  args?: any;
155
+ atomic: boolean;
115
156
  ok?: boolean;
116
- reason?: string;
157
+ code?: string;
117
158
  }[];
118
159
  /**
119
- * Recent history (old -> new), optionally of one op: { seq, tick, phase: 'fixed' | 'between', name, args, source, actor, ok, reason, depth, count }.
120
- * Consecutive identical failures (same actor, op and reason) merge into one entry with count.
160
+ * Recent history (old -> new), optionally of one op: { seq, tick, phase: 'fixed' | 'between', name, args, source, actor, ok, code, depth, count }.
161
+ * Consecutive identical failures (same actor, op and code) merge into one entry with count.
121
162
  * @param {string} [name]
122
- * @returns {{ seq: number, tick: number, phase: string, name: string, args: any, source: string, actor: string, ok: boolean, reason: string | null, depth: number, count: number }[]}
123
- * @example engine.ops.recent('shop.buy').at(-1); // { tick: 812, phase: 'between', ok: false, reason: 'noMoney', ... }
163
+ * @returns {{ seq: number, tick: number, phase: string, name: string, args: any, source: string, actor: string, ok: boolean, code: string | null, depth: number, count: number }[]}
164
+ * @example engine.ops.recent('shop.buy').at(-1); // { tick: 812, phase: 'between', ok: false, code: 'noMoney', ... }
124
165
  */
125
166
  recent(name?: string): {
126
167
  seq: number;
@@ -131,7 +172,7 @@ export class Ops {
131
172
  source: string;
132
173
  actor: string;
133
174
  ok: boolean;
134
- reason: string | null;
175
+ code: string | null;
135
176
  depth: number;
136
177
  count: number;
137
178
  }[];
@@ -31,6 +31,7 @@ export class Saves {
31
31
  * shape.
32
32
  * A save whose part is newer than this build's version is refused as a whole (load returns false, the save is kept).
33
33
  * A part registered after a save was loaded (a module installed later) is handed its data from that save at once.
34
+ * atomic: true joins this part to atomic ops: it is copied before an atomic op runs and put back if the op fails (plain data only; afterLoad does not run on rollback).
34
35
  * @param {string} key
35
36
  * @param {SaveProvider} provider
36
37
  * @example
@@ -0,0 +1,33 @@
1
+ // Generated by npm run map, do not edit by hand. Source: packages/engine/core/Views.js (edit the JSDoc in the source, then run npm run map)
2
+ export class Views {
3
+ /** @param {any} engine */
4
+ constructor(engine: any);
5
+ engine: any;
6
+ map: Map<any, any>;
7
+ current: string;
8
+ /**
9
+ * Declare a view. position and target are [x, y, z]; fov (degrees) is optional (the camera's own when left out). Returns { remove() } (undeclares it).
10
+ * @param {string} name @param {{ position: number[], target?: number[], fov?: number }} v
11
+ * @returns {{ remove(): void }}
12
+ */
13
+ define(name: string, v: {
14
+ position: number[];
15
+ target?: number[];
16
+ fov?: number;
17
+ }): {
18
+ remove(): void;
19
+ };
20
+ /** @param {string} name */
21
+ has(name: string): boolean;
22
+ /** @returns {string[]} the declared view names */
23
+ list(): string[];
24
+ /**
25
+ * Put the camera on a view and keep it there (the camera rigs leave it alone) until release() or the returned handle's remove(); null for an unknown name
26
+ * @param {string} name @returns {{ remove(): void } | null}
27
+ */
28
+ show(name: string): {
29
+ remove(): void;
30
+ } | null;
31
+ /** Give the camera back (to the previous holder, e.g. a running cutscene, or to the rig) */
32
+ release(): void;
33
+ }
@@ -1,6 +1,6 @@
1
1
  // Generated by npm run map, do not edit by hand. Source: packages/engine/modules/debug/DebugPanel.js (edit the JSDoc in the source, then run npm run map)
2
2
  /**
3
- * F3 F3 debug panel -> engine.debug: performance panel, settings, stress test. Collapsed by default; F3 shows/hides it; open: true shows it at start. Just do not install it in a release
3
+ * F3 debug panel -> engine.debug.panel: performance panel, settings, stress test. Collapsed by default; F3 shows/hides it; open: true shows it at start. Just do not install it in a release
4
4
  * @param {{ open?: boolean }} [opts]
5
5
  * @returns {ModuleDef<DebugPanel>}
6
6
  */
@@ -8,7 +8,7 @@ export function debug(opts?: {
8
8
  open?: boolean;
9
9
  }): ModuleDef<DebugPanel>;
10
10
  /** @import { ModuleDef } from '../../../core' */
11
- /** engine.debug (F3 panel) */
11
+ /** engine.debug.panel (F3 panel) */
12
12
  export class DebugPanel {
13
13
  /** Stress test running (player auto-runs fast) @type {boolean} */
14
14
  benchmarking: boolean;
@@ -53,6 +53,7 @@ export class Layer {
53
53
  export type LayerOptions = {
54
54
  tiles?: boolean | {
55
55
  look?: (data: Record<string, any>, cell: [number, number]) => any;
56
+ colors?: Record<string, number | string>;
56
57
  lift?: number;
57
58
  } | ((engine: any, layer: Layer) => {
58
59
  update?: (cells: {
@@ -33,7 +33,7 @@ export class Sky {
33
33
  sway: number;
34
34
  distance: number;
35
35
  };
36
- /** Current shadow params (change via setShadow) @readonly @type {SkyShadowParams} */
36
+ /** Current shadow params (change via look.shadow.set) @readonly @type {SkyShadowParams} */
37
37
  readonly shadow: SkyShadowParams;
38
38
  /** three's CSM (addons/csm) while shadow.cascades > 1, else null; its lights[0] is sun (recipes/45) @type {any} */
39
39
  csm: any;
@@ -110,14 +110,11 @@ export class Sky {
110
110
  */
111
111
  onSeason(name: string, fn: (season: string) => void): Handle;
112
112
  /**
113
- * Change shadow params (only the given fields): bias / normalBias prevent banding; updateEvery updates shadows every N frames (1 = every frame);
114
- * snap snap = shadow center snap grid (meters, or 'texel' to snap to shadow pixels); ahead = meters to shift the shadow center in front of the view;
115
- * type = 'basic' (hard edge) | 'pcf' | 'vsm' (soft, costlier; switching rebuilds the shadow map and recompiles materials, so do it rarely);
116
- * radius = edge softness (pcf, vsm; no effect on basic); blurSamples = blur quality (vsm only); cascades 2-4 = cascaded shadows, 1 = off (recipes/45)
117
- * @param {Partial<SkyShadowParams>} [opts]
118
- * @returns {this}
113
+ * Renamed in 0.2: throws and names the new call, engine.look.shadow.set(opts) (fields: bias, normalBias, updateEvery, snap, ahead, type, radius, blurSamples, cascades; recipes/45)
114
+ * @param {Partial<SkyShadowParams>} [_opts]
115
+ * @returns {never}
119
116
  */
120
- setShadow(opts?: Partial<SkyShadowParams>): this;
117
+ setShadow(_opts?: Partial<SkyShadowParams>): never;
121
118
  /**
122
119
  * Change shadow resolution (raise temporarily for photo mode)
123
120
  * @param {number} n pixels
@@ -125,20 +122,16 @@ export class Sky {
125
122
  */
126
123
  setShadowMapSize(n: number): void;
127
124
  /**
128
- * Environment lighting (scene.environment), separate from the background and off by default. source 'sky' builds it from the procedural sky (rebuilt at
129
- * most every `interval` seconds, only when the sky changed); an asset name or path (.hdr, .jpg, .ktx2) is an equirectangular panorama. intensity scales
130
- * the light (default 1), rotation turns it around Y (radians). Given fields change, the rest stay; null turns it off. Lambert surfaces get soft ambient
131
- * light from it (no reflections); lower the hemisphere ambient when you turn it on (recipes/09)
132
- * @example engine.sky.setEnvironment({ source: 'sky', intensity: 0.8 }); engine.sky.setEnvironment(null);
133
- * @param {{ source?: string | null, intensity?: number, rotation?: number, interval?: number } | null} [opts]
134
- * @returns {this}
125
+ * Renamed in 0.2: throws and names the new call, engine.look.env.replace(source) then engine.look.env.set({ intensity, rotation, interval })
126
+ * @param {{ source?: string | null, intensity?: number, rotation?: number, interval?: number } | null} [_opts]
127
+ * @returns {never}
135
128
  */
136
- setEnvironment(opts?: {
129
+ setEnvironment(_opts?: {
137
130
  source?: string | null;
138
131
  intensity?: number;
139
132
  rotation?: number;
140
133
  interval?: number;
141
- } | null): this;
134
+ } | null): never;
142
135
  /** Environment lighting now: { source, intensity, rotation, interval, builds }, null when off @type {SkyEnvironmentInfo | null} */
143
136
  get environment(): SkyEnvironmentInfo | null;
144
137
  }
@@ -29,22 +29,12 @@ export class Weather {
29
29
  /** Particle systems drawn now: field -> { field, object, uniforms } (rain / snow when the table has them, plus define()) @type {Map<string, any>} */
30
30
  systems: Map<string, any>;
31
31
  /**
32
- * Draw particles for a field of this game's weather table (its amount is weather.current[field], so they fade with the weather). spec takes the
33
- * keys of style.weather.rain (shape, color, size, speed, sway, density, glsl...) or create(engine, { area, count }) => { object, update } for a
34
- * system of your own. The same field again replaces it, rain and snow included. See recipes/44-water-weather-look-hooks.md
35
- * @example
36
- * engine.weather.define('ash', { shape: 'soft', color: 0x555555, size: 14, speed: 0.8, sway: 3 }); // types: { ashfall: { ash: 1, grey: 0.5 } }
37
- * @param {string} field
38
- * @param {import('../../../style').StyleWeatherParticles} [spec]
39
- * @returns {{ field: string, object: THREE.Object3D, uniforms: Record<string, { value: any }> | null }}
32
+ * Renamed in 0.2: throws and names the new call, engine.look.weather.replace({ [field]: spec }) (recipes/44-water-weather-look-hooks.md)
33
+ * @param {string} _field
34
+ * @param {import('../../../style').StyleWeatherParticles} [_spec]
35
+ * @returns {never}
40
36
  */
41
- define(field: string, spec?: import("../../../style").StyleWeatherParticles): {
42
- field: string;
43
- object: THREE.Object3D;
44
- uniforms: Record<string, {
45
- value: any;
46
- }> | null;
47
- };
37
+ define(_field: string, _spec?: import("../../../style").StyleWeatherParticles): never;
48
38
  /**
49
39
  * Automatic weather on/off
50
40
  * @param {boolean} on
@@ -1,7 +1,7 @@
1
1
  // Generated by npm run map, do not edit by hand. Source: packages/engine/render/PostFX.js (edit the JSDoc in the source, then run npm run map)
2
2
  export class PostFX {
3
3
  /**
4
- * MSAA on (read-only; switch with post.enable('antialias', on))
4
+ * MSAA on (read-only; switch with post.setAntialias(on))
5
5
  * @returns {boolean}
6
6
  */
7
7
  get antialias(): boolean;
@@ -11,40 +11,40 @@ export class PostFX {
11
11
  */
12
12
  get active(): boolean;
13
13
  /**
14
- * Add a named effect; returns its handle. Slot and order come from the effect unless given here.
15
- * @example
16
- * import { RenderPixelatedPass } from 'three/addons/postprocessing/RenderPixelatedPass.js';
17
- * const pixels = engine.post.add({ name: 'pixelate', slot: 'scene', params: { size: 4 },
18
- * create: ({ scene, camera, width, height, params }) => new RenderPixelatedPass(params.size, scene, camera),
19
- * update: (pass, p) => pass.setPixelSize(p.size) });
20
- * pixels.set({ size: 6 }); pixels.enable(false); pixels.remove();
21
- * @param {PostEffect} effect
22
- * @param {{ slot?: PostSlot, order?: number, enabled?: boolean }} [opts]
23
- * @returns {PostHandle}
14
+ * Renamed in 0.2: throws and names the new call (engine.look.post.patch / engine.look.post.replace, recipes/52-look.md)
15
+ * @param {PostEffect} _effect
16
+ * @param {{ slot?: PostSlot, order?: number, enabled?: boolean }} [_opts]
17
+ * @returns {never}
24
18
  * @experimental
25
19
  */
26
- add(effect: PostEffect, { slot, order, enabled }?: {
20
+ add(_effect: PostEffect, _opts?: {
27
21
  slot?: PostSlot;
28
22
  order?: number;
29
23
  enabled?: boolean;
30
- }): PostHandle;
24
+ }): never;
31
25
  /**
32
- * Handle of an added effect, or undefined: engine.post.get('bloom')?.set({ strength: 0.6 })
26
+ * Read-only record of an added effect (name, slot, order, enabled, params), or undefined. Change one with engine.look.post.set({ 'bloom.strength': 0.6 })
33
27
  * @param {string} name
34
28
  * @returns {PostHandle | undefined}
35
29
  * @experimental
36
30
  */
37
31
  get(name: string): PostHandle | undefined;
38
32
  /**
39
- * Turn an effect, or 'antialias' (MSAA), on or off; false (and a dev warning naming the effects) when no such effect is added
40
- * @example
41
- * engine.post.enable('bloom', false); engine.post.enable('antialias', true);
42
- * @param {string} name
33
+ * Renamed in 0.2: throws and names the new call (engine.look.post.set({ 'bloom.enabled': on }); MSAA: engine.post.setAntialias(on))
34
+ * @param {string} _name
35
+ * @param {boolean} _on
36
+ * @returns {never}
37
+ * @experimental
38
+ */
39
+ enable(_name: string, _on: boolean): never;
40
+ /**
41
+ * Turn MSAA (antialiasing of the post chain) on or off. It is a render target setting, not a look part.
42
+ * @example engine.post.setAntialias(false);
43
43
  * @param {boolean} on
44
- * @returns {boolean}
44
+ * @returns {void}
45
45
  * @experimental
46
46
  */
47
- enable(name: string, on: boolean): boolean;
47
+ setAntialias(on: boolean): void;
48
48
  /**
49
49
  * Effects in render order: [{ name, slot, order, enabled }]
50
50
  * @returns {{ name: string, slot: PostSlot, order: number, enabled: boolean }[]}
@@ -120,9 +120,6 @@ export type PostHandle = {
120
120
  readonly order: number;
121
121
  readonly enabled: boolean;
122
122
  readonly params: Record<string, any>;
123
- enable(on: boolean): void;
124
- set(params: Record<string, any>): void;
125
- remove(): void;
126
123
  };
127
124
  import type { Engine } from '../../core';
128
125
  import * as THREE from 'three';
@@ -25,6 +25,16 @@ export function makeMaterial(purpose?: string, params?: {
25
25
  }, engine?: {
26
26
  style: any;
27
27
  }): THREE.Material;
28
+ export function windCustom({ glsl, uniforms }: {
29
+ glsl: any;
30
+ uniforms: any;
31
+ }): {
32
+ uniforms: Record<string, {
33
+ value: any;
34
+ }>;
35
+ decl: string;
36
+ glsl: any;
37
+ };
28
38
  /**
29
39
  * Add effects to any material (built-in, from a style pack, or third-party); returns the same material. The one entry for shader effects:
30
40
  * wind (sway amplitude; the shadow sways too, nothing else to set up), clouds (drifting cloud shadows, default on; how dark is
@@ -67,6 +67,12 @@ export interface Collision {
67
67
  addCircle(position: PositionLike, opts?: CircleColliderOptions): Handle;
68
68
  /** Add a box collider (house, fence): position is the center, e.g. addBox(house, { halfWidth: 3, halfDepth: 2, rotation: 0.3 }). Returns a handle { remove() } */
69
69
  addBox(position: PositionLike, opts?: BoxColliderOptions): Handle;
70
+ /** Add a thin wall along a -> b (fence). Options: thickness (default 0.3), height, y. A gap between segments is a gate. Returns a handle { remove() } */
71
+ addSegment(a: PositionLike, b: PositionLike, opts?: { thickness?: number; height?: number; y?: number }): Handle;
72
+ /** Mark ground impassable where fn(x, z) is true (river, lava); fn must be pure. bounds skips fn outside it. Returns a handle { remove() } */
73
+ addBlocked(fn: (x: number, z: number) => boolean, opts?: { bounds?: { minX: number; maxX: number; minZ: number; maxZ: number } }): Handle;
74
+ /** Is a character of this radius touching addBlocked ground at (x, z) */
75
+ blockedAt(x: number, z: number, radius?: number): boolean;
70
76
  /** Add a collider from an object's bounding box, pad expands outward (meters). Returns a handle { remove() } */
71
77
  addObject(obj: Object3D, opts?: { pad?: number }): Handle;
72
78
  /** Iterate all static colliders added by hand */
@@ -75,6 +81,8 @@ export interface Collision {
75
81
  walkable(position: PositionLike, opts?: { radius?: number }): boolean;
76
82
  /** walkable with plain numbers, allocating nothing (A* inner loops); radius defaults to engine.movement.radius */
77
83
  walkableAt(x: number, z: number, radius?: number): boolean;
84
+ /** Line of sight with height: is the 3D segment a -> b free of boxes, circles and terrain trees? radius fattens the line; addBlocked water is ignored. Give eye heights in a / b */
85
+ lineClear(a: PositionLike, b: PositionLike, opts?: { radius?: number }): boolean;
78
86
  }
79
87
 
80
88
  // ======================================================================
package/types/style.d.ts CHANGED
@@ -3,11 +3,11 @@
3
3
  // files or generators (asset packs, engine.assets.manifest), gameplay data (content packs, engine.content.load), and anything that changes the world or
4
4
  // the rules: water level / sea / size go to water({ level, sea, size }), terrain shape and size to terrain({...}) (a dev error says so). Swapping the style must
5
5
  // never move the map. A style may be a list of parts (StyleInput).
6
- // Example: the optional @threedog/style-lowpoly package (packages/styles/lowpoly/index.js).
6
+ // Example: any style pack, a folder with index.js (yours, or a published one); see recipes/09-style-pack.md.
7
7
  import type { ColorLike, BufferGeometry, Object3D, Material, Loose } from './common';
8
8
  import type { Engine } from './core';
9
9
  import type { SteepRule, WeatherPreset, TerrainConfig, Sky } from './world';
10
- import type { ParticleOptions, CharacterRig } from './gameplay';
10
+ import type { ParticleOptions } from './gameplay';
11
11
  import type { ShaderPatch } from './generated/render/patches';
12
12
 
13
13
  /** Material finish: 'lambert' matte | 'phong' with highlights | 'standard' realistic | 'physical' | 'toon' cel-shaded steps | 'basic' unlit */
@@ -43,13 +43,13 @@ export interface MaterialSpec {
43
43
  }
44
44
 
45
45
  /**
46
- * The `detail` surface patch. Source: texture (asset name) or noise ('grain' | 'paper' | 'stroke', default grain) or glsl (your own sampler
46
+ * The `detail` surface patch. Source: texture (asset name) or noise ('grain' | 'paper' | 'stroke' | 'dabs', default grain) or glsl (your own sampler
47
47
  * function). Effects: color (strength, mode), normal (relief height in meters), roughness (amount). Every number is a uniform, so many materials
48
48
  * with different values share one shader program. Channels (color / normal / roughness) are fixed when the material is made.
49
49
  */
50
50
  export interface MaterialDetail {
51
51
  texture?: string | import('three').Texture;
52
- noise?: Loose<'grain' | 'paper' | 'stroke'>;
52
+ noise?: Loose<'grain' | 'paper' | 'stroke' | 'dabs'>;
53
53
  /** Replaces the noise: `vec4 threedogDetailSample(vec2 p)` returns vec4(color rgb, height 0-1); p is scaled, turned, stretched */
54
54
  glsl?: string;
55
55
  /** Uniforms for glsl: numbers, colors, [x, y(, z, w)] arrays or textures */
@@ -64,6 +64,8 @@ export interface MaterialDetail {
64
64
  mode?: Loose<'multiply' | 'add' | 'mix'>;
65
65
  /** Colors the sample (default white) */
66
66
  tint?: ColorLike;
67
+ /** Default true: the effect fades out where the pattern is smaller than about a pixel (far away, grazing angles), so it does not shimmer. `false` keeps it. In `glsl`, `threedogDetailFootprint` is one pixel in pattern units */
68
+ fade?: boolean;
67
69
  /** Degrees; turns the pattern (strokes run along it) */
68
70
  direction?: number;
69
71
  /** Stretches the pattern along direction (default 1, strokes 6) */
@@ -145,7 +147,7 @@ export interface StyleSky {
145
147
  skybox?: string;
146
148
  /** Shadows: mapSize resolution (pixels), extent coverage (meters), etc., see StyleShadow */
147
149
  shadow?: StyleShadow;
148
- /** Environment lighting (scene.environment), off unless a source is given; see Sky.setEnvironment. A pack can give defaults, sky({ environment }) overrides */
150
+ /** Environment lighting (scene.environment), off unless a source is given; see engine.look.env. A pack can give defaults, sky({ environment }) overrides */
149
151
  environment?: StyleEnvironment;
150
152
  /** Fog model and color (default: linear fog in the horizon color); see StyleFog */
151
153
  fog?: StyleFog;
@@ -165,6 +167,12 @@ export interface StyleFog {
165
167
  color?: 'horizon' | ColorLike | ((sky: any) => ColorLike);
166
168
  /** Per meter, exp / exp2 / height (default: derived from engine.fogFar, so fog reaches the same distance as linear); weather fog divides it */
167
169
  density?: number;
170
+ /** Linear fog start (meters); default 0.3 x far. Same keys as engine.look.fog.set */
171
+ near?: number;
172
+ /** Linear fog end (meters); default engine.fogFar */
173
+ far?: number;
174
+ /** false: no fog; default true */
175
+ enabled?: boolean;
168
176
  /** 'height': world y of the fog floor, default 0 */
169
177
  height?: number;
170
178
  /** 'height': how fast the fog thins above the floor, per meter, default 0.05 */
@@ -185,6 +193,8 @@ export interface StyleFog {
185
193
  * return vec4(uAurora, band * night); }` }]
186
194
  */
187
195
  export interface StyleSkyLayer {
196
+ /** The layer's name, the key for engine.look.sky.patch('layer:<name>'); default layer0, layer1 ... by position */
197
+ name?: string;
188
198
  /** Defines `vec4 threedogSkyLayer(vec3 dir, float time, vec3 sunDir, float night)` returning (rgb, amount 0..1); renamed per layer, so layers never clash */
189
199
  glsl: string;
190
200
  /** Custom uniforms (numbers, THREE.Color, [x, y(, z, w)], THREE.Texture), live in engine.sky.dome.material.uniforms */
@@ -271,10 +281,12 @@ export interface StyleWind {
271
281
  uniforms?: Record<string, number | number[] | object>;
272
282
  }
273
283
 
274
- /** engine.sky.shadow: the shadow params in use (Sky.setShadow changes them); field meanings as in StyleShadow */
284
+ /** engine.sky.shadow: the shadow params in use (engine.look.shadow.set changes them); field meanings as in StyleShadow */
275
285
  export interface SkyShadowParams {
276
286
  bias: number; normalBias: number; updateEvery: number; snap: number | 'texel'; ahead: number; type: 'basic' | 'pcf' | 'vsm'; radius: number; blurSamples: number;
277
287
  cascades: number; maxFar: number; fade: boolean; lightMargin: number; split: StyleShadow['split'];
288
+ /** Same keys as engine.look.shadow.set */
289
+ mapSize?: number; enabled?: boolean;
278
290
  }
279
291
 
280
292
  export interface StyleShadow {
@@ -343,7 +355,7 @@ export interface StyleWeather {
343
355
  types?: Record<string, Partial<WeatherPreset>>;
344
356
  }
345
357
 
346
- /** Falling weather particles: style.weather.rain / snow and engine.weather.define(field, spec). See recipes/44-water-weather-look-hooks.md */
358
+ /** Falling weather particles: style.weather.rain / snow and engine.look.weather.replace({ field: spec }). See recipes/44-water-weather-look-hooks.md */
347
359
  /** style.weather.snow: the snow particles' look plus the cover it leaves */
348
360
  export interface StyleWeatherSnow extends StyleWeatherParticles {
349
361
  /** Snow lying on foliage / ground while it snows (StyleSnowCover); leave out for particles only */
@@ -395,7 +407,7 @@ export interface StyleWeatherParticles {
395
407
  glsl?: { vertex?: string; fragment?: string };
396
408
  /** Uniforms for your glsl: numbers, colors, [x, y(, z, w)] arrays, textures; live in engine.weather.systems.get(field).uniforms */
397
409
  uniforms?: Record<string, any>;
398
- /** A system of your own instead (engine.weather.define only): the engine adds object, shows it while the amount is above 0.02, calls update */
410
+ /** A system of your own instead (engine.look.weather.replace only): the engine adds object, shows it while the amount is above 0.02, calls update */
399
411
  create?: (engine: Engine, ctx: { area: number; count: number }) => {
400
412
  object: Object3D; update?: (amount: number, ctx: { camera: any; time: number; wind: number }) => void };
401
413
  }
@@ -494,8 +506,12 @@ export interface StyleTerrain {
494
506
  config?: { shading?: Loose<'flat' | 'smooth' | 'texture'>; colorResolution?: number; normals?: Loose<'smooth' | 'flat'>; normalFn?: TerrainConfig['normalFn'] };
495
507
  /** Whole ground material: a Material or (engine) => Material (uv = world xz / chunk size; terrain({ material }) wins) */
496
508
  material?: Material | ((engine: Engine) => Material);
497
- /** Ground detail texture: texture asset name, scale repeats per meter, strength 0–1 */
498
- detail?: { texture: string; scale?: number; strength?: number };
509
+ /**
510
+ * Detail layer over the ground, the same object as a material spec's `detail`: a noise ('grain' | 'paper' | 'stroke' | 'dabs'), a texture
511
+ * asset name, or your own `glsl`; plus scale, strength, fade ... (top-down world projection by default). Live: look.ground.set({ detail }).
512
+ * See recipes/53-ground-up-close.md
513
+ */
514
+ detail?: MaterialDetail;
499
515
  }
500
516
 
501
517
  /** UI template function: (data, helpers) => HTML string */
@@ -547,12 +563,12 @@ export interface Style {
547
563
  /** Style pack name */
548
564
  name?: string;
549
565
  /**
550
- * Exposure, default 1 (lowpoly: 1.05): a number, or over the day [[time 0-1, exposure], ...] (sorted, wraps across midnight) or (sky) => number,
551
- * evaluated by the sky module every frame. engine.setExposure changes it at run time
566
+ * Exposure, default 1: a number, or over the day [[time 0-1, exposure], ...] (sorted, wraps across midnight) or (sky) => number,
567
+ * evaluated by the sky module every frame. engine.look.tone.set changes it at run time
552
568
  * @example exposure: [[0, 1.6], [0.3, 1], [0.75, 1.1]] // brighter nights
553
569
  */
554
570
  exposure?: number | number[][] | ((sky: any) => number);
555
- /** Tone mapping, default 'neutral' (lowpoly: 'aces') */
571
+ /** Tone mapping. Engine default 'none' (no style pack, no tone mapping); the style pack picks the look */
556
572
  toneMapping?: Loose<'aces' | 'agx' | 'neutral' | 'none'>;
557
573
  /** Background color (when there is no sky module) */
558
574
  background?: ColorLike;
@@ -580,11 +596,11 @@ export interface Style {
580
596
  * way to the color. Season names are the other keys, so none can be called mode or strength
581
597
  */
582
598
  seasons?: StyleSeasons;
583
- /** Cloud shadow: shadow darkest level 0–1 (default 0 = no cloud shadows; lowpoly 0.55), scale cloud size (smaller means bigger clouds), speed [x, z] */
599
+ /** Cloud shadow: shadow darkest level 0–1 (default 0 = no cloud shadows), scale cloud size (smaller means bigger clouds), speed [x, z] */
584
600
  clouds?: { shadow?: number; scale?: number; speed?: number[] };
585
601
  /**
586
- * Named colors the procedural model generators read (trees, rocks, grass: a generator written with `function` gets them as this.palette; lowpoly keys:
587
- * bark, pine, leaf, rock, grassTip...). One place to retint all of them, e.g. style: [lowpoly, { palette: { leaf: 0xd98a3a } }]; keys left out keep the pack's values
602
+ * Named colors the procedural model generators read (trees, rocks, grass: a generator written with `function` gets them as this.palette; a pack may use keys like
603
+ * bark, pine, leaf, rock, grassTip...). One place to retint all of them, e.g. style: [basePack, { palette: { leaf: 0xd98a3a } }]; keys left out keep the pack's values
588
604
  */
589
605
  palette?: Record<string, ColorLike>;
590
606
  /** Wind: frequency sway frequency multiplier */
@@ -603,11 +619,10 @@ export interface Style {
603
619
  */
604
620
  pickup?: { color?: ColorLike; size?: number; lift?: number; model?: (item: any, o: { color: ColorLike; size: number }, engine: Engine) => Object3D | BufferGeometry };
605
621
  /**
606
- * Default character: colors palette; create(engine, colors) returns the procedural character (without it a gray capsule); model names a registered
607
- * model asset every character uses unless it passes its own model (the procedural body shows until it loads); animation.fade skeletal animation
608
- * transition seconds
622
+ * How character motion looks: animation.fade skeletal animation transition seconds. Bodies are assets, not style ({ model: 'yourBody' } from
623
+ * an asset pack); a style tints body parts through materials roles (cloth, skin, trousers, hair). create / model / colors here throw renamed-api
609
624
  */
610
- character?: { model?: string; colors?: { body?: ColorLike; skin?: ColorLike; legs?: ColorLike; hair?: ColorLike }; create?: (engine: Engine, colors: Record<string, ColorLike>) => CharacterRig | null | undefined; animation?: { fade?: number } };
625
+ character?: { animation?: { fade?: number } };
611
626
  /** UI colors, fonts, templates */
612
627
  ui?: StyleUI;
613
628
  /** Particle presets: name → parameters; default is the fallback for all effects */