@esengine/blueprint 4.0.0 → 4.1.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.
package/dist/index.js CHANGED
@@ -2006,6 +2006,440 @@ function createFragmentRegistry() {
2006
2006
  }
2007
2007
  __name(createFragmentRegistry, "createFragmentRegistry");
2008
2008
 
2009
+ // src/registry/BlueprintDecorators.ts
2010
+ var registeredComponents = /* @__PURE__ */ new Map();
2011
+ function getRegisteredBlueprintComponents() {
2012
+ return registeredComponents;
2013
+ }
2014
+ __name(getRegisteredBlueprintComponents, "getRegisteredBlueprintComponents");
2015
+ function getBlueprintMetadata(componentClass) {
2016
+ return registeredComponents.get(componentClass);
2017
+ }
2018
+ __name(getBlueprintMetadata, "getBlueprintMetadata");
2019
+ function clearRegisteredComponents() {
2020
+ registeredComponents.clear();
2021
+ }
2022
+ __name(clearRegisteredComponents, "clearRegisteredComponents");
2023
+ function getOrCreateMetadata(constructor) {
2024
+ let metadata = registeredComponents.get(constructor);
2025
+ if (!metadata) {
2026
+ metadata = {
2027
+ componentName: constructor.__componentName__ ?? constructor.name,
2028
+ properties: [],
2029
+ methods: []
2030
+ };
2031
+ registeredComponents.set(constructor, metadata);
2032
+ }
2033
+ return metadata;
2034
+ }
2035
+ __name(getOrCreateMetadata, "getOrCreateMetadata");
2036
+ function BlueprintExpose(options = {}) {
2037
+ return function(target) {
2038
+ const metadata = getOrCreateMetadata(target);
2039
+ Object.assign(metadata, options);
2040
+ metadata.componentName = target.__componentName__ ?? target.name;
2041
+ return target;
2042
+ };
2043
+ }
2044
+ __name(BlueprintExpose, "BlueprintExpose");
2045
+ function BlueprintProperty(options = {}) {
2046
+ return function(target, propertyKey) {
2047
+ const key = String(propertyKey);
2048
+ const metadata = getOrCreateMetadata(target.constructor);
2049
+ const propMeta = {
2050
+ propertyKey: key,
2051
+ displayName: options.displayName ?? key,
2052
+ description: options.description,
2053
+ pinType: options.type ?? "any",
2054
+ readonly: options.readonly ?? false,
2055
+ defaultValue: options.defaultValue
2056
+ };
2057
+ const existingIndex = metadata.properties.findIndex((p) => p.propertyKey === key);
2058
+ if (existingIndex >= 0) {
2059
+ metadata.properties[existingIndex] = propMeta;
2060
+ } else {
2061
+ metadata.properties.push(propMeta);
2062
+ }
2063
+ };
2064
+ }
2065
+ __name(BlueprintProperty, "BlueprintProperty");
2066
+ function BlueprintMethod(options = {}) {
2067
+ return function(target, propertyKey, descriptor) {
2068
+ const key = String(propertyKey);
2069
+ const metadata = getOrCreateMetadata(target.constructor);
2070
+ const methodMeta = {
2071
+ methodKey: key,
2072
+ displayName: options.displayName ?? key,
2073
+ description: options.description,
2074
+ isPure: options.isPure ?? false,
2075
+ params: options.params ?? [],
2076
+ returnType: options.returnType ?? "any"
2077
+ };
2078
+ const existingIndex = metadata.methods.findIndex((m) => m.methodKey === key);
2079
+ if (existingIndex >= 0) {
2080
+ metadata.methods[existingIndex] = methodMeta;
2081
+ } else {
2082
+ metadata.methods.push(methodMeta);
2083
+ }
2084
+ return descriptor;
2085
+ };
2086
+ }
2087
+ __name(BlueprintMethod, "BlueprintMethod");
2088
+ function inferPinType(typeName) {
2089
+ const typeMap = {
2090
+ "number": "float",
2091
+ "Number": "float",
2092
+ "string": "string",
2093
+ "String": "string",
2094
+ "boolean": "bool",
2095
+ "Boolean": "bool",
2096
+ "Entity": "entity",
2097
+ "Component": "component",
2098
+ "Vector2": "vector2",
2099
+ "Vec2": "vector2",
2100
+ "Vector3": "vector3",
2101
+ "Vec3": "vector3",
2102
+ "Color": "color",
2103
+ "Array": "array",
2104
+ "Object": "object",
2105
+ "void": "exec",
2106
+ "undefined": "exec"
2107
+ };
2108
+ return typeMap[typeName] ?? "any";
2109
+ }
2110
+ __name(inferPinType, "inferPinType");
2111
+
2112
+ // src/registry/ComponentNodeGenerator.ts
2113
+ function generateComponentNodes(componentClass, metadata) {
2114
+ const { componentName, properties, methods } = metadata;
2115
+ const category = metadata.category ?? "component";
2116
+ const color = metadata.color ?? "#1e8b8b";
2117
+ generateGetComponentNode(componentClass, componentName, metadata, color);
2118
+ for (const prop of properties) {
2119
+ generatePropertyGetNode(componentName, prop, category, color);
2120
+ if (!prop.readonly) {
2121
+ generatePropertySetNode(componentName, prop, category, color);
2122
+ }
2123
+ }
2124
+ for (const method of methods) {
2125
+ generateMethodCallNode(componentName, method, category, color);
2126
+ }
2127
+ }
2128
+ __name(generateComponentNodes, "generateComponentNodes");
2129
+ function generateGetComponentNode(componentClass, componentName, metadata, color) {
2130
+ const nodeType = `Get_${componentName}`;
2131
+ const displayName = metadata.displayName ?? componentName;
2132
+ const template = {
2133
+ type: nodeType,
2134
+ title: `Get ${displayName}`,
2135
+ category: "component",
2136
+ color,
2137
+ isPure: true,
2138
+ description: `Gets ${displayName} component from entity (\u4ECE\u5B9E\u4F53\u83B7\u53D6 ${displayName} \u7EC4\u4EF6)`,
2139
+ keywords: [
2140
+ "get",
2141
+ "component",
2142
+ componentName.toLowerCase()
2143
+ ],
2144
+ menuPath: [
2145
+ "Components",
2146
+ displayName,
2147
+ `Get ${displayName}`
2148
+ ],
2149
+ inputs: [
2150
+ {
2151
+ name: "entity",
2152
+ type: "entity",
2153
+ displayName: "Entity"
2154
+ }
2155
+ ],
2156
+ outputs: [
2157
+ {
2158
+ name: "component",
2159
+ type: "component",
2160
+ displayName
2161
+ },
2162
+ {
2163
+ name: "found",
2164
+ type: "bool",
2165
+ displayName: "Found"
2166
+ }
2167
+ ]
2168
+ };
2169
+ const executor = {
2170
+ execute(node, context) {
2171
+ const entity = context.evaluateInput(node.id, "entity", context.entity);
2172
+ if (!entity || entity.isDestroyed) {
2173
+ return {
2174
+ outputs: {
2175
+ component: null,
2176
+ found: false
2177
+ }
2178
+ };
2179
+ }
2180
+ const component = entity.components.find((c) => c.constructor === componentClass || c.constructor.name === componentName || c.constructor.__componentName__ === componentName);
2181
+ return {
2182
+ outputs: {
2183
+ component: component ?? null,
2184
+ found: component != null
2185
+ }
2186
+ };
2187
+ }
2188
+ };
2189
+ NodeRegistry.instance.register(template, executor);
2190
+ }
2191
+ __name(generateGetComponentNode, "generateGetComponentNode");
2192
+ function generatePropertyGetNode(componentName, prop, category, color) {
2193
+ const nodeType = `Get_${componentName}_${prop.propertyKey}`;
2194
+ const { displayName, pinType } = prop;
2195
+ const template = {
2196
+ type: nodeType,
2197
+ title: `Get ${displayName}`,
2198
+ subtitle: componentName,
2199
+ category,
2200
+ color,
2201
+ isPure: true,
2202
+ description: prop.description ?? `Gets ${displayName} from ${componentName} (\u4ECE ${componentName} \u83B7\u53D6 ${displayName})`,
2203
+ keywords: [
2204
+ "get",
2205
+ "property",
2206
+ componentName.toLowerCase(),
2207
+ prop.propertyKey.toLowerCase()
2208
+ ],
2209
+ menuPath: [
2210
+ "Components",
2211
+ componentName,
2212
+ `Get ${displayName}`
2213
+ ],
2214
+ inputs: [
2215
+ {
2216
+ name: "component",
2217
+ type: "component",
2218
+ displayName: componentName
2219
+ }
2220
+ ],
2221
+ outputs: [
2222
+ {
2223
+ name: "value",
2224
+ type: pinType,
2225
+ displayName
2226
+ }
2227
+ ]
2228
+ };
2229
+ const propertyKey = prop.propertyKey;
2230
+ const defaultValue = prop.defaultValue;
2231
+ const executor = {
2232
+ execute(node, context) {
2233
+ const component = context.evaluateInput(node.id, "component", null);
2234
+ if (!component) {
2235
+ return {
2236
+ outputs: {
2237
+ value: defaultValue ?? null
2238
+ }
2239
+ };
2240
+ }
2241
+ const value = component[propertyKey];
2242
+ return {
2243
+ outputs: {
2244
+ value
2245
+ }
2246
+ };
2247
+ }
2248
+ };
2249
+ NodeRegistry.instance.register(template, executor);
2250
+ }
2251
+ __name(generatePropertyGetNode, "generatePropertyGetNode");
2252
+ function generatePropertySetNode(componentName, prop, category, color) {
2253
+ const nodeType = `Set_${componentName}_${prop.propertyKey}`;
2254
+ const { displayName, pinType, defaultValue } = prop;
2255
+ const template = {
2256
+ type: nodeType,
2257
+ title: `Set ${displayName}`,
2258
+ subtitle: componentName,
2259
+ category,
2260
+ color,
2261
+ description: prop.description ?? `Sets ${displayName} on ${componentName} (\u8BBE\u7F6E ${componentName} \u7684 ${displayName})`,
2262
+ keywords: [
2263
+ "set",
2264
+ "property",
2265
+ componentName.toLowerCase(),
2266
+ prop.propertyKey.toLowerCase()
2267
+ ],
2268
+ menuPath: [
2269
+ "Components",
2270
+ componentName,
2271
+ `Set ${displayName}`
2272
+ ],
2273
+ inputs: [
2274
+ {
2275
+ name: "exec",
2276
+ type: "exec",
2277
+ displayName: ""
2278
+ },
2279
+ {
2280
+ name: "component",
2281
+ type: "component",
2282
+ displayName: componentName
2283
+ },
2284
+ {
2285
+ name: "value",
2286
+ type: pinType,
2287
+ displayName,
2288
+ defaultValue
2289
+ }
2290
+ ],
2291
+ outputs: [
2292
+ {
2293
+ name: "exec",
2294
+ type: "exec",
2295
+ displayName: ""
2296
+ }
2297
+ ]
2298
+ };
2299
+ const propertyKey = prop.propertyKey;
2300
+ const executor = {
2301
+ execute(node, context) {
2302
+ const component = context.evaluateInput(node.id, "component", null);
2303
+ const value = context.evaluateInput(node.id, "value", defaultValue);
2304
+ if (component) {
2305
+ component[propertyKey] = value;
2306
+ }
2307
+ return {
2308
+ nextExec: "exec"
2309
+ };
2310
+ }
2311
+ };
2312
+ NodeRegistry.instance.register(template, executor);
2313
+ }
2314
+ __name(generatePropertySetNode, "generatePropertySetNode");
2315
+ function generateMethodCallNode(componentName, method, category, color) {
2316
+ const nodeType = `Call_${componentName}_${method.methodKey}`;
2317
+ const { displayName, isPure, params, returnType } = method;
2318
+ const inputs = [];
2319
+ if (!isPure) {
2320
+ inputs.push({
2321
+ name: "exec",
2322
+ type: "exec",
2323
+ displayName: ""
2324
+ });
2325
+ }
2326
+ inputs.push({
2327
+ name: "component",
2328
+ type: "component",
2329
+ displayName: componentName
2330
+ });
2331
+ const paramNames = [];
2332
+ for (const param of params) {
2333
+ inputs.push({
2334
+ name: param.name,
2335
+ type: param.type ?? "any",
2336
+ displayName: param.displayName ?? param.name,
2337
+ defaultValue: param.defaultValue
2338
+ });
2339
+ paramNames.push(param.name);
2340
+ }
2341
+ const outputs = [];
2342
+ if (!isPure) {
2343
+ outputs.push({
2344
+ name: "exec",
2345
+ type: "exec",
2346
+ displayName: ""
2347
+ });
2348
+ }
2349
+ if (returnType !== "exec" && returnType !== "any") {
2350
+ outputs.push({
2351
+ name: "result",
2352
+ type: returnType,
2353
+ displayName: "Result"
2354
+ });
2355
+ }
2356
+ const template = {
2357
+ type: nodeType,
2358
+ title: displayName,
2359
+ subtitle: componentName,
2360
+ category,
2361
+ color,
2362
+ isPure,
2363
+ description: method.description ?? `Calls ${displayName} on ${componentName} (\u8C03\u7528 ${componentName} \u7684 ${displayName})`,
2364
+ keywords: [
2365
+ "call",
2366
+ "method",
2367
+ componentName.toLowerCase(),
2368
+ method.methodKey.toLowerCase()
2369
+ ],
2370
+ menuPath: [
2371
+ "Components",
2372
+ componentName,
2373
+ displayName
2374
+ ],
2375
+ inputs,
2376
+ outputs
2377
+ };
2378
+ const methodKey = method.methodKey;
2379
+ const executor = {
2380
+ execute(node, context) {
2381
+ const component = context.evaluateInput(node.id, "component", null);
2382
+ if (!component) {
2383
+ return isPure ? {
2384
+ outputs: {
2385
+ result: null
2386
+ }
2387
+ } : {
2388
+ nextExec: "exec"
2389
+ };
2390
+ }
2391
+ const args = paramNames.map((name) => context.evaluateInput(node.id, name, void 0));
2392
+ const fn = component[methodKey];
2393
+ if (typeof fn !== "function") {
2394
+ console.warn(`Method ${methodKey} not found on component ${componentName}`);
2395
+ return isPure ? {
2396
+ outputs: {
2397
+ result: null
2398
+ }
2399
+ } : {
2400
+ nextExec: "exec"
2401
+ };
2402
+ }
2403
+ const result = fn.apply(component, args);
2404
+ return isPure ? {
2405
+ outputs: {
2406
+ result
2407
+ }
2408
+ } : {
2409
+ outputs: {
2410
+ result
2411
+ },
2412
+ nextExec: "exec"
2413
+ };
2414
+ }
2415
+ };
2416
+ NodeRegistry.instance.register(template, executor);
2417
+ }
2418
+ __name(generateMethodCallNode, "generateMethodCallNode");
2419
+ function registerAllComponentNodes() {
2420
+ const components = getRegisteredBlueprintComponents();
2421
+ for (const [componentClass, metadata] of components) {
2422
+ try {
2423
+ generateComponentNodes(componentClass, metadata);
2424
+ console.log(`[Blueprint] Registered component: ${metadata.componentName} (${metadata.properties.length} properties, ${metadata.methods.length} methods)`);
2425
+ } catch (error) {
2426
+ console.error(`[Blueprint] Failed to register component ${metadata.componentName}:`, error);
2427
+ }
2428
+ }
2429
+ console.log(`[Blueprint] Registered ${components.size} component(s)`);
2430
+ }
2431
+ __name(registerAllComponentNodes, "registerAllComponentNodes");
2432
+ function registerComponentNodes(componentClass) {
2433
+ const components = getRegisteredBlueprintComponents();
2434
+ const metadata = components.get(componentClass);
2435
+ if (!metadata) {
2436
+ console.warn(`[Blueprint] Component ${componentClass.name} is not marked with @BlueprintExpose`);
2437
+ return;
2438
+ }
2439
+ generateComponentNodes(componentClass, metadata);
2440
+ }
2441
+ __name(registerComponentNodes, "registerComponentNodes");
2442
+
2009
2443
  // src/nodes/events/EventBeginPlay.ts
