@holoscript/core 6.0.4 → 7.0.0

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 (236) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -1
  3. package/dist/compiler/index.d.ts +82 -0
  4. package/dist/constants.d.ts +3 -2
  5. package/dist/coordinators/index.d.ts +189 -0
  6. package/dist/index.d.ts +501 -19
  7. package/dist/paper-0c-spike/index.d.ts +29 -0
  8. package/dist/reconstruction/index.d.ts +78 -0
  9. package/dist/tools/index.d.ts +22 -1
  10. package/dist/traitDocs/traitDocs.d.ts +69 -0
  11. package/dist/traits/index.d.ts +61 -0
  12. package/package.json +105 -57
  13. package/dist/GLTFPipeline-DEN36VNK.js +0 -12
  14. package/dist/GLTFPipeline-YPCAK236.cjs +0 -33
  15. package/dist/HoloScriptPlusParser-BN6KVRCM.js +0 -692
  16. package/dist/HoloScriptPlusParser-NC5FE6AL.cjs +0 -697
  17. package/dist/USDZExporter-NTMBNTDB.js +0 -707
  18. package/dist/USDZExporter-UWGWNMMD.cjs +0 -709
  19. package/dist/chunk-27LWW5FU.cjs +0 -410
  20. package/dist/chunk-2CWOLHTE.js +0 -69
  21. package/dist/chunk-33LSUQDD.cjs +0 -835
  22. package/dist/chunk-3FJCK5XA.js +0 -2232
  23. package/dist/chunk-3FXV5S25.cjs +0 -633
  24. package/dist/chunk-3FYZOR7S.cjs +0 -69
  25. package/dist/chunk-3SAK5KFL.cjs +0 -83
  26. package/dist/chunk-4XSNJCLC.cjs +0 -1859
  27. package/dist/chunk-54FHG2MX.js +0 -655
  28. package/dist/chunk-56IF4NTA.js +0 -56
  29. package/dist/chunk-5BGSECRJ.cjs +0 -2237
  30. package/dist/chunk-5GLCTO44.js +0 -161
  31. package/dist/chunk-5O6TQC6M.cjs +0 -1871
  32. package/dist/chunk-5OEOHAAW.cjs +0 -682
  33. package/dist/chunk-5TOFIR6L.js +0 -407
  34. package/dist/chunk-5WUNN6ZN.cjs +0 -428
  35. package/dist/chunk-6TZPZCOJ.cjs +0 -1404
  36. package/dist/chunk-6UEHYZ7V.cjs +0 -773
  37. package/dist/chunk-6XSERL6L.js +0 -5678
  38. package/dist/chunk-72EQECGT.cjs +0 -908
  39. package/dist/chunk-7AGYRWKW.cjs +0 -507
  40. package/dist/chunk-7LCYLPW2.cjs +0 -663
  41. package/dist/chunk-A7PIMZGU.js +0 -263
  42. package/dist/chunk-ATSKSYVE.cjs +0 -51683
  43. package/dist/chunk-B5TCIAPQ.cjs +0 -117
  44. package/dist/chunk-BF2235SI.cjs +0 -5714
  45. package/dist/chunk-BKIGPPVM.js +0 -629
  46. package/dist/chunk-BND3ST2K.cjs +0 -662
  47. package/dist/chunk-BU7VWW2K.js +0 -2522
  48. package/dist/chunk-BWFJEM5A.js +0 -5419
  49. package/dist/chunk-CAUCGUEA.cjs +0 -130
  50. package/dist/chunk-CBJSLA2E.cjs +0 -5423
  51. package/dist/chunk-CDPGV4DN.js +0 -114
  52. package/dist/chunk-CLYEIWA5.cjs +0 -408
  53. package/dist/chunk-CS2EMTGF.js +0 -1966
  54. package/dist/chunk-DMG7C4H2.js +0 -975
  55. package/dist/chunk-DXJQDCFL.js +0 -468
  56. package/dist/chunk-E3FWRT3Z.js +0 -608
  57. package/dist/chunk-E3UALNFA.js +0 -421
  58. package/dist/chunk-EONILVMF.js +0 -762
  59. package/dist/chunk-EQV4R3EV.cjs +0 -769
  60. package/dist/chunk-F3HH56EB.cjs +0 -5538
  61. package/dist/chunk-F4IULT7N.js +0 -1488
  62. package/dist/chunk-FF3Q7ADR.js +0 -380
  63. package/dist/chunk-FFKU7BTK.cjs +0 -1046
  64. package/dist/chunk-FHQVYCH2.js +0 -70
  65. package/dist/chunk-FSF7EQVA.cjs +0 -1974
  66. package/dist/chunk-G4VZTCIB.js +0 -659
  67. package/dist/chunk-G7CT3EMP.cjs +0 -1002
  68. package/dist/chunk-GGHSW2NN.js +0 -51334
  69. package/dist/chunk-GVUR45UF.cjs +0 -777
  70. package/dist/chunk-H5Z7NASB.js +0 -9662
  71. package/dist/chunk-HE7ULERA.cjs +0 -697
  72. package/dist/chunk-HJJLD366.js +0 -1169
  73. package/dist/chunk-HPS76H7Q.js +0 -309
  74. package/dist/chunk-HQUEA5R6.cjs +0 -424
  75. package/dist/chunk-HYNTS5CP.js +0 -422
  76. package/dist/chunk-I6XZ5DZF.cjs +0 -488
  77. package/dist/chunk-IBDG74G2.cjs +0 -1219
  78. package/dist/chunk-IFNQFCTM.js +0 -3098
  79. package/dist/chunk-IHOUYQIA.js +0 -406
  80. package/dist/chunk-ILRBGFVD.cjs +0 -72
  81. package/dist/chunk-IWI6J7FX.js +0 -421
  82. package/dist/chunk-K3JDKWGI.cjs +0 -270
  83. package/dist/chunk-K6EKD26I.js +0 -630
  84. package/dist/chunk-KCQ5NDYC.cjs +0 -3172
  85. package/dist/chunk-KED34ILP.js +0 -832
  86. package/dist/chunk-KSGXLT74.cjs +0 -457
  87. package/dist/chunk-L4G4RLXX.js +0 -767
  88. package/dist/chunk-LDP5OK6G.js +0 -1216
  89. package/dist/chunk-LGGRPKTV.cjs +0 -735
  90. package/dist/chunk-LK5IAVH6.cjs +0 -1173
  91. package/dist/chunk-LSW7P7ML.js +0 -3675
  92. package/dist/chunk-LXJ4667L.cjs +0 -3874
  93. package/dist/chunk-LZ266PCM.cjs +0 -4499
  94. package/dist/chunk-MD6KDHVE.cjs +0 -237
  95. package/dist/chunk-MEASWI2Y.js +0 -126
  96. package/dist/chunk-MPXBVFHQ.js +0 -768
  97. package/dist/chunk-N5FTS757.cjs +0 -415
  98. package/dist/chunk-NCUKG4SK.cjs +0 -3075
  99. package/dist/chunk-NDQNIJEH.js +0 -1715
  100. package/dist/chunk-NOZZ46QU.js +0 -168
  101. package/dist/chunk-OFKWH2IP.js +0 -449
  102. package/dist/chunk-PHENW4MQ.js +0 -65
  103. package/dist/chunk-PMGODDJA.cjs +0 -319
  104. package/dist/chunk-Q4QX3AET.cjs +0 -1505
  105. package/dist/chunk-Q56TT7IL.js +0 -483
  106. package/dist/chunk-Q5JT3YML.cjs +0 -129
  107. package/dist/chunk-Q5SJOGHQ.cjs +0 -4256
  108. package/dist/chunk-QGKNANZ3.js +0 -3071
  109. package/dist/chunk-QLEAOI3Q.cjs +0 -424
  110. package/dist/chunk-R7MA7QWV.js +0 -732
  111. package/dist/chunk-RVYPEYPX.js +0 -678
  112. package/dist/chunk-S2N5TNMA.js +0 -1855
  113. package/dist/chunk-S565K7NK.js +0 -752
  114. package/dist/chunk-SDAMZIRE.js +0 -765
  115. package/dist/chunk-T36DDXSF.js +0 -4250
  116. package/dist/chunk-T4NKMBDL.js +0 -5474
  117. package/dist/chunk-T7LEXZUZ.cjs +0 -2526
  118. package/dist/chunk-TEWCN33Y.js +0 -694
  119. package/dist/chunk-TQSZUOW5.cjs +0 -793
  120. package/dist/chunk-TSH3MSQU.cjs +0 -129
  121. package/dist/chunk-UERJ3YJV.js +0 -504
  122. package/dist/chunk-UPJBDCVF.js +0 -1395
  123. package/dist/chunk-V3NN3HPP.js +0 -4462
  124. package/dist/chunk-VJ3L7CHT.cjs +0 -169
  125. package/dist/chunk-WB4Z63GG.js +0 -229
  126. package/dist/chunk-WDW67DZB.cjs +0 -9728
  127. package/dist/chunk-WGMEAYBG.js +0 -126
  128. package/dist/chunk-X4ZF6CNE.cjs +0 -473
  129. package/dist/chunk-X6SEAXAX.cjs +0 -3681
  130. package/dist/chunk-XCWFGZAA.js +0 -1043
  131. package/dist/chunk-XD6IYDUX.js +0 -903
  132. package/dist/chunk-XG23EUQX.cjs +0 -1717
  133. package/dist/chunk-XRKWN5PL.cjs +0 -173
  134. package/dist/chunk-XUILI4KB.cjs +0 -430
  135. package/dist/chunk-XUTX5CBW.js +0 -126
  136. package/dist/chunk-XWPNTWDN.cjs +0 -755
  137. package/dist/chunk-XXINBTZK.cjs +0 -633
  138. package/dist/chunk-YCXFCXDS.js +0 -1868
  139. package/dist/chunk-YQK5JNFK.js +0 -3725
  140. package/dist/chunk-YYXH45E2.js +0 -426
  141. package/dist/chunk-Z34RLXRA.cjs +0 -612
  142. package/dist/chunk-ZP4D3CSX.cjs +0 -72
  143. package/dist/cli/holoscript-runner.cjs +0 -2259
  144. package/dist/cli/holoscript-runner.js +0 -2234
  145. package/dist/codebase/index.cjs +0 -336
  146. package/dist/codebase/index.js +0 -331
  147. package/dist/compiler/agent-inference.cjs +0 -28
  148. package/dist/compiler/agent-inference.js +0 -5
  149. package/dist/compiler/android-xr.cjs +0 -19
  150. package/dist/compiler/android-xr.js +0 -9
  151. package/dist/compiler/android.cjs +0 -20
  152. package/dist/compiler/android.js +0 -10
  153. package/dist/compiler/ar.cjs +0 -20
  154. package/dist/compiler/ar.js +0 -8
  155. package/dist/compiler/babylon.cjs +0 -17
  156. package/dist/compiler/babylon.js +0 -11
  157. package/dist/compiler/coco.cjs +0 -27
  158. package/dist/compiler/coco.js +0 -4
  159. package/dist/compiler/domain-block-utils.cjs +0 -602
  160. package/dist/compiler/domain-block-utils.js +0 -8
  161. package/dist/compiler/dtdl.cjs +0 -24
  162. package/dist/compiler/dtdl.js +0 -8
  163. package/dist/compiler/gltf-pipeline.cjs +0 -39
  164. package/dist/compiler/gltf-pipeline.js +0 -4
  165. package/dist/compiler/godot.cjs +0 -15
  166. package/dist/compiler/godot.js +0 -9
  167. package/dist/compiler/incremental.cjs +0 -29
  168. package/dist/compiler/incremental.js +0 -4
  169. package/dist/compiler/index.cjs +0 -2578
  170. package/dist/compiler/index.js +0 -2383
  171. package/dist/compiler/ios.cjs +0 -20
  172. package/dist/compiler/ios.js +0 -10
  173. package/dist/compiler/multi-layer.cjs +0 -20
  174. package/dist/compiler/multi-layer.js +0 -11
  175. package/dist/compiler/nodetoy.cjs +0 -23
  176. package/dist/compiler/nodetoy.js +0 -4
  177. package/dist/compiler/openxr.cjs +0 -15
  178. package/dist/compiler/openxr.js +0 -9
  179. package/dist/compiler/playcanvas.cjs +0 -16
  180. package/dist/compiler/playcanvas.js +0 -10
  181. package/dist/compiler/r3f.cjs +0 -34
  182. package/dist/compiler/r3f.js +0 -12
  183. package/dist/compiler/remotion.cjs +0 -23
  184. package/dist/compiler/remotion.js +0 -4
  185. package/dist/compiler/reproducibility.cjs +0 -39
  186. package/dist/compiler/reproducibility.js +0 -4
  187. package/dist/compiler/sdf.cjs +0 -21
  188. package/dist/compiler/sdf.js +0 -9
  189. package/dist/compiler/semantic-scene.cjs +0 -31
  190. package/dist/compiler/semantic-scene.js +0 -4
  191. package/dist/compiler/state.cjs +0 -17
  192. package/dist/compiler/state.js +0 -7
  193. package/dist/compiler/trait-composition.cjs +0 -26
  194. package/dist/compiler/trait-composition.js +0 -5
  195. package/dist/compiler/unity.cjs +0 -15
  196. package/dist/compiler/unity.js +0 -9
  197. package/dist/compiler/unreal.cjs +0 -19
  198. package/dist/compiler/unreal.js +0 -9
  199. package/dist/compiler/urdf.cjs +0 -45
  200. package/dist/compiler/urdf.js +0 -9
  201. package/dist/compiler/usd-physics.cjs +0 -23
  202. package/dist/compiler/usd-physics.js +0 -6
  203. package/dist/compiler/visionos.cjs +0 -15
  204. package/dist/compiler/visionos.js +0 -9
  205. package/dist/compiler/vrchat.cjs +0 -19
  206. package/dist/compiler/vrchat.js +0 -9
  207. package/dist/compiler/vrr.cjs +0 -21
  208. package/dist/compiler/vrr.js +0 -9
  209. package/dist/compiler/wasm.cjs +0 -33
  210. package/dist/compiler/wasm.js +0 -9
  211. package/dist/compiler/webgpu.cjs +0 -15
  212. package/dist/compiler/webgpu.js +0 -9
  213. package/dist/debugger.cjs +0 -21
  214. package/dist/debugger.js +0 -8
  215. package/dist/entries/interop.cjs +0 -62
  216. package/dist/entries/interop.js +0 -5
  217. package/dist/entries/scripting.cjs +0 -68
  218. package/dist/entries/scripting.js +0 -11
  219. package/dist/index.cjs +0 -40921
  220. package/dist/index.js +0 -37763
  221. package/dist/math/vec3.cjs +0 -57
  222. package/dist/math/vec3.js +0 -4
  223. package/dist/ml-dsa-PHCWUBPX.cjs +0 -1178
  224. package/dist/ml-dsa-WYLJHJO6.js +0 -1178
  225. package/dist/parser.cjs +0 -27
  226. package/dist/parser.js +0 -10
  227. package/dist/playwright-5OSAPTNH.js +0 -98660
  228. package/dist/playwright-RL6GY4F7.cjs +0 -98673
  229. package/dist/runtime.cjs +0 -16
  230. package/dist/runtime.js +0 -7
  231. package/dist/storage/index.cjs +0 -37
  232. package/dist/storage/index.js +0 -4
  233. package/dist/traits/index.cjs +0 -14649
  234. package/dist/traits/index.js +0 -12243
  235. package/dist/type-checker.cjs +0 -18
  236. package/dist/type-checker.js +0 -5