2010
2444
  function _ts_decorate(decorators, target, key, desc) {
2011
2445
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -2140,7 +2574,7 @@ EventEndPlayExecutor = _ts_decorate3([
2140
2574
  RegisterNode(EventEndPlayTemplate)
2141
2575
  ], EventEndPlayExecutor);
2142
2576
 
2143
- // src/nodes/events/EventInput.ts
2577
+ // src/nodes/ecs/EntityNodes.ts
2144
2578
  function _ts_decorate4(decorators, target, key, desc) {
2145
2579
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2146
2580
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -2148,515 +2582,489 @@ function _ts_decorate4(decorators, target, key, desc) {
2148
2582
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2149
2583
  }
2150
2584
  __name(_ts_decorate4, "_ts_decorate");
2151
- var EventInputTemplate = {
2152
- type: "EventInput",
2153
- title: "Event Input",
2154
- category: "event",
2155
- color: "#CC0000",
2156
- description: "Triggered when input action occurs / \u8F93\u5165\u52A8\u4F5C\u53D1\u751F\u65F6\u89E6\u53D1",
2585
+ var GetSelfTemplate = {
2586
+ type: "ECS_GetSelf",
2587
+ title: "Get Self",
2588
+ category: "entity",
2589
+ color: "#1e5a8b",
2590
+ isPure: true,
2591
+ description: "Gets the entity that owns this blueprint (\u83B7\u53D6\u62E5\u6709\u6B64\u84DD\u56FE\u7684\u5B9E\u4F53)",
2157
2592
  keywords: [
2158
- "input",
2159
- "key",
2160
- "button",
2161
- "action",
2162
- "event"
2593
+ "self",
2594
+ "this",
2595
+ "owner",
2596
+ "entity",
2597
+ "me"
2163
2598
  ],
2164
2599
  menuPath: [
2165
- "Event",
2166
- "Input"
2600
+ "ECS",
2601
+ "Entity",
2602
+ "Get Self"
2167
2603
  ],
2168
- inputs: [
2604
+ inputs: [],
2605
+ outputs: [
2169
2606
  {
2170
- name: "action",
2171
- type: "string",
2172
- displayName: "Action",
2173
- defaultValue: ""
2607
+ name: "entity",
2608
+ type: "entity",
2609
+ displayName: "Self"
2174
2610
  }
2611
+ ]
2612
+ };
2613
+ var _GetSelfExecutor = class _GetSelfExecutor {
2614
+ execute(_node, context) {
2615
+ return {
2616
+ outputs: {
2617
+ entity: context.entity
2618
+ }
2619
+ };
2620
+ }
2621
+ };
2622
+ __name(_GetSelfExecutor, "GetSelfExecutor");
2623
+ var GetSelfExecutor = _GetSelfExecutor;
2624
+ GetSelfExecutor = _ts_decorate4([
2625
+ RegisterNode(GetSelfTemplate)
2626
+ ], GetSelfExecutor);
2627
+ var CreateEntityTemplate = {
2628
+ type: "ECS_CreateEntity",
2629
+ title: "Create Entity",
2630
+ category: "entity",
2631
+ color: "#1e5a8b",
2632
+ description: "Creates a new entity in the scene (\u5728\u573A\u666F\u4E2D\u521B\u5EFA\u65B0\u5B9E\u4F53)",
2633
+ keywords: [
2634
+ "entity",
2635
+ "create",
2636
+ "spawn",
2637
+ "new",
2638
+ "instantiate"
2175
2639
  ],
2176
- outputs: [
2640
+ menuPath: [
2641
+ "ECS",
2642
+ "Entity",
2643
+ "Create Entity"
2644
+ ],
2645
+ inputs: [
2177
2646
  {
2178
2647
  name: "exec",
2179
2648
  type: "exec",
2180
2649
  displayName: ""
2181
2650
  },
2182
2651
  {
2183
- name: "action",
2652
+ name: "name",
2184
2653
  type: "string",
2185
- displayName: "Action"
2186
- },
2187
- {
2188
- name: "value",
2189
- type: "float",
2190
- displayName: "Value"
2191
- },
2654
+ displayName: "Name",
2655
+ defaultValue: "NewEntity"
2656
+ }
2657
+ ],
2658
+ outputs: [
2192
2659
  {
2193
- name: "pressed",
2194
- type: "bool",
2195
- displayName: "Pressed"
2660
+ name: "exec",
2661
+ type: "exec",
2662
+ displayName: ""
2196
2663
  },
2197
2664
  {
2198
- name: "released",
2199
- type: "bool",
2200
- displayName: "Released"
2665
+ name: "entity",
2666
+ type: "entity",
2667
+ displayName: "Entity"
2201
2668
  }
2202
2669
  ]
2203
2670
  };
2204
- var _EventInputExecutor = class _EventInputExecutor {
2205
- execute(node, _context) {
2671
+ var _CreateEntityExecutor = class _CreateEntityExecutor {
2672
+ execute(node, context) {
2673
+ const name = context.evaluateInput(node.id, "name", "NewEntity");
2674
+ const entity = context.scene.createEntity(name);
2206
2675
  return {
2207
- nextExec: "exec",
2208
2676
  outputs: {
2209
- action: node.data?.action ?? "",
2210
- value: 0,
2211
- pressed: false,
2212
- released: false
2213
- }
2677
+ entity
2678
+ },
2679
+ nextExec: "exec"
2214
2680
  };
2215
2681
  }
2216
2682
  };
2217
- __name(_EventInputExecutor, "EventInputExecutor");
2218
- var EventInputExecutor = _EventInputExecutor;
2219
- EventInputExecutor = _ts_decorate4([
2220
- RegisterNode(EventInputTemplate)
2221
- ], EventInputExecutor);
2222
-
2223
- // src/nodes/events/EventCollision.ts
2224
- function _ts_decorate5(decorators, target, key, desc) {
2225
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2226
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2227
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2228
- return c > 3 && r && Object.defineProperty(target, key, r), r;
2229
- }
2230
- __name(_ts_decorate5, "_ts_decorate");
2231
- var EventCollisionEnterTemplate = {
2232
- type: "EventCollisionEnter",
2233
- title: "Event Collision Enter",
2234
- category: "event",
2235
- color: "#CC0000",
2236
- description: "Triggered when collision starts / \u78B0\u649E\u5F00\u59CB\u65F6\u89E6\u53D1",
2683
+ __name(_CreateEntityExecutor, "CreateEntityExecutor");
2684
+ var CreateEntityExecutor = _CreateEntityExecutor;
2685
+ CreateEntityExecutor = _ts_decorate4([
2686
+ RegisterNode(CreateEntityTemplate)
2687
+ ], CreateEntityExecutor);
2688
+ var DestroyEntityTemplate = {
2689
+ type: "ECS_DestroyEntity",
2690
+ title: "Destroy Entity",
2691
+ category: "entity",
2692
+ color: "#8b1e1e",
2693
+ description: "Destroys an entity from the scene (\u4ECE\u573A\u666F\u4E2D\u9500\u6BC1\u5B9E\u4F53)",
2237
2694
  keywords: [
2238
- "collision",
2239
- "enter",
2240
- "hit",
2241
- "overlap",
2242
- "event"
2695
+ "entity",
2696
+ "destroy",
2697
+ "remove",
2698
+ "delete",
2699
+ "kill"
2243
2700
  ],
2244
2701
  menuPath: [
2245
- "Event",
2246
- "Collision",
2247
- "Enter"
2702
+ "ECS",
2703
+ "Entity",
2704
+ "Destroy Entity"
2248
2705
  ],
2249
- inputs: [],
2250
- outputs: [
2706
+ inputs: [
2251
2707
  {
2252
2708
  name: "exec",
2253
2709
  type: "exec",
2254
2710
  displayName: ""
2255
2711
  },
2256
2712
  {
2257
- name: "otherEntityId",
2258
- type: "string",
2259
- displayName: "Other Entity"
2260
- },
2261
- {
2262
- name: "pointX",
2263
- type: "float",
2264
- displayName: "Point X"
2265
- },
2266
- {
2267
- name: "pointY",
2268
- type: "float",
2269
- displayName: "Point Y"
2270
- },
2271
- {
2272
- name: "normalX",
2273
- type: "float",
2274
- displayName: "Normal X"
2275
- },
2713
+ name: "entity",
2714
+ type: "entity",
2715
+ displayName: "Entity"
2716
+ }
2717
+ ],
2718
+ outputs: [
2276
2719
  {
2277
- name: "normalY",
2278
- type: "float",
2279
- displayName: "Normal Y"
2720
+ name: "exec",
2721
+ type: "exec",
2722
+ displayName: ""
2280
2723
  }
2281
2724
  ]
2282
2725
  };
2283
- var _EventCollisionEnterExecutor = class _EventCollisionEnterExecutor {
2284
- execute(_node) {
2726
+ var _DestroyEntityExecutor = class _DestroyEntityExecutor {
2727
+ execute(node, context) {
2728
+ const entity = context.evaluateInput(node.id, "entity", null);
2729
+ if (entity && !entity.isDestroyed) {
2730
+ entity.destroy();
2731
+ }
2285
2732
  return {
2286
- nextExec: "exec",
2287
- outputs: {
2288
- otherEntityId: "",
2289
- pointX: 0,
2290
- pointY: 0,
2291
- normalX: 0,
2292
- normalY: 0
2293
- }
2733
+ nextExec: "exec"
2294
2734
  };
2295
2735
  }
2296
2736
  };
2297
- __name(_EventCollisionEnterExecutor, "EventCollisionEnterExecutor");
2298
- var EventCollisionEnterExecutor = _EventCollisionEnterExecutor;
2299
- EventCollisionEnterExecutor = _ts_decorate5([
2300
- RegisterNode(EventCollisionEnterTemplate)
2301
- ], EventCollisionEnterExecutor);
2302
- var EventCollisionExitTemplate = {
2303
- type: "EventCollisionExit",
2304
- title: "Event Collision Exit",
2305
- category: "event",
2306
- color: "#CC0000",
2307
- description: "Triggered when collision ends / \u78B0\u649E\u7ED3\u675F\u65F6\u89E6\u53D1",
2737
+ __name(_DestroyEntityExecutor, "DestroyEntityExecutor");
2738
+ var DestroyEntityExecutor = _DestroyEntityExecutor;
2739
+ DestroyEntityExecutor = _ts_decorate4([
2740
+ RegisterNode(DestroyEntityTemplate)
2741
+ ], DestroyEntityExecutor);
2742
+ var DestroySelfTemplate = {
2743
+ type: "ECS_DestroySelf",
2744
+ title: "Destroy Self",
2745
+ category: "entity",
2746
+ color: "#8b1e1e",
2747
+ description: "Destroys the entity that owns this blueprint (\u9500\u6BC1\u62E5\u6709\u6B64\u84DD\u56FE\u7684\u5B9E\u4F53)",
2308
2748
  keywords: [
2309
- "collision",
2310
- "exit",
2311
- "end",
2312
- "separate",
2313
- "event"
2749
+ "self",
2750
+ "destroy",
2751
+ "suicide",
2752
+ "remove",
2753
+ "delete"
2314
2754
  ],
2315
2755
  menuPath: [
2316
- "Event",
2317
- "Collision",
2318
- "Exit"
2756
+ "ECS",
2757
+ "Entity",
2758
+ "Destroy Self"
2319
2759
  ],
2320
- inputs: [],
2321
- outputs: [
2760
+ inputs: [
2322
2761
  {
2323
2762
  name: "exec",
2324
2763
  type: "exec",
2325
2764
  displayName: ""
2326
- },
2327
- {
2328
- name: "otherEntityId",
2329
- type: "string",
2330
- displayName: "Other Entity"
2331
2765
  }
2332
- ]
2766
+ ],
2767
+ outputs: []
2333
2768
  };
2334
- var _EventCollisionExitExecutor = class _EventCollisionExitExecutor {
2335
- execute(_node) {
2769
+ var _DestroySelfExecutor = class _DestroySelfExecutor {
2770
+ execute(_node, context) {
2771
+ if (!context.entity.isDestroyed) {
2772
+ context.entity.destroy();
2773
+ }
2336
2774
  return {
2337
- nextExec: "exec",
2338
- outputs: {
2339
- otherEntityId: ""
2340
- }
2775
+ nextExec: null
2341
2776
  };
2342
2777
  }
2343
2778
  };
2344
- __name(_EventCollisionExitExecutor, "EventCollisionExitExecutor");
2345
- var EventCollisionExitExecutor = _EventCollisionExitExecutor;
2346
- EventCollisionExitExecutor = _ts_decorate5([
2347
- RegisterNode(EventCollisionExitTemplate)
2348
- ], EventCollisionExitExecutor);
2349
-
2350
- // src/nodes/events/EventMessage.ts
2351
- function _ts_decorate6(decorators, target, key, desc) {
2352
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2353
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2354
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2355
- return c > 3 && r && Object.defineProperty(target, key, r), r;
2356
- }
2357
- __name(_ts_decorate6, "_ts_decorate");
2358
- var EventMessageTemplate = {
2359
- type: "EventMessage",
2360
- title: "Event Message",
2361
- category: "event",
2362
- color: "#CC0000",
2363
- description: "Triggered when a message is received / \u63A5\u6536\u5230\u6D88\u606F\u65F6\u89E6\u53D1",
2779
+ __name(_DestroySelfExecutor, "DestroySelfExecutor");
2780
+ var DestroySelfExecutor = _DestroySelfExecutor;
2781
+ DestroySelfExecutor = _ts_decorate4([
2782
+ RegisterNode(DestroySelfTemplate)
2783
+ ], DestroySelfExecutor);
2784
+ var IsValidTemplate = {
2785
+ type: "ECS_IsValid",
2786
+ title: "Is Valid",
2787
+ category: "entity",
2788
+ color: "#1e5a8b",
2789
+ isPure: true,
2790
+ description: "Checks if an entity reference is valid and not destroyed (\u68C0\u67E5\u5B9E\u4F53\u5F15\u7528\u662F\u5426\u6709\u6548\u4E14\u672A\u88AB\u9500\u6BC1)",
2364
2791
  keywords: [
2365
- "message",
2366
- "receive",
2367
- "broadcast",
2368
- "event",
2369
- "signal"
2792
+ "entity",
2793
+ "valid",
2794
+ "null",
2795
+ "check",
2796
+ "exists",
2797
+ "alive"
2370
2798
  ],
2371
2799
  menuPath: [
2372
- "Event",
2373
- "Message"
2800
+ "ECS",
2801
+ "Entity",
2802
+ "Is Valid"
2374
2803
  ],
2375
2804
  inputs: [
2376
2805
  {
2377
- name: "messageName",
2378
- type: "string",
2379
- displayName: "Message Name",
2380
- defaultValue: ""
2806
+ name: "entity",
2807
+ type: "entity",
2808
+ displayName: "Entity"
2381
2809
  }
2382
2810
  ],
2383
2811
  outputs: [
2384
2812
  {
2385
- name: "exec",
2386
- type: "exec",
2387
- displayName: ""
2388
- },
2389
- {
2390
- name: "messageName",
2391
- type: "string",
2392
- displayName: "Message"
2393
- },
2394
- {
2395
- name: "senderId",
2396
- type: "string",
2397
- displayName: "Sender ID"
2398
- },
2399
- {
2400
- name: "payload",
2401
- type: "any",
2402
- displayName: "Payload"
2813
+ name: "isValid",
2814
+ type: "bool",
2815
+ displayName: "Is Valid"
2403
2816
  }
2404
2817
  ]
2405
2818
  };
2406
- var _EventMessageExecutor = class _EventMessageExecutor {
2407
- execute(node) {
2819
+ var _IsValidExecutor = class _IsValidExecutor {
2820
+ execute(node, context) {
2821
+ const entity = context.evaluateInput(node.id, "entity", null);
2822
+ const isValid = entity != null && !entity.isDestroyed;
2408
2823
  return {
2409
- nextExec: "exec",
2410
2824
  outputs: {
2411
- messageName: node.data?.messageName ?? "",
2412
- senderId: "",
2413
- payload: null
2825
+ isValid
2414
2826
  }
2415
2827
  };
2416
2828
  }
2417
2829
  };
2418
- __name(_EventMessageExecutor, "EventMessageExecutor");
2419
- var EventMessageExecutor = _EventMessageExecutor;
2420
- EventMessageExecutor = _ts_decorate6([
2421
- RegisterNode(EventMessageTemplate)
2422
- ], EventMessageExecutor);
2423
-
2424
- // src/nodes/events/EventTimer.ts
2425
- function _ts_decorate7(decorators, target, key, desc) {
2426
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2427
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2428
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2429
- return c > 3 && r && Object.defineProperty(target, key, r), r;
2430
- }
2431
- __name(_ts_decorate7, "_ts_decorate");
2432
- var EventTimerTemplate = {
2433
- type: "EventTimer",
2434
- title: "Event Timer",
2435
- category: "event",
2436
- color: "#CC0000",
2437
- description: "Triggered when a timer fires / \u5B9A\u65F6\u5668\u89E6\u53D1\u65F6\u6267\u884C",
2830
+ __name(_IsValidExecutor, "IsValidExecutor");
2831
+ var IsValidExecutor = _IsValidExecutor;
2832
+ IsValidExecutor = _ts_decorate4([
2833
+ RegisterNode(IsValidTemplate)
2834
+ ], IsValidExecutor);
2835
+ var GetEntityNameTemplate = {
2836
+ type: "ECS_GetEntityName",
2837
+ title: "Get Entity Name",
2838
+ category: "entity",
2839
+ color: "#1e5a8b",
2840
+ isPure: true,
2841
+ description: "Gets the name of an entity (\u83B7\u53D6\u5B9E\u4F53\u7684\u540D\u79F0)",
2438
2842
  keywords: [
2439
- "timer",
2440
- "delay",
2441
- "schedule",
2442
- "event",
2443
- "interval"
2843
+ "entity",
2844
+ "name",
2845
+ "get",
2846
+ "string"
2444
2847
  ],
2445
2848
  menuPath: [
2446
- "Event",
2447
- "Timer"
2849
+ "ECS",
2850
+ "Entity",
2851
+ "Get Name"
2448
2852
  ],
2449
2853
  inputs: [
2450
2854
  {
2451
- name: "timerId",
2452
- type: "string",
2453
- displayName: "Timer ID",
2454
- defaultValue: ""
2855
+ name: "entity",
2856
+ type: "entity",
2857
+ displayName: "Entity"
2455
2858
  }
2456
2859
  ],
2457
2860
  outputs: [
2458
2861
  {
2459
- name: "exec",
2460
- type: "exec",
2461
- displayName: ""
2462
- },
2463
- {
2464
- name: "timerId",
2862
+ name: "name",
2465
2863
  type: "string",
2466
- displayName: "Timer ID"
2467
- },
2468
- {
2469
- name: "isRepeating",
2470
- type: "bool",
2471
- displayName: "Is Repeating"
2472
- },
2473
- {
2474
- name: "timesFired",
2475
- type: "int",
2476
- displayName: "Times Fired"
2864
+ displayName: "Name"
2477
2865
  }
2478
2866
  ]
2479
2867
  };
2480
- var _EventTimerExecutor = class _EventTimerExecutor {
2481
- execute(node) {
2868
+ var _GetEntityNameExecutor = class _GetEntityNameExecutor {
2869
+ execute(node, context) {
2870
+ const entity = context.evaluateInput(node.id, "entity", context.entity);
2482
2871
  return {
2483
- nextExec: "exec",
2484
2872
  outputs: {
2485
- timerId: node.data?.timerId ?? "",
2486
- isRepeating: false,
2487
- timesFired: 0
2873
+ name: entity?.name ?? ""
2488
2874
  }
2489
2875
  };
2490
2876
  }
2491
2877
  };
2492
- __name(_EventTimerExecutor, "EventTimerExecutor");
2493
- var EventTimerExecutor = _EventTimerExecutor;
2494
- EventTimerExecutor = _ts_decorate7([
2495
- RegisterNode(EventTimerTemplate)
2496
- ], EventTimerExecutor);
2497
-
2498
- // src/nodes/events/EventState.ts
2499
- function _ts_decorate8(decorators, target, key, desc) {
2500
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2501
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2502
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2503
- return c > 3 && r && Object.defineProperty(target, key, r), r;
2504
- }
2505
- __name(_ts_decorate8, "_ts_decorate");
2506
- var EventStateEnterTemplate = {
2507
- type: "EventStateEnter",
2508
- title: "Event State Enter",
2509
- category: "event",
2510
- color: "#CC0000",
2511
- description: "Triggered when entering a state / \u8FDB\u5165\u72B6\u6001\u65F6\u89E6\u53D1",
2878
+ __name(_GetEntityNameExecutor, "GetEntityNameExecutor");
2879
+ var GetEntityNameExecutor = _GetEntityNameExecutor;
2880
+ GetEntityNameExecutor = _ts_decorate4([
2881
+ RegisterNode(GetEntityNameTemplate)
2882
+ ], GetEntityNameExecutor);
2883
+ var SetEntityNameTemplate = {
2884
+ type: "ECS_SetEntityName",
2885
+ title: "Set Entity Name",
2886
+ category: "entity",
2887
+ color: "#1e5a8b",
2888
+ description: "Sets the name of an entity (\u8BBE\u7F6E\u5B9E\u4F53\u7684\u540D\u79F0)",
2512
2889
  keywords: [
2513
- "state",
2514
- "enter",
2515
- "fsm",
2516
- "machine",
2517
- "event"
2890
+ "entity",
2891
+ "name",
2892
+ "set",
2893
+ "rename"
2518
2894
  ],
2519
2895
  menuPath: [
2520
- "Event",
2521
- "State",
2522
- "Enter"
2896
+ "ECS",
2897
+ "Entity",
2898
+ "Set Name"
2523
2899
  ],
2524
2900
  inputs: [
2525
- {
2526
- name: "stateName",
2527
- type: "string",
2528
- displayName: "State Name",
2529
- defaultValue: ""
2530
- }
2531
- ],
2532
- outputs: [
2533
2901
  {
2534
2902
  name: "exec",
2535
2903
  type: "exec",
2536
2904
  displayName: ""
2537
2905
  },
2538
2906
  {
2539
- name: "stateMachineId",
2540
- type: "string",
2541
- displayName: "State Machine"
2907
+ name: "entity",
2908
+ type: "entity",
2909
+ displayName: "Entity"
2542
2910
  },
2543
2911
  {
2544
- name: "currentState",
2912
+ name: "name",
2545
2913
  type: "string",
2546
- displayName: "Current State"
2547
- },
2914
+ displayName: "Name",
2915
+ defaultValue: ""
2916
+ }
2917
+ ],
2918
+ outputs: [
2548
2919
  {
2549
- name: "previousState",
2550
- type: "string",
2551
- displayName: "Previous State"
2920
+ name: "exec",
2921
+ type: "exec",
2922
+ displayName: ""
2552
2923
  }
2553
2924
  ]
2554
2925
  };
2555
- var _EventStateEnterExecutor = class _EventStateEnterExecutor {
2556
- execute(node) {
2926
+ var _SetEntityNameExecutor = class _SetEntityNameExecutor {
2927
+ execute(node, context) {
2928
+ const entity = context.evaluateInput(node.id, "entity", context.entity);
2929
+ const name = context.evaluateInput(node.id, "name", "");
2930
+ if (entity && !entity.isDestroyed) {
2931
+ entity.name = name;
2932
+ }
2557
2933
  return {
2558
- nextExec: "exec",
2559
- outputs: {
2560
- stateMachineId: "",
2561
- currentState: node.data?.stateName ?? "",
2562
- previousState: ""
2563
- }
2934
+ nextExec: "exec"
2564
2935
  };
2565
2936
  }
2566
2937
  };
2567
- __name(_EventStateEnterExecutor, "EventStateEnterExecutor");
2568
- var EventStateEnterExecutor = _EventStateEnterExecutor;
2569
- EventStateEnterExecutor = _ts_decorate8([
2570
- RegisterNode(EventStateEnterTemplate)
2571
- ], EventStateEnterExecutor);
2572
- var EventStateExitTemplate = {
2573
- type: "EventStateExit",
2574
- title: "Event State Exit",
2575
- category: "event",
2576
- color: "#CC0000",
2577
- description: "Triggered when exiting a state / \u9000\u51FA\u72B6\u6001\u65F6\u89E6\u53D1",
2938
+ __name(_SetEntityNameExecutor, "SetEntityNameExecutor");
2939
+ var SetEntityNameExecutor = _SetEntityNameExecutor;
2940
+ SetEntityNameExecutor = _ts_decorate4([
2941
+ RegisterNode(SetEntityNameTemplate)
2942
+ ], SetEntityNameExecutor);
2943
+ var GetEntityTagTemplate = {
2944
+ type: "ECS_GetEntityTag",
2945
+ title: "Get Entity Tag",
2946
+ category: "entity",
2947
+ color: "#1e5a8b",
2948
+ isPure: true,
2949
+ description: "Gets the tag of an entity (\u83B7\u53D6\u5B9E\u4F53\u7684\u6807\u7B7E)",
2578
2950
  keywords: [
2579
- "state",
2580
- "exit",
2581
- "leave",
2582
- "fsm",
2583
- "machine",
2584
- "event"
2951
+ "entity",
2952
+ "tag",
2953
+ "get",
2954
+ "category"
2585
2955
  ],
2586
2956
  menuPath: [
2587
- "Event",
2588
- "State",
2589
- "Exit"
2957
+ "ECS",
2958
+ "Entity",
2959
+ "Get Tag"
2590
2960
  ],
2591
2961
  inputs: [
2592
2962
  {
2593
- name: "stateName",
2594
- type: "string",
2595
- displayName: "State Name",
2596
- defaultValue: ""
2963
+ name: "entity",
2964
+ type: "entity",
2965
+ displayName: "Entity"
2597
2966
  }
2598
2967
  ],
2599
2968
  outputs: [
2969
+ {
2970
+ name: "tag",
2971
+ type: "int",
2972
+ displayName: "Tag"
2973
+ }
2974
+ ]
2975
+ };
2976
+ var _GetEntityTagExecutor = class _GetEntityTagExecutor {
2977
+ execute(node, context) {
2978
+ const entity = context.evaluateInput(node.id, "entity", context.entity);
2979
+ return {
2980
+ outputs: {
2981
+ tag: entity?.tag ?? 0
2982
+ }
2983
+ };
2984
+ }
2985
+ };
2986
+ __name(_GetEntityTagExecutor, "GetEntityTagExecutor");
2987
+ var GetEntityTagExecutor = _GetEntityTagExecutor;
2988
+ GetEntityTagExecutor = _ts_decorate4([
2989
+ RegisterNode(GetEntityTagTemplate)
2990
+ ], GetEntityTagExecutor);
2991
+ var SetEntityTagTemplate = {
2992
+ type: "ECS_SetEntityTag",
2993
+ title: "Set Entity Tag",
2994
+ category: "entity",
2995
+ color: "#1e5a8b",
2996
+ description: "Sets the tag of an entity (\u8BBE\u7F6E\u5B9E\u4F53\u7684\u6807\u7B7E)",
2997
+ keywords: [
2998
+ "entity",
2999
+ "tag",
3000
+ "set",
3001
+ "category"
3002
+ ],
3003
+ menuPath: [
3004
+ "ECS",
3005
+ "Entity",
3006
+ "Set Tag"
3007
+ ],
3008
+ inputs: [
2600
3009
  {
2601
3010
  name: "exec",
2602
3011
  type: "exec",
2603
3012
  displayName: ""
2604
3013
  },
2605
3014
  {
2606
- name: "stateMachineId",
2607
- type: "string",
2608
- displayName: "State Machine"
3015
+ name: "entity",
3016
+ type: "entity",
3017
+ displayName: "Entity"
2609
3018
  },
2610
3019
  {
2611
- name: "currentState",
2612
- type: "string",
2613
- displayName: "Current State"
2614
- },
3020
+ name: "tag",
3021
+ type: "int",
3022
+ displayName: "Tag",
3023
+ defaultValue: 0
3024
+ }
3025
+ ],
3026
+ outputs: [
2615
3027
  {
2616
- name: "previousState",
2617
- type: "string",
2618
- displayName: "Previous State"
3028
+ name: "exec",
3029
+ type: "exec",
3030
+ displayName: ""
2619
3031
  }
2620
3032
  ]
2621
3033
  };
2622
- var _EventStateExitExecutor = class _EventStateExitExecutor {
2623
- execute(node) {
3034
+ var _SetEntityTagExecutor = class _SetEntityTagExecutor {
3035
+ execute(node, context) {
3036
+ const entity = context.evaluateInput(node.id, "entity", context.entity);
3037
+ const tag = context.evaluateInput(node.id, "tag", 0);
3038
+ if (entity && !entity.isDestroyed) {
3039
+ entity.tag = tag;
3040
+ }
2624
3041
  return {
2625
- nextExec: "exec",
2626
- outputs: {
2627
- stateMachineId: "",
2628
- currentState: "",
2629
- previousState: node.data?.stateName ?? ""
2630
- }
3042
+ nextExec: "exec"
2631
3043
  };
2632
3044
  }
2633
3045
  };
2634
- __name(_EventStateExitExecutor, "EventStateExitExecutor");
2635
- var EventStateExitExecutor = _EventStateExitExecutor;
2636
- EventStateExitExecutor = _ts_decorate8([
2637
- RegisterNode(EventStateExitTemplate)
2638
- ], EventStateExitExecutor);
2639
-
2640
- // src/nodes/debug/Print.ts
2641
- function _ts_decorate9(decorators, target, key, desc) {
2642
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2643
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2644
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2645
- return c > 3 && r && Object.defineProperty(target, key, r), r;
2646
- }
2647
- __name(_ts_decorate9, "_ts_decorate");
2648
- var PrintTemplate = {
2649
- type: "Print",
2650
- title: "Print String",
2651
- category: "debug",
2652
- color: "#785EF0",
2653
- description: "Prints a message to the console for debugging (\u6253\u5370\u6D88\u606F\u5230\u63A7\u5236\u53F0\u7528\u4E8E\u8C03\u8BD5)",
3046
+ __name(_SetEntityTagExecutor, "SetEntityTagExecutor");
3047
+ var SetEntityTagExecutor = _SetEntityTagExecutor;
3048
+ SetEntityTagExecutor = _ts_decorate4([
3049
+ RegisterNode(SetEntityTagTemplate)
3050
+ ], SetEntityTagExecutor);
3051
+ var SetEntityActiveTemplate = {
3052
+ type: "ECS_SetEntityActive",
3053
+ title: "Set Active",
3054
+ category: "entity",
3055
+ color: "#1e5a8b",
3056
+ description: "Sets whether an entity is active (\u8BBE\u7F6E\u5B9E\u4F53\u662F\u5426\u6FC0\u6D3B)",
2654
3057
  keywords: [
2655
- "log",
2656
- "debug",
2657
- "console",
2658
- "output",
2659
- "print"
3058
+ "entity",
3059
+ "active",
3060
+ "enable",
3061
+ "disable",
3062
+ "visible"
3063
+ ],
3064
+ menuPath: [
3065
+ "ECS",
3066
+ "Entity",
3067
+ "Set Active"
2660
3068
  ],
2661
3069
  inputs: [
2662
3070
  {
@@ -2665,22 +3073,15 @@ var PrintTemplate = {
2665
3073
  displayName: ""
2666
3074
  },
2667
3075
  {
2668
- name: "message",
2669
- type: "string",
2670
- displayName: "Message",
2671
- defaultValue: "Hello Blueprint!"
3076
+ name: "entity",
3077
+ type: "entity",
3078
+ displayName: "Entity"
2672
3079
  },
2673
3080
  {
2674
- name: "printToScreen",
3081
+ name: "active",
2675
3082
  type: "bool",
2676
- displayName: "Print to Screen",
3083
+ displayName: "Active",
2677
3084
  defaultValue: true
2678
- },
2679
- {
2680
- name: "duration",
2681
- type: "float",
2682
- displayName: "Duration",
2683
- defaultValue: 2
2684
3085
  }
2685
3086
  ],
2686
3087
  outputs: [
@@ -2691,146 +3092,1331 @@ var PrintTemplate = {
2691
3092
  }
2692
3093
  ]
2693
3094
  };
2694
- var _PrintExecutor = class _PrintExecutor {
3095
+ var _SetEntityActiveExecutor = class _SetEntityActiveExecutor {
2695
3096
  execute(node, context) {
2696
- const message = context.evaluateInput(node.id, "message", "Hello Blueprint!");
2697
- const printToScreen = context.evaluateInput(node.id, "printToScreen", true);
2698
- const duration = context.evaluateInput(node.id, "duration", 2);
2699
- console.log(`[Blueprint] ${message}`);
2700
- if (printToScreen) {
2701
- const event = new CustomEvent("blueprint:print", {
2702
- detail: {
2703
- message: String(message),
2704
- duration: Number(duration),
2705
- entityId: context.entity.id,
2706
- entityName: context.entity.name
2707
- }
2708
- });
2709
- if (typeof window !== "undefined") {
2710
- window.dispatchEvent(event);
2711
- }
3097
+ const entity = context.evaluateInput(node.id, "entity", context.entity);
3098
+ const active = context.evaluateInput(node.id, "active", true);
3099
+ if (entity && !entity.isDestroyed) {
3100
+ entity.active = active;
2712
3101
  }
2713
3102
  return {
2714
3103
  nextExec: "exec"
2715
3104
  };
2716
3105
  }
2717
3106
  };
2718
- __name(_PrintExecutor, "PrintExecutor");
2719
- var PrintExecutor = _PrintExecutor;
2720
- PrintExecutor = _ts_decorate9([
2721
- RegisterNode(PrintTemplate)
2722
- ], PrintExecutor);
2723
-
2724
- // src/nodes/time/GetDeltaTime.ts
2725
- function _ts_decorate10(decorators, target, key, desc) {
2726
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2727
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2728
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2729
- return c > 3 && r && Object.defineProperty(target, key, r), r;
2730
- }
2731
- __name(_ts_decorate10, "_ts_decorate");
2732
- var GetDeltaTimeTemplate = {
2733
- type: "GetDeltaTime",
2734
- title: "Get Delta Time",
2735
- category: "time",
2736
- color: "#4FC3F7",
2737
- description: "Returns the time elapsed since the last frame in seconds (\u8FD4\u56DE\u4E0A\u4E00\u5E27\u4EE5\u6765\u7ECF\u8FC7\u7684\u65F6\u95F4\uFF0C\u5355\u4F4D\u79D2)",
3107
+ __name(_SetEntityActiveExecutor, "SetEntityActiveExecutor");
3108
+ var SetEntityActiveExecutor = _SetEntityActiveExecutor;
3109
+ SetEntityActiveExecutor = _ts_decorate4([
3110
+ RegisterNode(SetEntityActiveTemplate)
3111
+ ], SetEntityActiveExecutor);
3112
+ var IsEntityActiveTemplate = {
3113
+ type: "ECS_IsEntityActive",
3114
+ title: "Is Active",
3115
+ category: "entity",
3116
+ color: "#1e5a8b",
3117
+ isPure: true,
3118
+ description: "Checks if an entity is active (\u68C0\u67E5\u5B9E\u4F53\u662F\u5426\u6FC0\u6D3B)",
2738
3119
  keywords: [
2739
- "delta",
2740
- "time",
2741
- "frame",
2742
- "dt"
3120
+ "entity",
3121
+ "active",
3122
+ "enabled",
3123
+ "check"
3124
+ ],
3125
+ menuPath: [
3126
+ "ECS",
3127
+ "Entity",
3128
+ "Is Active"
3129
+ ],
3130
+ inputs: [
3131
+ {
3132
+ name: "entity",
3133
+ type: "entity",
3134
+ displayName: "Entity"
3135
+ }
2743
3136
  ],
2744
- isPure: true,
2745
- inputs: [],
2746
3137
  outputs: [
2747
3138
  {
2748
- name: "deltaTime",
2749
- type: "float",
2750
- displayName: "Delta Seconds"
3139
+ name: "isActive",
3140
+ type: "bool",
3141
+ displayName: "Is Active"
2751
3142
  }
2752
3143
  ]
2753
3144
  };
2754
- var _GetDeltaTimeExecutor = class _GetDeltaTimeExecutor {
2755
- execute(_node, context) {
3145
+ var _IsEntityActiveExecutor = class _IsEntityActiveExecutor {
3146
+ execute(node, context) {
3147
+ const entity = context.evaluateInput(node.id, "entity", context.entity);
2756
3148
  return {
2757
3149
  outputs: {
2758
- deltaTime: context.deltaTime
3150
+ isActive: entity?.active ?? false
2759
3151
  }
2760
3152
  };
2761
3153
  }
2762
3154
  };
2763
- __name(_GetDeltaTimeExecutor, "GetDeltaTimeExecutor");
2764
- var GetDeltaTimeExecutor = _GetDeltaTimeExecutor;
2765
- GetDeltaTimeExecutor = _ts_decorate10([
2766
- RegisterNode(GetDeltaTimeTemplate)
2767
- ], GetDeltaTimeExecutor);
2768
-
2769
- // src/nodes/time/GetTime.ts
2770
- function _ts_decorate11(decorators, target, key, desc) {
2771
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2772
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2773
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2774
- return c > 3 && r && Object.defineProperty(target, key, r), r;
2775
- }
2776
- __name(_ts_decorate11, "_ts_decorate");
2777
- var GetTimeTemplate = {
2778
- type: "GetTime",
2779
- title: "Get Game Time",
2780
- category: "time",
2781
- color: "#4FC3F7",
2782
- description: "Returns the total time since the blueprint started in seconds (\u8FD4\u56DE\u84DD\u56FE\u542F\u52A8\u4EE5\u6765\u7684\u603B\u65F6\u95F4\uFF0C\u5355\u4F4D\u79D2)",
3155
+ __name(_IsEntityActiveExecutor, "IsEntityActiveExecutor");
3156
+ var IsEntityActiveExecutor = _IsEntityActiveExecutor;
3157
+ IsEntityActiveExecutor = _ts_decorate4([
3158
+ RegisterNode(IsEntityActiveTemplate)
3159
+ ], IsEntityActiveExecutor);
3160
+ var FindEntityByNameTemplate = {
3161
+ type: "ECS_FindEntityByName",
3162
+ title: "Find Entity By Name",
3163
+ category: "entity",
3164
+ color: "#1e5a8b",
3165
+ isPure: true,
3166
+ description: "Finds an entity by name in the scene (\u5728\u573A\u666F\u4E2D\u6309\u540D\u79F0\u67E5\u627E\u5B9E\u4F53)",
2783
3167
  keywords: [
2784
- "time",
2785
- "total",
2786
- "elapsed",
2787
- "game"
3168
+ "entity",
3169
+ "find",
3170
+ "name",
3171
+ "search",
3172
+ "get",
3173
+ "lookup"
3174
+ ],
3175
+ menuPath: [
3176
+ "ECS",
3177
+ "Entity",
3178
+ "Find By Name"
3179
+ ],
3180
+ inputs: [
3181
+ {
3182
+ name: "name",
3183
+ type: "string",
3184
+ displayName: "Name",
3185
+ defaultValue: ""
3186
+ }
2788
3187
  ],
3188
+ outputs: [
3189
+ {
3190
+ name: "entity",
3191
+ type: "entity",
3192
+ displayName: "Entity"
3193
+ },
3194
+ {
3195
+ name: "found",
3196
+ type: "bool",
3197
+ displayName: "Found"
3198
+ }
3199
+ ]
3200
+ };
3201
+ var _FindEntityByNameExecutor = class _FindEntityByNameExecutor {
3202
+ execute(node, context) {
3203
+ const name = context.evaluateInput(node.id, "name", "");
3204
+ const entity = context.scene.findEntity(name);
3205
+ return {
3206
+ outputs: {
3207
+ entity: entity ?? null,
3208
+ found: entity != null
3209
+ }
3210
+ };
3211
+ }
3212
+ };
3213
+ __name(_FindEntityByNameExecutor, "FindEntityByNameExecutor");
3214
+ var FindEntityByNameExecutor = _FindEntityByNameExecutor;
3215
+ FindEntityByNameExecutor = _ts_decorate4([
3216
+ RegisterNode(FindEntityByNameTemplate)
3217
+ ], FindEntityByNameExecutor);
3218
+ var FindEntitiesByTagTemplate = {
3219
+ type: "ECS_FindEntitiesByTag",
3220
+ title: "Find Entities By Tag",
3221
+ category: "entity",
3222
+ color: "#1e5a8b",
2789
3223
  isPure: true,
2790
- inputs: [],
3224
+ description: "Finds all entities with a specific tag (\u67E5\u627E\u6240\u6709\u5177\u6709\u7279\u5B9A\u6807\u7B7E\u7684\u5B9E\u4F53)",
3225
+ keywords: [
3226
+ "entity",
3227
+ "find",
3228
+ "tag",
3229
+ "search",
3230
+ "get",
3231
+ "all"
3232
+ ],
3233
+ menuPath: [
3234
+ "ECS",
3235
+ "Entity",
3236
+ "Find By Tag"
3237
+ ],
3238
+ inputs: [
3239
+ {
3240
+ name: "tag",
3241
+ type: "int",
3242
+ displayName: "Tag",
3243
+ defaultValue: 0
3244
+ }
3245
+ ],
2791
3246
  outputs: [
2792
3247
  {
2793
- name: "time",
2794
- type: "float",
2795
- displayName: "Seconds"
3248
+ name: "entities",
3249
+ type: "array",
3250
+ displayName: "Entities",
3251
+ arrayType: "entity"
3252
+ },
3253
+ {
3254
+ name: "count",
3255
+ type: "int",
3256
+ displayName: "Count"
2796
3257
  }
2797
3258
  ]
2798
3259
  };
2799
- var _GetTimeExecutor = class _GetTimeExecutor {
2800
- execute(_node, context) {
3260
+ var _FindEntitiesByTagExecutor = class _FindEntitiesByTagExecutor {
3261
+ execute(node, context) {
3262
+ const tag = context.evaluateInput(node.id, "tag", 0);
3263
+ const entities = context.scene.findEntitiesByTag(tag);
2801
3264
  return {
2802
3265
  outputs: {
2803
- time: context.time
3266
+ entities,
3267
+ count: entities.length
2804
3268
  }
2805
3269
  };
2806
3270
  }
2807
3271
  };
2808
- __name(_GetTimeExecutor, "GetTimeExecutor");
2809
- var GetTimeExecutor = _GetTimeExecutor;
2810
- GetTimeExecutor = _ts_decorate11([
2811
- RegisterNode(GetTimeTemplate)
2812
- ], GetTimeExecutor);
2813
-
2814
- // src/nodes/time/Delay.ts
2815
- function _ts_decorate12(decorators, target, key, desc) {
2816
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2817
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2818
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2819
- return c > 3 && r && Object.defineProperty(target, key, r), r;
2820
- }
2821
- __name(_ts_decorate12, "_ts_decorate");
2822
- var DelayTemplate = {
2823
- type: "Delay",
2824
- title: "Delay",
2825
- category: "flow",
2826
- color: "#FFFFFF",
2827
- description: "Pauses execution for a specified number of seconds (\u6682\u505C\u6267\u884C\u6307\u5B9A\u7684\u79D2\u6570)",
3272
+ __name(_FindEntitiesByTagExecutor, "FindEntitiesByTagExecutor");
3273
+ var FindEntitiesByTagExecutor = _FindEntitiesByTagExecutor;
3274
+ FindEntitiesByTagExecutor = _ts_decorate4([
3275
+ RegisterNode(FindEntitiesByTagTemplate)
3276
+ ], FindEntitiesByTagExecutor);
3277
+ var GetEntityIdTemplate = {
3278
+ type: "ECS_GetEntityId",
3279
+ title: "Get Entity ID",
3280
+ category: "entity",
3281
+ color: "#1e5a8b",
3282
+ isPure: true,
3283
+ description: "Gets the unique ID of an entity (\u83B7\u53D6\u5B9E\u4F53\u7684\u552F\u4E00ID)",
2828
3284
  keywords: [
2829
- "wait",
2830
- "delay",
2831
- "pause",
2832
- "sleep",
2833
- "timer"
3285
+ "entity",
3286
+ "id",
3287
+ "identifier",
3288
+ "unique"
3289
+ ],
3290
+ menuPath: [
3291
+ "ECS",
3292
+ "Entity",
3293
+ "Get ID"
3294
+ ],
3295
+ inputs: [
3296
+ {
3297
+ name: "entity",
3298
+ type: "entity",
3299
+ displayName: "Entity"
3300
+ }
3301
+ ],
3302
+ outputs: [
3303
+ {
3304
+ name: "id",
3305
+ type: "int",
3306
+ displayName: "ID"
3307
+ }
3308
+ ]
3309
+ };
3310
+ var _GetEntityIdExecutor = class _GetEntityIdExecutor {
3311
+ execute(node, context) {
3312
+ const entity = context.evaluateInput(node.id, "entity", context.entity);
3313
+ return {
3314
+ outputs: {
3315
+ id: entity?.id ?? -1
3316
+ }
3317
+ };
3318
+ }
3319
+ };
3320
+ __name(_GetEntityIdExecutor, "GetEntityIdExecutor");
3321
+ var GetEntityIdExecutor = _GetEntityIdExecutor;
3322
+ GetEntityIdExecutor = _ts_decorate4([
3323
+ RegisterNode(GetEntityIdTemplate)
3324
+ ], GetEntityIdExecutor);
3325
+ var FindEntityByIdTemplate = {
3326
+ type: "ECS_FindEntityById",
3327
+ title: "Find Entity By ID",
3328
+ category: "entity",
3329
+ color: "#1e5a8b",
3330
+ isPure: true,
3331
+ description: "Finds an entity by its unique ID (\u901A\u8FC7\u552F\u4E00ID\u67E5\u627E\u5B9E\u4F53)",
3332
+ keywords: [
3333
+ "entity",
3334
+ "find",
3335
+ "id",
3336
+ "identifier"
3337
+ ],
3338
+ menuPath: [
3339
+ "ECS",
3340
+ "Entity",
3341
+ "Find By ID"
3342
+ ],
3343
+ inputs: [
3344
+ {
3345
+ name: "id",
3346
+ type: "int",
3347
+ displayName: "ID",
3348
+ defaultValue: 0
3349
+ }
3350
+ ],
3351
+ outputs: [
3352
+ {
3353
+ name: "entity",
3354
+ type: "entity",
3355
+ displayName: "Entity"
3356
+ },
3357
+ {
3358
+ name: "found",
3359
+ type: "bool",
3360
+ displayName: "Found"
3361
+ }
3362
+ ]
3363
+ };
3364
+ var _FindEntityByIdExecutor = class _FindEntityByIdExecutor {
3365
+ execute(node, context) {
3366
+ const id = context.evaluateInput(node.id, "id", 0);
3367
+ const entity = context.scene.findEntityById(id);
3368
+ return {
3369
+ outputs: {
3370
+ entity: entity ?? null,
3371
+ found: entity != null
3372
+ }
3373
+ };
3374
+ }
3375
+ };
3376
+ __name(_FindEntityByIdExecutor, "FindEntityByIdExecutor");
3377
+ var FindEntityByIdExecutor = _FindEntityByIdExecutor;
3378
+ FindEntityByIdExecutor = _ts_decorate4([
3379
+ RegisterNode(FindEntityByIdTemplate)
3380
+ ], FindEntityByIdExecutor);
3381
+
3382
+ // src/nodes/ecs/ComponentNodes.ts
3383
+ function _ts_decorate5(decorators, target, key, desc) {
3384
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3385
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3386
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3387
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
3388
+ }
3389
+ __name(_ts_decorate5, "_ts_decorate");
3390
+ var HasComponentTemplate = {
3391
+ type: "ECS_HasComponent",
3392
+ title: "Has Component",
3393
+ category: "component",
3394
+ color: "#1e8b8b",
3395
+ isPure: true,
3396
+ description: "Checks if an entity has a component of the specified type (\u68C0\u67E5\u5B9E\u4F53\u662F\u5426\u62E5\u6709\u6307\u5B9A\u7C7B\u578B\u7684\u7EC4\u4EF6)",
3397
+ keywords: [
3398
+ "component",
3399
+ "has",
3400
+ "check",
3401
+ "exists",
3402
+ "contains"
3403
+ ],
3404
+ menuPath: [
3405
+ "ECS",
3406
+ "Component",
3407
+ "Has Component"
3408
+ ],
3409
+ inputs: [
3410
+ {
3411
+ name: "entity",
3412
+ type: "entity",
3413
+ displayName: "Entity"
3414
+ },
3415
+ {
3416
+ name: "componentType",
3417
+ type: "string",
3418
+ displayName: "Component Type",
3419
+ defaultValue: ""
3420
+ }
3421
+ ],
3422
+ outputs: [
3423
+ {
3424
+ name: "hasComponent",
3425
+ type: "bool",
3426
+ displayName: "Has Component"
3427
+ }
3428
+ ]
3429
+ };
3430
+ var _HasComponentExecutor = class _HasComponentExecutor {
3431
+ execute(node, context) {
3432
+ const entity = context.evaluateInput(node.id, "entity", context.entity);
3433
+ const componentType = context.evaluateInput(node.id, "componentType", "");
3434
+ if (!entity || entity.isDestroyed || !componentType) {
3435
+ return {
3436
+ outputs: {
3437
+ hasComponent: false
3438
+ }
3439
+ };
3440
+ }
3441
+ const hasIt = entity.components.some((c) => c.constructor.name === componentType || c.constructor.__componentName__ === componentType);
3442
+ return {
3443
+ outputs: {
3444
+ hasComponent: hasIt
3445
+ }
3446
+ };
3447
+ }
3448
+ };
3449
+ __name(_HasComponentExecutor, "HasComponentExecutor");
3450
+ var HasComponentExecutor = _HasComponentExecutor;
3451
+ HasComponentExecutor = _ts_decorate5([
3452
+ RegisterNode(HasComponentTemplate)
3453
+ ], HasComponentExecutor);
3454
+ var GetComponentTemplate = {
3455
+ type: "ECS_GetComponent",
3456
+ title: "Get Component",
3457
+ category: "component",
3458
+ color: "#1e8b8b",
3459
+ isPure: true,
3460
+ description: "Gets a component from an entity by type name (\u6309\u7C7B\u578B\u540D\u79F0\u4ECE\u5B9E\u4F53\u83B7\u53D6\u7EC4\u4EF6)",
3461
+ keywords: [
3462
+ "component",
3463
+ "get",
3464
+ "find",
3465
+ "access"
3466
+ ],
3467
+ menuPath: [
3468
+ "ECS",
3469
+ "Component",
3470
+ "Get Component"
3471
+ ],
3472
+ inputs: [
3473
+ {
3474
+ name: "entity",
3475
+ type: "entity",
3476
+ displayName: "Entity"
3477
+ },
3478
+ {
3479
+ name: "componentType",
3480
+ type: "string",
3481
+ displayName: "Component Type",
3482
+ defaultValue: ""
3483
+ }
3484
+ ],
3485
+ outputs: [
3486
+ {
3487
+ name: "component",
3488
+ type: "component",
3489
+ displayName: "Component"
3490
+ },
3491
+ {
3492
+ name: "found",
3493
+ type: "bool",
3494
+ displayName: "Found"
3495
+ }
3496
+ ]
3497
+ };
3498
+ var _GetComponentExecutor = class _GetComponentExecutor {
3499
+ execute(node, context) {
3500
+ const entity = context.evaluateInput(node.id, "entity", context.entity);
3501
+ const componentType = context.evaluateInput(node.id, "componentType", "");
3502
+ if (!entity || entity.isDestroyed || !componentType) {
3503
+ return {
3504
+ outputs: {
3505
+ component: null,
3506
+ found: false
3507
+ }
3508
+ };
3509
+ }
3510
+ const component = entity.components.find((c) => c.constructor.name === componentType || c.constructor.__componentName__ === componentType);
3511
+ return {
3512
+ outputs: {
3513
+ component: component ?? null,
3514
+ found: component != null
3515
+ }
3516
+ };
3517
+ }
3518
+ };
3519
+ __name(_GetComponentExecutor, "GetComponentExecutor");
3520
+ var GetComponentExecutor = _GetComponentExecutor;
3521
+ GetComponentExecutor = _ts_decorate5([
3522
+ RegisterNode(GetComponentTemplate)
3523
+ ], GetComponentExecutor);
3524
+ var GetAllComponentsTemplate = {
3525
+ type: "ECS_GetAllComponents",
3526
+ title: "Get All Components",
3527
+ category: "component",
3528
+ color: "#1e8b8b",
3529
+ isPure: true,
3530
+ description: "Gets all components from an entity (\u83B7\u53D6\u5B9E\u4F53\u7684\u6240\u6709\u7EC4\u4EF6)",
3531
+ keywords: [
3532
+ "component",
3533
+ "get",
3534
+ "all",
3535
+ "list"
3536
+ ],
3537
+ menuPath: [
3538
+ "ECS",
3539
+ "Component",
3540
+ "Get All Components"
3541
+ ],
3542
+ inputs: [
3543
+ {
3544
+ name: "entity",
3545
+ type: "entity",
3546
+ displayName: "Entity"
3547
+ }
3548
+ ],
3549
+ outputs: [
3550
+ {
3551
+ name: "components",
3552
+ type: "array",
3553
+ displayName: "Components",
3554
+ arrayType: "component"
3555
+ },
3556
+ {
3557
+ name: "count",
3558
+ type: "int",
3559
+ displayName: "Count"
3560
+ }
3561
+ ]
3562
+ };
3563
+ var _GetAllComponentsExecutor = class _GetAllComponentsExecutor {
3564
+ execute(node, context) {
3565
+ const entity = context.evaluateInput(node.id, "entity", context.entity);
3566
+ if (!entity || entity.isDestroyed) {
3567
+ return {
3568
+ outputs: {
3569
+ components: [],
3570
+ count: 0
3571
+ }
3572
+ };
3573
+ }
3574
+ const components = [
3575
+ ...entity.components
3576
+ ];
3577
+ return {
3578
+ outputs: {
3579
+ components,
3580
+ count: components.length
3581
+ }
3582
+ };
3583
+ }
3584
+ };
3585
+ __name(_GetAllComponentsExecutor, "GetAllComponentsExecutor");
3586
+ var GetAllComponentsExecutor = _GetAllComponentsExecutor;
3587
+ GetAllComponentsExecutor = _ts_decorate5([
3588
+ RegisterNode(GetAllComponentsTemplate)
3589
+ ], GetAllComponentsExecutor);
3590
+ var RemoveComponentTemplate = {
3591
+ type: "ECS_RemoveComponent",
3592
+ title: "Remove Component",
3593
+ category: "component",
3594
+ color: "#8b1e1e",
3595
+ description: "Removes a component from an entity (\u4ECE\u5B9E\u4F53\u79FB\u9664\u7EC4\u4EF6)",
3596
+ keywords: [
3597
+ "component",
3598
+ "remove",
3599
+ "delete",
3600
+ "destroy"
3601
+ ],
3602
+ menuPath: [
3603
+ "ECS",
3604
+ "Component",
3605
+ "Remove Component"
3606
+ ],
3607
+ inputs: [
3608
+ {
3609
+ name: "exec",
3610
+ type: "exec",
3611
+ displayName: ""
3612
+ },
3613
+ {
3614
+ name: "entity",
3615
+ type: "entity",
3616
+ displayName: "Entity"
3617
+ },
3618
+ {
3619
+ name: "componentType",
3620
+ type: "string",
3621
+ displayName: "Component Type",
3622
+ defaultValue: ""
3623
+ }
3624
+ ],
3625
+ outputs: [
3626
+ {
3627
+ name: "exec",
3628
+ type: "exec",
3629
+ displayName: ""
3630
+ },
3631
+ {
3632
+ name: "removed",
3633
+ type: "bool",
3634
+ displayName: "Removed"
3635
+ }
3636
+ ]
3637
+ };
3638
+ var _RemoveComponentExecutor = class _RemoveComponentExecutor {
3639
+ execute(node, context) {
3640
+ const entity = context.evaluateInput(node.id, "entity", context.entity);
3641
+ const componentType = context.evaluateInput(node.id, "componentType", "");
3642
+ if (!entity || entity.isDestroyed || !componentType) {
3643
+ return {
3644
+ outputs: {
3645
+ removed: false
3646
+ },
3647
+ nextExec: "exec"
3648
+ };
3649
+ }
3650
+ const component = entity.components.find((c) => c.constructor.name === componentType || c.constructor.__componentName__ === componentType);
3651
+ if (component) {
3652
+ entity.removeComponent(component);
3653
+ return {
3654
+ outputs: {
3655
+ removed: true
3656
+ },
3657
+ nextExec: "exec"
3658
+ };
3659
+ }
3660
+ return {
3661
+ outputs: {
3662
+ removed: false
3663
+ },
3664
+ nextExec: "exec"
3665
+ };
3666
+ }
3667
+ };
3668
+ __name(_RemoveComponentExecutor, "RemoveComponentExecutor");
3669
+ var RemoveComponentExecutor = _RemoveComponentExecutor;
3670
+ RemoveComponentExecutor = _ts_decorate5([
3671
+ RegisterNode(RemoveComponentTemplate)
3672
+ ], RemoveComponentExecutor);
3673
+ var GetComponentPropertyTemplate = {
3674
+ type: "ECS_GetComponentProperty",
3675
+ title: "Get Component Property",
3676
+ category: "component",
3677
+ color: "#1e8b8b",
3678
+ isPure: true,
3679
+ description: "Gets a property value from a component (\u4ECE\u7EC4\u4EF6\u83B7\u53D6\u5C5E\u6027\u503C)",
3680
+ keywords: [
3681
+ "component",
3682
+ "property",
3683
+ "get",
3684
+ "value",
3685
+ "field"
3686
+ ],
3687
+ menuPath: [
3688
+ "ECS",
3689
+ "Component",
3690
+ "Get Property"
3691
+ ],
3692
+ inputs: [
3693
+ {
3694
+ name: "component",
3695
+ type: "component",
3696
+ displayName: "Component"
3697
+ },
3698
+ {
3699
+ name: "propertyName",
3700
+ type: "string",
3701
+ displayName: "Property Name",
3702
+ defaultValue: ""
3703
+ }
3704
+ ],
3705
+ outputs: [
3706
+ {
3707
+ name: "value",
3708
+ type: "any",
3709
+ displayName: "Value"
3710
+ },
3711
+ {
3712
+ name: "found",
3713
+ type: "bool",
3714
+ displayName: "Found"
3715
+ }
3716
+ ]
3717
+ };
3718
+ var _GetComponentPropertyExecutor = class _GetComponentPropertyExecutor {
3719
+ execute(node, context) {
3720
+ const component = context.evaluateInput(node.id, "component", null);
3721
+ const propertyName = context.evaluateInput(node.id, "propertyName", "");
3722
+ if (!component || !propertyName) {
3723
+ return {
3724
+ outputs: {
3725
+ value: null,
3726
+ found: false
3727
+ }
3728
+ };
3729
+ }
3730
+ if (propertyName in component) {
3731
+ return {
3732
+ outputs: {
3733
+ value: component[propertyName],
3734
+ found: true
3735
+ }
3736
+ };
3737
+ }
3738
+ return {
3739
+ outputs: {
3740
+ value: null,
3741
+ found: false
3742
+ }
3743
+ };
3744
+ }
3745
+ };
3746
+ __name(_GetComponentPropertyExecutor, "GetComponentPropertyExecutor");
3747
+ var GetComponentPropertyExecutor = _GetComponentPropertyExecutor;
3748
+ GetComponentPropertyExecutor = _ts_decorate5([
3749
+ RegisterNode(GetComponentPropertyTemplate)
3750
+ ], GetComponentPropertyExecutor);
3751
+ var SetComponentPropertyTemplate = {
3752
+ type: "ECS_SetComponentProperty",
3753
+ title: "Set Component Property",
3754
+ category: "component",
3755
+ color: "#1e8b8b",
3756
+ description: "Sets a property value on a component (\u8BBE\u7F6E\u7EC4\u4EF6\u7684\u5C5E\u6027\u503C)",
3757
+ keywords: [
3758
+ "component",
3759
+ "property",
3760
+ "set",
3761
+ "value",
3762
+ "field",
3763
+ "modify"
3764
+ ],
3765
+ menuPath: [
3766
+ "ECS",
3767
+ "Component",
3768
+ "Set Property"
3769
+ ],
3770
+ inputs: [
3771
+ {
3772
+ name: "exec",
3773
+ type: "exec",
3774
+ displayName: ""
3775
+ },
3776
+ {
3777
+ name: "component",
3778
+ type: "component",
3779
+ displayName: "Component"
3780
+ },
3781
+ {
3782
+ name: "propertyName",
3783
+ type: "string",
3784
+ displayName: "Property Name",
3785
+ defaultValue: ""
3786
+ },
3787
+ {
3788
+ name: "value",
3789
+ type: "any",
3790
+ displayName: "Value"
3791
+ }
3792
+ ],
3793
+ outputs: [
3794
+ {
3795
+ name: "exec",
3796
+ type: "exec",
3797
+ displayName: ""
3798
+ },
3799
+ {
3800
+ name: "success",
3801
+ type: "bool",
3802
+ displayName: "Success"
3803
+ }
3804
+ ]
3805
+ };
3806
+ var _SetComponentPropertyExecutor = class _SetComponentPropertyExecutor {
3807
+ execute(node, context) {
3808
+ const component = context.evaluateInput(node.id, "component", null);
3809
+ const propertyName = context.evaluateInput(node.id, "propertyName", "");
3810
+ const value = context.evaluateInput(node.id, "value", null);
3811
+ if (!component || !propertyName) {
3812
+ return {
3813
+ outputs: {
3814
+ success: false
3815
+ },
3816
+ nextExec: "exec"
3817
+ };
3818
+ }
3819
+ if (propertyName in component) {
3820
+ component[propertyName] = value;
3821
+ return {
3822
+ outputs: {
3823
+ success: true
3824
+ },
3825
+ nextExec: "exec"
3826
+ };
3827
+ }
3828
+ return {
3829
+ outputs: {
3830
+ success: false
3831
+ },
3832
+ nextExec: "exec"
3833
+ };
3834
+ }
3835
+ };
3836
+ __name(_SetComponentPropertyExecutor, "SetComponentPropertyExecutor");
3837
+ var SetComponentPropertyExecutor = _SetComponentPropertyExecutor;
3838
+ SetComponentPropertyExecutor = _ts_decorate5([
3839
+ RegisterNode(SetComponentPropertyTemplate)
3840
+ ], SetComponentPropertyExecutor);
3841
+ var GetComponentTypeNameTemplate = {
3842
+ type: "ECS_GetComponentTypeName",
3843
+ title: "Get Component Type",
3844
+ category: "component",
3845
+ color: "#1e8b8b",
3846
+ isPure: true,
3847
+ description: "Gets the type name of a component (\u83B7\u53D6\u7EC4\u4EF6\u7684\u7C7B\u578B\u540D\u79F0)",
3848
+ keywords: [
3849
+ "component",
3850
+ "type",
3851
+ "name",
3852
+ "class"
3853
+ ],
3854
+ menuPath: [
3855
+ "ECS",
3856
+ "Component",
3857
+ "Get Type Name"
3858
+ ],
3859
+ inputs: [
3860
+ {
3861
+ name: "component",
3862
+ type: "component",
3863
+ displayName: "Component"
3864
+ }
3865
+ ],
3866
+ outputs: [
3867
+ {
3868
+ name: "typeName",
3869
+ type: "string",
3870
+ displayName: "Type Name"
3871
+ }
3872
+ ]
3873
+ };
3874
+ var _GetComponentTypeNameExecutor = class _GetComponentTypeNameExecutor {
3875
+ execute(node, context) {
3876
+ const component = context.evaluateInput(node.id, "component", null);
3877
+ if (!component) {
3878
+ return {
3879
+ outputs: {
3880
+ typeName: ""
3881
+ }
3882
+ };
3883
+ }
3884
+ const typeName = component.constructor.__componentName__ ?? component.constructor.name;
3885
+ return {
3886
+ outputs: {
3887
+ typeName
3888
+ }
3889
+ };
3890
+ }
3891
+ };
3892
+ __name(_GetComponentTypeNameExecutor, "GetComponentTypeNameExecutor");
3893
+ var GetComponentTypeNameExecutor = _GetComponentTypeNameExecutor;
3894
+ GetComponentTypeNameExecutor = _ts_decorate5([
3895
+ RegisterNode(GetComponentTypeNameTemplate)
3896
+ ], GetComponentTypeNameExecutor);
3897
+ var GetEntityFromComponentTemplate = {
3898
+ type: "ECS_GetEntityFromComponent",
3899
+ title: "Get Owner Entity",
3900
+ category: "component",
3901
+ color: "#1e8b8b",
3902
+ isPure: true,
3903
+ description: "Gets the entity that owns a component (\u83B7\u53D6\u62E5\u6709\u7EC4\u4EF6\u7684\u5B9E\u4F53)",
3904
+ keywords: [
3905
+ "component",
3906
+ "entity",
3907
+ "owner",
3908
+ "parent"
3909
+ ],
3910
+ menuPath: [
3911
+ "ECS",
3912
+ "Component",
3913
+ "Get Owner Entity"
3914
+ ],
3915
+ inputs: [
3916
+ {
3917
+ name: "component",
3918
+ type: "component",
3919
+ displayName: "Component"
3920
+ }
3921
+ ],
3922
+ outputs: [
3923
+ {
3924
+ name: "entity",
3925
+ type: "entity",
3926
+ displayName: "Entity"
3927
+ },
3928
+ {
3929
+ name: "found",
3930
+ type: "bool",
3931
+ displayName: "Found"
3932
+ }
3933
+ ]
3934
+ };
3935
+ var _GetEntityFromComponentExecutor = class _GetEntityFromComponentExecutor {
3936
+ execute(node, context) {
3937
+ const component = context.evaluateInput(node.id, "component", null);
3938
+ if (!component || component.entityId == null) {
3939
+ return {
3940
+ outputs: {
3941
+ entity: null,
3942
+ found: false
3943
+ }
3944
+ };
3945
+ }
3946
+ const entity = context.scene.findEntityById(component.entityId);
3947
+ return {
3948
+ outputs: {
3949
+ entity: entity ?? null,
3950
+ found: entity != null
3951
+ }
3952
+ };
3953
+ }
3954
+ };
3955
+ __name(_GetEntityFromComponentExecutor, "GetEntityFromComponentExecutor");
3956
+ var GetEntityFromComponentExecutor = _GetEntityFromComponentExecutor;
3957
+ GetEntityFromComponentExecutor = _ts_decorate5([
3958
+ RegisterNode(GetEntityFromComponentTemplate)
3959
+ ], GetEntityFromComponentExecutor);
3960
+
3961
+ // src/nodes/ecs/FlowNodes.ts
3962
+ function _ts_decorate6(decorators, target, key, desc) {
3963
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3964
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3965
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3966
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
3967
+ }
3968
+ __name(_ts_decorate6, "_ts_decorate");
3969
+ var BranchTemplate = {
3970
+ type: "Flow_Branch",
3971
+ title: "Branch",
3972
+ category: "flow",
3973
+ color: "#4a4a4a",
3974
+ description: "Executes one of two paths based on a condition (\u6839\u636E\u6761\u4EF6\u6267\u884C\u4E24\u6761\u8DEF\u5F84\u4E4B\u4E00)",
3975
+ keywords: [
3976
+ "if",
3977
+ "branch",
3978
+ "condition",
3979
+ "switch",
3980
+ "else"
3981
+ ],
3982
+ menuPath: [
3983
+ "Flow",
3984
+ "Branch"
3985
+ ],
3986
+ inputs: [
3987
+ {
3988
+ name: "exec",
3989
+ type: "exec",
3990
+ displayName: ""
3991
+ },
3992
+ {
3993
+ name: "condition",
3994
+ type: "bool",
3995
+ displayName: "Condition",
3996
+ defaultValue: false
3997
+ }
3998
+ ],
3999
+ outputs: [
4000
+ {
4001
+ name: "true",
4002
+ type: "exec",
4003
+ displayName: "True"
4004
+ },
4005
+ {
4006
+ name: "false",
4007
+ type: "exec",
4008
+ displayName: "False"
4009
+ }
4010
+ ]
4011
+ };
4012
+ var _BranchExecutor = class _BranchExecutor {
4013
+ execute(node, context) {
4014
+ const condition2 = context.evaluateInput(node.id, "condition", false);
4015
+ return {
4016
+ nextExec: condition2 ? "true" : "false"
4017
+ };
4018
+ }
4019
+ };
4020
+ __name(_BranchExecutor, "BranchExecutor");
4021
+ var BranchExecutor = _BranchExecutor;
4022
+ BranchExecutor = _ts_decorate6([
4023
+ RegisterNode(BranchTemplate)
4024
+ ], BranchExecutor);
4025
+ var SequenceTemplate = {
4026
+ type: "Flow_Sequence",
4027
+ title: "Sequence",
4028
+ category: "flow",
4029
+ color: "#4a4a4a",
4030
+ description: "Executes multiple outputs in order (\u6309\u987A\u5E8F\u6267\u884C\u591A\u4E2A\u8F93\u51FA)",
4031
+ keywords: [
4032
+ "sequence",
4033
+ "order",
4034
+ "serial",
4035
+ "chain"
4036
+ ],
4037
+ menuPath: [
4038
+ "Flow",
4039
+ "Sequence"
4040
+ ],
4041
+ inputs: [
4042
+ {
4043
+ name: "exec",
4044
+ type: "exec",
4045
+ displayName: ""
4046
+ }
4047
+ ],
4048
+ outputs: [
4049
+ {
4050
+ name: "then0",
4051
+ type: "exec",
4052
+ displayName: "Then 0"
4053
+ },
4054
+ {
4055
+ name: "then1",
4056
+ type: "exec",
4057
+ displayName: "Then 1"
4058
+ },
4059
+ {
4060
+ name: "then2",
4061
+ type: "exec",
4062
+ displayName: "Then 2"
4063
+ },
4064
+ {
4065
+ name: "then3",
4066
+ type: "exec",
4067
+ displayName: "Then 3"
4068
+ }
4069
+ ]
4070
+ };
4071
+ var _SequenceExecutor = class _SequenceExecutor {
4072
+ constructor() {
4073
+ __publicField(this, "currentIndex", 0);
4074
+ }
4075
+ execute(_node, _context) {
4076
+ const outputs = [
4077
+ "then0",
4078
+ "then1",
4079
+ "then2",
4080
+ "then3"
4081
+ ];
4082
+ const nextPin = outputs[this.currentIndex];
4083
+ this.currentIndex = (this.currentIndex + 1) % outputs.length;
4084
+ if (this.currentIndex === 0) {
4085
+ return {
4086
+ nextExec: null
4087
+ };
4088
+ }
4089
+ return {
4090
+ nextExec: nextPin
4091
+ };
4092
+ }
4093
+ };
4094
+ __name(_SequenceExecutor, "SequenceExecutor");
4095
+ var SequenceExecutor = _SequenceExecutor;
4096
+ SequenceExecutor = _ts_decorate6([
4097
+ RegisterNode(SequenceTemplate)
4098
+ ], SequenceExecutor);
4099
+ var DoOnceTemplate = {
4100
+ type: "Flow_DoOnce",
4101
+ title: "Do Once",
4102
+ category: "flow",
4103
+ color: "#4a4a4a",
4104
+ description: "Executes the output only once, subsequent calls are ignored (\u53EA\u6267\u884C\u4E00\u6B21\uFF0C\u540E\u7EED\u8C03\u7528\u88AB\u5FFD\u7565)",
4105
+ keywords: [
4106
+ "once",
4107
+ "single",
4108
+ "first",
4109
+ "one"
4110
+ ],
4111
+ menuPath: [
4112
+ "Flow",
4113
+ "Do Once"
4114
+ ],
4115
+ inputs: [
4116
+ {
4117
+ name: "exec",
4118
+ type: "exec",
4119
+ displayName: ""
4120
+ },
4121
+ {
4122
+ name: "reset",
4123
+ type: "exec",
4124
+ displayName: "Reset"
4125
+ }
4126
+ ],
4127
+ outputs: [
4128
+ {
4129
+ name: "exec",
4130
+ type: "exec",
4131
+ displayName: ""
4132
+ }
4133
+ ]
4134
+ };
4135
+ var _DoOnceExecutor = class _DoOnceExecutor {
4136
+ constructor() {
4137
+ __publicField(this, "executed", false);
4138
+ }
4139
+ execute(node, _context) {
4140
+ const inputPin = node.data._lastInputPin;
4141
+ if (inputPin === "reset") {
4142
+ this.executed = false;
4143
+ return {
4144
+ nextExec: null
4145
+ };
4146
+ }
4147
+ if (this.executed) {
4148
+ return {
4149
+ nextExec: null
4150
+ };
4151
+ }
4152
+ this.executed = true;
4153
+ return {
4154
+ nextExec: "exec"
4155
+ };
4156
+ }
4157
+ };
4158
+ __name(_DoOnceExecutor, "DoOnceExecutor");
4159
+ var DoOnceExecutor = _DoOnceExecutor;
4160
+ DoOnceExecutor = _ts_decorate6([
4161
+ RegisterNode(DoOnceTemplate)
4162
+ ], DoOnceExecutor);
4163
+ var FlipFlopTemplate = {
4164
+ type: "Flow_FlipFlop",
4165
+ title: "Flip Flop",
4166
+ category: "flow",
4167
+ color: "#4a4a4a",
4168
+ description: "Alternates between two outputs on each execution (\u6BCF\u6B21\u6267\u884C\u65F6\u5728\u4E24\u4E2A\u8F93\u51FA\u4E4B\u95F4\u4EA4\u66FF)",
4169
+ keywords: [
4170
+ "flip",
4171
+ "flop",
4172
+ "toggle",
4173
+ "alternate",
4174
+ "switch"
4175
+ ],
4176
+ menuPath: [
4177
+ "Flow",
4178
+ "Flip Flop"
4179
+ ],
4180
+ inputs: [
4181
+ {
4182
+ name: "exec",
4183
+ type: "exec",
4184
+ displayName: ""
4185
+ }
4186
+ ],
4187
+ outputs: [
4188
+ {
4189
+ name: "a",
4190
+ type: "exec",
4191
+ displayName: "A"
4192
+ },
4193
+ {
4194
+ name: "b",
4195
+ type: "exec",
4196
+ displayName: "B"
4197
+ },
4198
+ {
4199
+ name: "isA",
4200
+ type: "bool",
4201
+ displayName: "Is A"
4202
+ }
4203
+ ]
4204
+ };
4205
+ var _FlipFlopExecutor = class _FlipFlopExecutor {
4206
+ constructor() {
4207
+ __publicField(this, "isA", true);
4208
+ }
4209
+ execute(_node, _context) {
4210
+ const currentIsA = this.isA;
4211
+ this.isA = !this.isA;
4212
+ return {
4213
+ outputs: {
4214
+ isA: currentIsA
4215
+ },
4216
+ nextExec: currentIsA ? "a" : "b"
4217
+ };
4218
+ }
4219
+ };
4220
+ __name(_FlipFlopExecutor, "FlipFlopExecutor");
4221
+ var FlipFlopExecutor = _FlipFlopExecutor;
4222
+ FlipFlopExecutor = _ts_decorate6([
4223
+ RegisterNode(FlipFlopTemplate)
4224
+ ], FlipFlopExecutor);
4225
+ var GateTemplate = {
4226
+ type: "Flow_Gate",
4227
+ title: "Gate",
4228
+ category: "flow",
4229
+ color: "#4a4a4a",
4230
+ description: "Controls execution flow with open/close state (\u901A\u8FC7\u5F00/\u5173\u72B6\u6001\u63A7\u5236\u6267\u884C\u6D41)",
4231
+ keywords: [
4232
+ "gate",
4233
+ "open",
4234
+ "close",
4235
+ "block",
4236
+ "allow"
4237
+ ],
4238
+ menuPath: [
4239
+ "Flow",
4240
+ "Gate"
4241
+ ],
4242
+ inputs: [
4243
+ {
4244
+ name: "exec",
4245
+ type: "exec",
4246
+ displayName: "Enter"
4247
+ },
4248
+ {
4249
+ name: "open",
4250
+ type: "exec",
4251
+ displayName: "Open"
4252
+ },
4253
+ {
4254
+ name: "close",
4255
+ type: "exec",
4256
+ displayName: "Close"
4257
+ },
4258
+ {
4259
+ name: "toggle",
4260
+ type: "exec",
4261
+ displayName: "Toggle"
4262
+ },
4263
+ {
4264
+ name: "startOpen",
4265
+ type: "bool",
4266
+ displayName: "Start Open",
4267
+ defaultValue: true
4268
+ }
4269
+ ],
4270
+ outputs: [
4271
+ {
4272
+ name: "exec",
4273
+ type: "exec",
4274
+ displayName: "Exit"
4275
+ }
4276
+ ]
4277
+ };
4278
+ var _GateExecutor = class _GateExecutor {
4279
+ constructor() {
4280
+ __publicField(this, "isOpen", null);
4281
+ }
4282
+ execute(node, context) {
4283
+ if (this.isOpen === null) {
4284
+ this.isOpen = context.evaluateInput(node.id, "startOpen", true);
4285
+ }
4286
+ const inputPin = node.data._lastInputPin;
4287
+ switch (inputPin) {
4288
+ case "open":
4289
+ this.isOpen = true;
4290
+ return {
4291
+ nextExec: null
4292
+ };
4293
+ case "close":
4294
+ this.isOpen = false;
4295
+ return {
4296
+ nextExec: null
4297
+ };
4298
+ case "toggle":
4299
+ this.isOpen = !this.isOpen;
4300
+ return {
4301
+ nextExec: null
4302
+ };
4303
+ default:
4304
+ return {
4305
+ nextExec: this.isOpen ? "exec" : null
4306
+ };
4307
+ }
4308
+ }
4309
+ };
4310
+ __name(_GateExecutor, "GateExecutor");
4311
+ var GateExecutor = _GateExecutor;
4312
+ GateExecutor = _ts_decorate6([
4313
+ RegisterNode(GateTemplate)
4314
+ ], GateExecutor);
4315
+ var ForLoopTemplate = {
4316
+ type: "Flow_ForLoop",
4317
+ title: "For Loop",
4318
+ category: "flow",
4319
+ color: "#4a4a4a",
4320
+ description: "Executes the loop body for each index in range (\u5BF9\u8303\u56F4\u5185\u7684\u6BCF\u4E2A\u7D22\u5F15\u6267\u884C\u5FAA\u73AF\u4F53)",
4321
+ keywords: [
4322
+ "for",
4323
+ "loop",
4324
+ "iterate",
4325
+ "repeat",
4326
+ "count"
4327
+ ],
4328
+ menuPath: [
4329
+ "Flow",
4330
+ "For Loop"
4331
+ ],
4332
+ inputs: [
4333
+ {
4334
+ name: "exec",
4335
+ type: "exec",
4336
+ displayName: ""
4337
+ },
4338
+ {
4339
+ name: "start",
4340
+ type: "int",
4341
+ displayName: "Start",
4342
+ defaultValue: 0
4343
+ },
4344
+ {
4345
+ name: "end",
4346
+ type: "int",
4347
+ displayName: "End",
4348
+ defaultValue: 10
4349
+ }
4350
+ ],
4351
+ outputs: [
4352
+ {
4353
+ name: "loopBody",
4354
+ type: "exec",
4355
+ displayName: "Loop Body"
4356
+ },
4357
+ {
4358
+ name: "completed",
4359
+ type: "exec",
4360
+ displayName: "Completed"
4361
+ },
4362
+ {
4363
+ name: "index",
4364
+ type: "int",
4365
+ displayName: "Index"
4366
+ }
4367
+ ]
4368
+ };
4369
+ var _ForLoopExecutor = class _ForLoopExecutor {
4370
+ constructor() {
4371
+ __publicField(this, "currentIndex", 0);
4372
+ __publicField(this, "endIndex", 0);
4373
+ __publicField(this, "isRunning", false);
4374
+ }
4375
+ execute(node, context) {
4376
+ if (!this.isRunning) {
4377
+ this.currentIndex = context.evaluateInput(node.id, "start", 0);
4378
+ this.endIndex = context.evaluateInput(node.id, "end", 10);
4379
+ this.isRunning = true;
4380
+ }
4381
+ if (this.currentIndex < this.endIndex) {
4382
+ const index = this.currentIndex;
4383
+ this.currentIndex++;
4384
+ return {
4385
+ outputs: {
4386
+ index
4387
+ },
4388
+ nextExec: "loopBody"
4389
+ };
4390
+ }
4391
+ this.isRunning = false;
4392
+ return {
4393
+ outputs: {
4394
+ index: this.endIndex
4395
+ },
4396
+ nextExec: "completed"
4397
+ };
4398
+ }
4399
+ };
4400
+ __name(_ForLoopExecutor, "ForLoopExecutor");
4401
+ var ForLoopExecutor = _ForLoopExecutor;
4402
+ ForLoopExecutor = _ts_decorate6([
4403
+ RegisterNode(ForLoopTemplate)
4404
+ ], ForLoopExecutor);
4405
+ var WhileLoopTemplate = {
4406
+ type: "Flow_WhileLoop",
4407
+ title: "While Loop",
4408
+ category: "flow",
4409
+ color: "#4a4a4a",
4410
+ description: "Executes the loop body while condition is true (\u5F53\u6761\u4EF6\u4E3A\u771F\u65F6\u6267\u884C\u5FAA\u73AF\u4F53)",
4411
+ keywords: [
4412
+ "while",
4413
+ "loop",
4414
+ "repeat",
4415
+ "condition"
4416
+ ],
4417
+ menuPath: [
4418
+ "Flow",
4419
+ "While Loop"
2834
4420
  ],
2835
4421
  inputs: [
2836
4422
  {
@@ -2839,43 +4425,52 @@ var DelayTemplate = {
2839
4425
  displayName: ""
2840
4426
  },
2841
4427
  {
2842
- name: "duration",
2843
- type: "float",
2844
- displayName: "Duration",
2845
- defaultValue: 1
4428
+ name: "condition",
4429
+ type: "bool",
4430
+ displayName: "Condition",
4431
+ defaultValue: true
2846
4432
  }
2847
4433
  ],
2848
4434
  outputs: [
2849
4435
  {
2850
- name: "exec",
4436
+ name: "loopBody",
4437
+ type: "exec",
4438
+ displayName: "Loop Body"
4439
+ },
4440
+ {
4441
+ name: "completed",
2851
4442
  type: "exec",
2852
4443
  displayName: "Completed"
2853
4444
  }
2854
4445
  ]
2855
4446
  };
2856
- var _DelayExecutor = class _DelayExecutor {
4447
+ var _WhileLoopExecutor = class _WhileLoopExecutor {
2857
4448
  execute(node, context) {
2858
- const duration = context.evaluateInput(node.id, "duration", 1);
4449
+ const condition2 = context.evaluateInput(node.id, "condition", true);
4450
+ if (condition2) {
4451
+ return {
4452
+ nextExec: "loopBody"
4453
+ };
4454
+ }
2859
4455
  return {
2860
- nextExec: "exec",
2861
- delay: duration
4456
+ nextExec: "completed"
2862
4457
  };
2863
4458
  }
2864
4459
  };
2865
- __name(_DelayExecutor, "DelayExecutor");
2866
- var DelayExecutor = _DelayExecutor;
2867
- DelayExecutor = _ts_decorate12([
2868
- RegisterNode(DelayTemplate)
2869
- ], DelayExecutor);
4460
+ __name(_WhileLoopExecutor, "WhileLoopExecutor");
4461
+ var WhileLoopExecutor = _WhileLoopExecutor;
4462
+ WhileLoopExecutor = _ts_decorate6([
4463
+ RegisterNode(WhileLoopTemplate)
4464
+ ], WhileLoopExecutor);
2870
4465
 
2871
4466
  // src/nodes/math/MathOperations.ts
2872
- function _ts_decorate13(decorators, target, key, desc) {
4467
+ function _ts_decorate7(decorators, target, key, desc) {
2873
4468
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2874
4469
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2875
4470
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2876
4471
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2877
4472
  }
2878
- __name(_ts_decorate13, "_ts_decorate");
4473
+ __name(_ts_decorate7, "_ts_decorate");
2879
4474
  var AddTemplate = {
2880
4475
  type: "Add",
2881
4476
  title: "Add",
@@ -2925,7 +4520,7 @@ var _AddExecutor = class _AddExecutor {
2925
4520
  };
2926
4521
  __name(_AddExecutor, "AddExecutor");
2927
4522
  var AddExecutor = _AddExecutor;
2928
- AddExecutor = _ts_decorate13([
4523
+ AddExecutor = _ts_decorate7([
2929
4524
  RegisterNode(AddTemplate)
2930
4525
  ], AddExecutor);
2931
4526
  var SubtractTemplate = {
@@ -2976,7 +4571,7 @@ var _SubtractExecutor = class _SubtractExecutor {
2976
4571
  };
2977
4572
  __name(_SubtractExecutor, "SubtractExecutor");
2978
4573
  var SubtractExecutor = _SubtractExecutor;
2979
- SubtractExecutor = _ts_decorate13([
4574
+ SubtractExecutor = _ts_decorate7([
2980
4575
  RegisterNode(SubtractTemplate)
2981
4576
  ], SubtractExecutor);
2982
4577
  var MultiplyTemplate = {
@@ -3027,7 +4622,7 @@ var _MultiplyExecutor = class _MultiplyExecutor {
3027
4622
  };
3028
4623
  __name(_MultiplyExecutor, "MultiplyExecutor");
3029
4624
  var MultiplyExecutor = _MultiplyExecutor;
3030
- MultiplyExecutor = _ts_decorate13([
4625
+ MultiplyExecutor = _ts_decorate7([
3031
4626
  RegisterNode(MultiplyTemplate)
3032
4627
  ], MultiplyExecutor);
3033
4628
  var DivideTemplate = {
@@ -3084,14 +4679,248 @@ var _DivideExecutor = class _DivideExecutor {
3084
4679
  };
3085
4680
  __name(_DivideExecutor, "DivideExecutor");
3086
4681
  var DivideExecutor = _DivideExecutor;
3087
- DivideExecutor = _ts_decorate13([
4682
+ DivideExecutor = _ts_decorate7([
3088
4683
  RegisterNode(DivideTemplate)
3089
4684
  ], DivideExecutor);
4685
+
4686
+ // src/nodes/time/GetDeltaTime.ts
4687
+ function _ts_decorate8(decorators, target, key, desc) {
4688
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4689
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4690
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4691
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
4692
+ }
4693
+ __name(_ts_decorate8, "_ts_decorate");
4694
+ var GetDeltaTimeTemplate = {
4695
+ type: "GetDeltaTime",
4696
+ title: "Get Delta Time",
4697
+ category: "time",
4698
+ color: "#4FC3F7",
4699
+ description: "Returns the time elapsed since the last frame in seconds (\u8FD4\u56DE\u4E0A\u4E00\u5E27\u4EE5\u6765\u7ECF\u8FC7\u7684\u65F6\u95F4\uFF0C\u5355\u4F4D\u79D2)",
4700
+ keywords: [
4701
+ "delta",
4702
+ "time",
4703
+ "frame",
4704
+ "dt"
4705
+ ],
4706
+ isPure: true,
4707
+ inputs: [],
4708
+ outputs: [
4709
+ {
4710
+ name: "deltaTime",
4711
+ type: "float",
4712
+ displayName: "Delta Seconds"
4713
+ }
4714
+ ]
4715
+ };
4716
+ var _GetDeltaTimeExecutor = class _GetDeltaTimeExecutor {
4717
+ execute(_node, context) {
4718
+ return {
4719
+ outputs: {
4720
+ deltaTime: context.deltaTime
4721
+ }
4722
+ };
4723
+ }
4724
+ };
4725
+ __name(_GetDeltaTimeExecutor, "GetDeltaTimeExecutor");
4726
+ var GetDeltaTimeExecutor = _GetDeltaTimeExecutor;
4727
+ GetDeltaTimeExecutor = _ts_decorate8([
4728
+ RegisterNode(GetDeltaTimeTemplate)
4729
+ ], GetDeltaTimeExecutor);
4730
+
4731
+ // src/nodes/time/GetTime.ts
4732
+ function _ts_decorate9(decorators, target, key, desc) {
4733
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4734
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4735
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4736
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
4737
+ }
4738
+ __name(_ts_decorate9, "_ts_decorate");
4739
+ var GetTimeTemplate = {
4740
+ type: "GetTime",
4741
+ title: "Get Game Time",
4742
+ category: "time",
4743
+ color: "#4FC3F7",
4744
+ description: "Returns the total time since the blueprint started in seconds (\u8FD4\u56DE\u84DD\u56FE\u542F\u52A8\u4EE5\u6765\u7684\u603B\u65F6\u95F4\uFF0C\u5355\u4F4D\u79D2)",
4745
+ keywords: [
4746
+ "time",
4747
+ "total",
4748
+ "elapsed",
4749
+ "game"
4750
+ ],
4751
+ isPure: true,
4752
+ inputs: [],
4753
+ outputs: [
4754
+ {
4755
+ name: "time",
4756
+ type: "float",
4757
+ displayName: "Seconds"
4758
+ }
4759
+ ]
4760
+ };
4761
+ var _GetTimeExecutor = class _GetTimeExecutor {
4762
+ execute(_node, context) {
4763
+ return {
4764
+ outputs: {
4765
+ time: context.time
4766
+ }
4767
+ };
4768
+ }
4769
+ };
4770
+ __name(_GetTimeExecutor, "GetTimeExecutor");
4771
+ var GetTimeExecutor = _GetTimeExecutor;
4772
+ GetTimeExecutor = _ts_decorate9([
4773
+ RegisterNode(GetTimeTemplate)
4774
+ ], GetTimeExecutor);
4775
+
4776
+ // src/nodes/time/Delay.ts
4777
+ function _ts_decorate10(decorators, target, key, desc) {
4778
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4779
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4780
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4781
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
4782
+ }
4783
+ __name(_ts_decorate10, "_ts_decorate");
4784
+ var DelayTemplate = {
4785
+ type: "Delay",
4786
+ title: "Delay",
4787
+ category: "flow",
4788
+ color: "#FFFFFF",
4789
+ description: "Pauses execution for a specified number of seconds (\u6682\u505C\u6267\u884C\u6307\u5B9A\u7684\u79D2\u6570)",
4790
+ keywords: [
4791
+ "wait",
4792
+ "delay",
4793
+ "pause",
4794
+ "sleep",
4795
+ "timer"
4796
+ ],
4797
+ inputs: [
4798
+ {
4799
+ name: "exec",
4800
+ type: "exec",
4801
+ displayName: ""
4802
+ },
4803
+ {
4804
+ name: "duration",
4805
+ type: "float",
4806
+ displayName: "Duration",
4807
+ defaultValue: 1
4808
+ }
4809
+ ],
4810
+ outputs: [
4811
+ {
4812
+ name: "exec",
4813
+ type: "exec",
4814
+ displayName: "Completed"
4815
+ }
4816
+ ]
4817
+ };
4818
+ var _DelayExecutor = class _DelayExecutor {
4819
+ execute(node, context) {
4820
+ const duration = context.evaluateInput(node.id, "duration", 1);
4821
+ return {
4822
+ nextExec: "exec",
4823
+ delay: duration
4824
+ };
4825
+ }
4826
+ };
4827
+ __name(_DelayExecutor, "DelayExecutor");
4828
+ var DelayExecutor = _DelayExecutor;
4829
+ DelayExecutor = _ts_decorate10([
4830
+ RegisterNode(DelayTemplate)
4831
+ ], DelayExecutor);
4832
+
4833
+ // src/nodes/debug/Print.ts
4834
+ function _ts_decorate11(decorators, target, key, desc) {
4835
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4836
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4837
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4838
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
4839
+ }
4840
+ __name(_ts_decorate11, "_ts_decorate");
4841
+ var PrintTemplate = {
4842
+ type: "Print",
4843
+ title: "Print String",
4844
+ category: "debug",
4845
+ color: "#785EF0",
4846
+ description: "Prints a message to the console for debugging (\u6253\u5370\u6D88\u606F\u5230\u63A7\u5236\u53F0\u7528\u4E8E\u8C03\u8BD5)",
4847
+ keywords: [
4848
+ "log",
4849
+ "debug",
4850
+ "console",
4851
+ "output",
4852
+ "print"
4853
+ ],
4854
+ inputs: [
4855
+ {
4856
+ name: "exec",
4857
+ type: "exec",
4858
+ displayName: ""
4859
+ },
4860
+ {
4861
+ name: "message",
4862
+ type: "string",
4863
+ displayName: "Message",
4864
+ defaultValue: "Hello Blueprint!"
4865
+ },
4866
+ {
4867
+ name: "printToScreen",
4868
+ type: "bool",
4869
+ displayName: "Print to Screen",
4870
+ defaultValue: true
4871
+ },
4872
+ {
4873
+ name: "duration",
4874
+ type: "float",
4875
+ displayName: "Duration",
4876
+ defaultValue: 2
4877
+ }
4878
+ ],
4879
+ outputs: [
4880
+ {
4881
+ name: "exec",
4882
+ type: "exec",
4883
+ displayName: ""
4884
+ }
4885
+ ]
4886
+ };
4887
+ var _PrintExecutor = class _PrintExecutor {
4888
+ execute(node, context) {
4889
+ const message = context.evaluateInput(node.id, "message", "Hello Blueprint!");
4890
+ const printToScreen = context.evaluateInput(node.id, "printToScreen", true);
4891
+ const duration = context.evaluateInput(node.id, "duration", 2);
4892
+ console.log(`[Blueprint] ${message}`);
4893
+ if (printToScreen) {
4894
+ const event = new CustomEvent("blueprint:print", {
4895
+ detail: {
4896
+ message: String(message),
4897
+ duration: Number(duration),
4898
+ entityId: context.entity.id,
4899
+ entityName: context.entity.name
4900
+ }
4901
+ });
4902
+ if (typeof window !== "undefined") {
4903
+ window.dispatchEvent(event);
4904
+ }
4905
+ }
4906
+ return {
4907
+ nextExec: "exec"
4908
+ };
4909
+ }
4910
+ };
4911
+ __name(_PrintExecutor, "PrintExecutor");
4912
+ var PrintExecutor = _PrintExecutor;
4913
+ PrintExecutor = _ts_decorate11([
4914
+ RegisterNode(PrintTemplate)
4915
+ ], PrintExecutor);
3090
4916
  export {
3091
4917
  AlwaysFalseCondition,
3092
4918
  AlwaysTrueCondition,
3093
4919
  BlueprintComposer,
4920
+ BlueprintExpose,
3094
4921
  BlueprintFragment,
4922
+ BlueprintMethod,
4923
+ BlueprintProperty,
3095
4924
  BlueprintTrigger,
3096
4925
  BlueprintVM,
3097
4926
  CollisionEntityCondition,
@@ -3116,6 +4945,7 @@ export {
3116
4945
  TriggerTypes,
3117
4946
  arePinTypesCompatible,
3118
4947
  cleanupBlueprint,
4948
+ clearRegisteredComponents,
3119
4949
  condition,
3120
4950
  createBlueprintComponentData,
3121
4951
  createBlueprintSystem,
@@ -3145,9 +4975,15 @@ export {
3145
4975
  defaultFragmentRegistry,
3146
4976
  fragmentFromAsset,
3147
4977
  fragmentToAsset,
4978
+ generateComponentNodes,
4979
+ getBlueprintMetadata,
3148
4980
  getNodeCategoryColor,
3149
4981
  getPinTypeColor,
4982
+ getRegisteredBlueprintComponents,
4983
+ inferPinType,
3150
4984
  initializeBlueprintVM,
4985
+ registerAllComponentNodes,
4986
+ registerComponentNodes,
3151
4987
  startBlueprint,
3152
4988
  stopBlueprint,
3153
4989
  tickBlueprint,