@@ -1,126 +0,0 @@
1
- import { logger } from './chunk-PHENW4MQ.js';
2
- import { calculatePosition } from '@holoscript/engine/orbital';
3
-
4
- // src/traits/MitosisTrait.ts
5
- var mitosisHandler = {
6
- name: "mitosis",
7
- defaultConfig: {
8
- strategy: "collaborative",
9
- max_children: 5,
10
- auto_cleanup: true
11
- },
12
- onAttach(node, config, context) {
13
- const state = {
14
- parent_id: ("parent_id" in config ? config.parent_id : null) || null,
15
- active_children: [],
16
- tasks_delegated: 0,
17
- completed_tasks: 0,
18
- last_sync_time: Date.now()
19
- };
20
- node.__mitosisState = state;
21
- context.emit?.("mitosis_init", {
22
- nodeId: node.id,
23
- strategy: config.strategy,
24
- parent_id: state.parent_id
25
- });
26
- },
27
- onDetach(node, config, context) {
28
- const state = node.__mitosisState;
29
- if (state && config.auto_cleanup) {
30
- for (const childId of state.active_children) {
31
- context.emit?.("mitosis_despawn_child", { childId });
32
- }
33
- }
34
- delete node.__mitosisState;
35
- },
36
- onEvent(node, config, context, event) {
37
- const state = node.__mitosisState;
38
- if (!state) return;
39
- if (event.type === "mitosis_spawned") {
40
- const childId = event.childId;
41
- const parentId = event.parentId;
42
- if (node.id === parentId) {
43
- state.active_children.push(childId);
44
- state.tasks_delegated++;
45
- context.emit?.("on_mitosis_spawned", { childId, parentId: node.id });
46
- }
47
- } else if (event.type === "mitosis_child_complete") {
48
- const childId = "childId" in event ? event.childId : "";
49
- const parentId = "parentId" in event ? event.parentId : "";
50
- const result = "result" in event ? event.result : void 0;
51
- if (node.id === parentId) {
52
- state.completed_tasks++;
53
- state.last_sync_time = Date.now();
54
- context.emit?.("mitosis_synced", {
55
- parentId: node.id,
56
- childId,
57
- result
58
- });
59
- if (config.strategy === "collaborative") {
60
- if (result && typeof result === "object") {
61
- Object.assign(node.properties || {}, result);
62
- }
63
- }
64
- }
65
- } else if (event.type === "mitosis_child_failed") {
66
- context.emit?.("on_mitosis_error", {
67
- parentId: node.id,
68
- childId: event.childId,
69
- error: event.error
70
- });
71
- }
72
- }
73
- };
74
- var orbitalHandler = {
75
- name: "orbital",
76
- defaultConfig: {},
77
- /**
78
- * Called when trait is attached to a node
79
- */
80
- onAttach(node, _config, _context) {
81
- logger.info(`[OrbitalTrait] Attached to ${node.name}`);
82
- },
83
- /**
84
- * Called every frame to update orbital position
85
- */
86
- onUpdate(node, config, context, _delta) {
87
- const properties = node.properties || {};
88
- const mergedConfig = { ...properties, ...config };
89
- if (!mergedConfig || !mergedConfig.semiMajorAxis) {
90
- return;
91
- }
92
- const julianDate = context.julianDate || 0;
93
- const visualScale = context.getScaleMultiplier() * 50;
94
- const satelliteScale = 5;
95
- const rawPosition = calculatePosition(mergedConfig, julianDate);
96
- const currentScale = mergedConfig.parent ? visualScale * satelliteScale : visualScale;
97
- let finalPosition = {
98
- x: rawPosition.x * currentScale,
99
- y: rawPosition.z * currentScale,
100
- z: rawPosition.y * currentScale
101
- };
102
- if (mergedConfig.parent) {
103
- let parentNode = context.getNode?.(mergedConfig.parent);
104
- if (!parentNode && typeof mergedConfig.parent === "object" && mergedConfig.parent && mergedConfig.parent.position) {
105
- parentNode = mergedConfig.parent;
106
- }
107
- if (parentNode && parentNode.position) {
108
- finalPosition = {
109
- x: finalPosition.x + (parentNode.position.x || 0),
110
- y: finalPosition.y + (parentNode.position.y || 0),
111
- z: finalPosition.z + (parentNode.position.z || 0)
112
- };
113
- } else {
114
- if (typeof mergedConfig.parent === "string") {
115
- logger.warn(`[OrbitalTrait] Parent "${mergedConfig.parent}" not found for ${node.name}`);
116
- }
117
- }
118
- }
119
- node.position = finalPosition;
120
- context.emit("position_update", { position: finalPosition });
121
- }
122
- };
123
-
124
- export { mitosisHandler, orbitalHandler };
125
- //# sourceMappingURL=chunk-WGMEAYBG.js.map
126
- //# sourceMappingURL=chunk-WGMEAYBG.js.map
@@ -1,473 +0,0 @@
1
- 'use strict';
2
-
3
- var chunk3SAK5KFL_cjs = require('./chunk-3SAK5KFL.cjs');
4
-
5
- // src/traits/visual/types.ts
6
- exports.VISUAL_LAYER_PRIORITY = void 0;
7
- var init_types = chunk3SAK5KFL_cjs.__esm({
8
- "src/traits/visual/types.ts"() {
9
- exports.VISUAL_LAYER_PRIORITY = {
10
- base_material: 0,
11
- surface: 1,
12
- condition: 2,
13
- physical: 3,
14
- scale: 4,
15
- lighting: 5,
16
- visual_effect: 6,
17
- environmental: 7,
18
- mood: 8
19
- };
20
- }
21
- });
22
-
23
- // src/traits/visual/TraitVisualRegistry.ts
24
- exports.TraitVisualRegistry = void 0;
25
- var init_TraitVisualRegistry = chunk3SAK5KFL_cjs.__esm({
26
- "src/traits/visual/TraitVisualRegistry.ts"() {
27
- exports.TraitVisualRegistry = class _TraitVisualRegistry {
28
- constructor() {
29
- this.configs = /* @__PURE__ */ new Map();
30
- }
31
- /** Get the singleton instance. */
32
- static getInstance() {
33
- if (!_TraitVisualRegistry.instance) {
34
- _TraitVisualRegistry.instance = new _TraitVisualRegistry();
35
- }
36
- return _TraitVisualRegistry.instance;
37
- }
38
- /** Register a single trait's visual configuration. */
39
- register(traitName, config) {
40
- this.configs.set(traitName, config);
41
- }
42
- /** Register multiple trait visual configs at once. */
43
- registerBatch(entries) {
44
- for (const [name, config] of Object.entries(entries)) {
45
- this.configs.set(name, config);
46
- }
47
- }
48
- /** Look up a trait's visual config. Returns undefined if not registered. */
49
- get(traitName) {
50
- return this.configs.get(traitName);
51
- }
52
- /** Check if a trait has a registered visual config. */
53
- has(traitName) {
54
- return this.configs.has(traitName);
55
- }
56
- /** Get all registered configs (read-only). */
57
- getAll() {
58
- return this.configs;
59
- }
60
- /** Number of registered trait visuals. */
61
- get size() {
62
- return this.configs.size;
63
- }
64
- /** Reset the registry (primarily for testing). */
65
- reset() {
66
- this.configs.clear();
67
- }
68
- };
69
- }
70
- });
71
-
72
- // src/traits/visual/composition-rules.ts
73
- exports.COMPOSITION_RULES = void 0;
74
- var init_composition_rules = chunk3SAK5KFL_cjs.__esm({
75
- "src/traits/visual/composition-rules.ts"() {
76
- exports.COMPOSITION_RULES = [
77
- // ══════════════════════════════════════════════════════════════════
78
- // REQUIREMENT RULES — trait only applies if another trait provides
79
- // the required tag (a trait cannot self-satisfy its own requirement)
80
- // ══════════════════════════════════════════════════════════════════
81
- // Corrosion traits only apply to objects with a metallic base
82
- { trait: "rusted", requires: { tags: ["metallic"] } },
83
- { trait: "tarnished", requires: { tags: ["metallic"] } },
84
- { trait: "corroded", requires: { tags: ["metallic"] } },
85
- // Metal finishing requires a metallic base
86
- { trait: "brushed", requires: { tags: ["metallic"] } },
87
- { trait: "hammered", requires: { tags: ["metallic"] } },
88
- // Organic overgrowth requires an organic or mineral base
89
- { trait: "moss_covered", requires: { tags: ["organic", "mineral", "stone"] } },
90
- { trait: "vine_covered", requires: { tags: ["organic", "mineral", "stone"] } },
91
- // Biological processes require organic base
92
- { trait: "decayed", requires: { tags: ["organic"] } },
93
- { trait: "fossilized", requires: { tags: ["organic"] } },
94
- { trait: "witherable", requires: { tags: ["organic"] } },
95
- { trait: "bloomable", requires: { tags: ["organic"] } },
96
- // ══════════════════════════════════════════════════════════════════
97
- // SUPPRESSION RULES — trait removes listed traits from consideration
98
- // ══════════════════════════════════════════════════════════════════
99
- // Pristine/brand_new suppress all damage/wear states
100
- {
101
- trait: "pristine",
102
- suppresses: [
103
- "rusted",
104
- "worn",
105
- "weathered",
106
- "decayed",
107
- "tarnished",
108
- "corroded",
109
- "crumbling",
110
- "faded",
111
- "stained",
112
- "scratched",
113
- "dented",
114
- "chipped",
115
- "cracked",
116
- "shattered",
117
- "battle_scarred",
118
- "charred",
119
- "tattered",
120
- "dust_covered",
121
- "moss_covered",
122
- "vine_covered"
123
- ]
124
- },
125
- {
126
- trait: "brand_new",
127
- suppresses: [
128
- "rusted",
129
- "worn",
130
- "weathered",
131
- "decayed",
132
- "tarnished",
133
- "corroded",
134
- "faded",
135
- "stained",
136
- "scratched",
137
- "dented",
138
- "chipped",
139
- "antique",
140
- "dust_covered"
141
- ]
142
- },
143
- // Restored suppresses active decay (but not cosmetic scars)
144
- {
145
- trait: "restored",
146
- suppresses: ["decayed", "crumbling", "corroded", "rusted"]
147
- },
148
- // Mirrored overrides surface textures
149
- {
150
- trait: "mirrored",
151
- suppresses: ["matte_surface", "frosted_surface", "brushed"]
152
- },
153
- // Temperature conflicts — fire and ice cancel each other
154
- {
155
- trait: "frozen_liquid",
156
- suppresses: ["fiery", "elemental_fire", "volcanic_eruption", "boiling", "charred"]
157
- },
158
- {
159
- trait: "elemental_fire",
160
- suppresses: ["frozen_liquid", "elemental_ice", "frosted_surface"]
161
- },
162
- // Visibility — invisible/cloaking suppress visual effects
163
- {
164
- trait: "invisible",
165
- suppresses: ["glowing", "neon_glow", "luminous", "bioluminescent", "holographic", "outlined"]
166
- },
167
- {
168
- trait: "cloaking",
169
- suppresses: ["glowing", "neon_glow", "holographic", "outlined"]
170
- },
171
- // Petrification/fossilization suppress living traits
172
- {
173
- trait: "petrified",
174
- suppresses: ["growable", "bloomable", "photosynthetic", "witherable"]
175
- },
176
- {
177
- trait: "fossilized",
178
- suppresses: ["growable", "bloomable", "bioluminescent", "photosynthetic"]
179
- },
180
- // Crystallization suppresses soft surface textures
181
- {
182
- trait: "crystallized",
183
- suppresses: ["furry", "velvety", "woolly", "silky"]
184
- },
185
- // Magic conflicts — blessed and cursed cancel each other
186
- { trait: "cursed", suppresses: ["blessed"] },
187
- { trait: "blessed", suppresses: ["cursed"] },
188
- // Environmental conflicts
189
- {
190
- trait: "drought",
191
- suppresses: ["leaking", "overflowing", "moss_covered"]
192
- },
193
- {
194
- trait: "flood",
195
- suppresses: ["drought", "dust_covered", "sandstorm"]
196
- },
197
- {
198
- trait: "underwater",
199
- suppresses: ["fiery", "elemental_fire"]
200
- },
201
- // ══════════════════════════════════════════════════════════════════
202
- // ADDITIVE RULES — extra properties blended on top
203
- // ══════════════════════════════════════════════════════════════════
204
- // Frozen adds blue tint
205
- { trait: "frozen_liquid", additive: { color: "#D6EAF8" } },
206
- // Enchanted adds a subtle purple shimmer
207
- { trait: "enchanted", additive: { emissive: "#9966FF", emissiveIntensity: 0.3 } },
208
- // Ghostly adds transparency
209
- { trait: "ghostly", additive: { opacity: 0.3, transparent: true } },
210
- // Electric adds blue-white emissive
211
- { trait: "electric_arc", additive: { emissive: "#00BFFF", emissiveIntensity: 0.5 } },
212
- // Bioluminescence adds green glow
213
- { trait: "bioluminescent", additive: { emissive: "#00FFAA", emissiveIntensity: 0.4 } },
214
- // Iridescent/pearlescent add color-shift sheen
215
- { trait: "iridescent", additive: { iridescence: 0.5 } },
216
- { trait: "pearlescent", additive: { iridescence: 0.8 } },
217
- // ══════════════════════════════════════════════════════════════════
218
- // MULTI-TRAIT MERGE RULES — when all listed traits are present,
219
- // override merged material with these values (applied last)
220
- // ══════════════════════════════════════════════════════════════════
221
- // ── Metal synergies ─────────────────────────────────────────────
222
- // Iron + rusted = corroded bronze appearance
223
- {
224
- traits: ["rusted", "iron_material"],
225
- merge: { color: "#6B3A1F", roughness: 0.9, metalness: 0.5 }
226
- },
227
- // Copper + rusted = verdigris patina
228
- {
229
- traits: ["rusted", "copper_material"],
230
- merge: { color: "#5C8A7A", roughness: 0.7, metalness: 0.6 }
231
- },
232
- // Gold + polished = high-shine gold
233
- {
234
- traits: ["gold_material", "polished"],
235
- merge: { roughness: 0.05, envMapIntensity: 2 }
236
- },
237
- // ── Elemental synergies ─────────────────────────────────────────
238
- // Water + frozen = deep ice
239
- {
240
- traits: ["elemental_water", "frozen_liquid"],
241
- merge: { color: "#B0D4E8", transmission: 0.85, roughness: 0.05 }
242
- },
243
- // Fire + angry = rage inferno
244
- {
245
- traits: ["elemental_fire", "angry"],
246
- merge: { emissive: "#FF1100", emissiveIntensity: 3.5 }
247
- },
248
- // Lightning + thunderstorm = storm energy
249
- {
250
- traits: ["elemental_lightning", "thunderstorm"],
251
- merge: { emissive: "#FFFFFF", emissiveIntensity: 4.5 }
252
- },
253
- // Earth + ancient = primordial stone
254
- {
255
- traits: ["elemental_earth", "ancient"],
256
- merge: { roughness: 1, color: "#5A4A3A" }
257
- },
258
- // ── Magic synergies ─────────────────────────────────────────────
259
- // Enchanted + ancient = magical artifact
260
- {
261
- traits: ["enchanted", "ancient"],
262
- merge: { emissive: "#9966FF", emissiveIntensity: 0.5, color: "#8B6914" }
263
- },
264
- // Blessed + gold = holy golden artifact
265
- {
266
- traits: ["blessed", "gold_material"],
267
- merge: { emissive: "#FFFACD", emissiveIntensity: 0.8, envMapIntensity: 2 }
268
- },
269
- // Enchanted + diamond = spellbound gem
270
- {
271
- traits: ["enchanted", "diamond_gem"],
272
- merge: { emissive: "#CC88FF", emissiveIntensity: 0.6, iridescence: 1 }
273
- },
274
- // Crystal + enchanted = magical crystal
275
- {
276
- traits: ["crystal_gem", "enchanted"],
277
- merge: { emissive: "#CC88FF", emissiveIntensity: 1, iridescence: 1 }
278
- },
279
- // Cursed + blood stained = profane artifact
280
- {
281
- traits: ["cursed", "blood_stained"],
282
- merge: { emissive: "#660000", emissiveIntensity: 0.8, color: "#4A0000" }
283
- },
284
- // ── Age + condition synergies ───────────────────────────────────
285
- // Ancient + weathered = time-worn relic
286
- {
287
- traits: ["ancient", "weathered"],
288
- merge: { roughness: 0.95, color: "#6B5A4A" }
289
- },
290
- // Ancient + moss = ancient overgrown ruins
291
- {
292
- traits: ["ancient", "moss_covered"],
293
- merge: { roughness: 0.95, color: "#3A6A2F" }
294
- },
295
- // Pristine + crystal = flawless crystal
296
- {
297
- traits: ["pristine", "crystal_gem"],
298
- merge: { roughness: 0, transmission: 0.98, envMapIntensity: 2.5 }
299
- },
300
- // ── Nature synergies ────────────────────────────────────────────
301
- // Bioluminescent + aquatic = glowing sea creature
302
- {
303
- traits: ["bioluminescent", "aquatic"],
304
- merge: { emissive: "#00CCAA", emissiveIntensity: 1.2 }
305
- },
306
- // Venomous + glowing = toxic glow
307
- {
308
- traits: ["venomous", "glowing"],
309
- merge: { emissive: "#00FF00", emissiveIntensity: 0.8, color: "#3A5A1A" }
310
- },
311
- // Wildfire + wooden = burning wood
312
- {
313
- traits: ["wildfire", "wooden"],
314
- merge: { emissive: "#FF4500", emissiveIntensity: 2.5, roughness: 0.9 }
315
- },
316
- // ── Visual effect synergies ─────────────────────────────────────
317
- // Emissive + angry mood = intense red emissive
318
- {
319
- traits: ["emissive", "angry"],
320
- merge: { emissive: "#FF2200", emissiveIntensity: 2.5 }
321
- },
322
- // Holographic + ghostly = spectral hologram
323
- {
324
- traits: ["holographic", "ghostly"],
325
- merge: { opacity: 0.2, emissive: "#88BBFF", emissiveIntensity: 1.5 }
326
- },
327
- // Holographic + neon = vibrant holographic display
328
- {
329
- traits: ["holographic", "neon_glow"],
330
- merge: { emissive: "#00FFFF", emissiveIntensity: 2, opacity: 0.5 }
331
- },
332
- // Frozen + crystalline = ice crystal formation
333
- {
334
- traits: ["frozen_liquid", "crystalline"],
335
- merge: { transmission: 0.9, ior: 1.31, iridescence: 0.7 }
336
- },
337
- // Eerie + ghostly = spectral haunting
338
- {
339
- traits: ["eerie", "ghostly"],
340
- merge: { emissive: "#6633AA", emissiveIntensity: 0.5, opacity: 0.25 }
341
- },
342
- // ── Sci-fi synergies ────────────────────────────────────────────
343
- // Plasma + force field = plasma barrier
344
- {
345
- traits: ["plasma", "force_field"],
346
- merge: { emissive: "#FF00FF", emissiveIntensity: 2.5, opacity: 0.4 }
347
- }
348
- ];
349
- }
350
- });
351
-
352
- // src/traits/visual/TraitCompositor.ts
353
- exports.TraitCompositor = void 0;
354
- var init_TraitCompositor = chunk3SAK5KFL_cjs.__esm({
355
- "src/traits/visual/TraitCompositor.ts"() {
356
- init_types();
357
- init_TraitVisualRegistry();
358
- init_composition_rules();
359
- exports.TraitCompositor = class {
360
- constructor(registry, rules) {
361
- this.registry = registry ?? exports.TraitVisualRegistry.getInstance();
362
- this.rules = rules ?? exports.COMPOSITION_RULES;
363
- }
364
- /**
365
- * Compose multiple trait visuals into a single material config.
366
- * Returns only the properties that were explicitly set by at least one trait.
367
- */
368
- compose(traitNames) {
369
- const entries = [];
370
- for (const name of traitNames) {
371
- const config = this.registry.get(name);
372
- if (!config) continue;
373
- const layer = config.layer ?? "visual_effect";
374
- const priority = exports.VISUAL_LAYER_PRIORITY[layer];
375
- entries.push({ name, config, priority });
376
- }
377
- const suppressedTraits = this.getSuppressedTraits(traitNames);
378
- const activeEntries = entries.filter((e) => !suppressedTraits.has(e.name));
379
- const tagProviders = /* @__PURE__ */ new Map();
380
- for (const entry of activeEntries) {
381
- if (entry.config.tags) {
382
- for (const tag of entry.config.tags) {
383
- if (!tagProviders.has(tag)) tagProviders.set(tag, /* @__PURE__ */ new Set());
384
- tagProviders.get(tag).add(entry.name);
385
- }
386
- }
387
- }
388
- const filteredEntries = activeEntries.filter((e) => {
389
- return this.meetsRequirements(e.name, tagProviders);
390
- });
391
- filteredEntries.sort((a, b) => a.priority - b.priority);
392
- const merged = {};
393
- for (const entry of filteredEntries) {
394
- if (entry.config.material) {
395
- Object.assign(merged, entry.config.material);
396
- }
397
- if (entry.config.emissive) {
398
- merged.emissive = entry.config.emissive.color;
399
- merged.emissiveIntensity = entry.config.emissive.intensity;
400
- }
401
- if (entry.config.opacity !== void 0) {
402
- merged.opacity = entry.config.opacity;
403
- merged.transparent = entry.config.opacity < 1;
404
- }
405
- }
406
- const activeTraitNames = filteredEntries.map((e) => e.name);
407
- const activeTags = /* @__PURE__ */ new Set();
408
- for (const entry of filteredEntries) {
409
- if (entry.config.tags) {
410
- for (const tag of entry.config.tags) {
411
- activeTags.add(tag);
412
- }
413
- }
414
- }
415
- this.applyAdditiveRules(activeTraitNames, activeTags, merged);
416
- return merged;
417
- }
418
- /** Get set of trait names suppressed by other active traits. */
419
- getSuppressedTraits(traitNames) {
420
- const suppressed = /* @__PURE__ */ new Set();
421
- const nameSet = new Set(traitNames);
422
- for (const rule of this.rules) {
423
- if ("suppresses" in rule && rule.suppresses && nameSet.has(rule.trait)) {
424
- for (const s of rule.suppresses) {
425
- suppressed.add(s);
426
- }
427
- }
428
- }
429
- return suppressed;
430
- }
431
- /** Check if a trait's requirement rules are satisfied by OTHER traits' tags. */
432
- meetsRequirements(traitName, tagProviders) {
433
- for (const rule of this.rules) {
434
- if (!("requires" in rule) || rule.trait !== traitName || !rule.requires) continue;
435
- if (rule.requires.tags) {
436
- const hasRequired = rule.requires.tags.some((tag) => {
437
- const providers = tagProviders.get(tag);
438
- if (!providers) return false;
439
- for (const provider of providers) {
440
- if (provider !== traitName) return true;
441
- }
442
- return false;
443
- });
444
- if (!hasRequired) return false;
445
- }
446
- }
447
- return true;
448
- }
449
- /** Apply additive rules and multi-trait merge overrides. */
450
- applyAdditiveRules(traitNames, allTags, merged) {
451
- const nameSet = new Set(traitNames);
452
- for (const rule of this.rules) {
453
- if ("additive" in rule && rule.additive && nameSet.has(rule.trait)) {
454
- Object.assign(merged, rule.additive);
455
- }
456
- if ("traits" in rule && rule.traits && "merge" in rule && rule.merge) {
457
- const allPresent = rule.traits.every((t) => nameSet.has(t));
458
- if (allPresent) {
459
- Object.assign(merged, rule.merge);
460
- }
461
- }
462
- }
463
- }
464
- };
465
- }
466
- });
467
-
468
- exports.init_TraitCompositor = init_TraitCompositor;
469
- exports.init_TraitVisualRegistry = init_TraitVisualRegistry;
470
- exports.init_composition_rules = init_composition_rules;
471
- exports.init_types = init_types;
472
- //# sourceMappingURL=chunk-X4ZF6CNE.cjs.map
473
- //# sourceMappingURL=chunk-X4ZF6CNE.cjs.map