MCPcopy Create free account
hub / github.com/esengine/esengine / execute

Method execute

packages/effect/src/nodes/EffectNodes.ts:50–84  ·  view source on GitHub ↗
(node: BlueprintNode, context: unknown)

Source from the content-addressed store, hash-verified

48
49export class ApplyEffectExecutor implements INodeExecutor {
50 execute(node: BlueprintNode, context: unknown): ExecutionResult {
51 const ctx = context as EffectContext;
52 const effectTypeId = ctx.evaluateInput(node.id, 'effectTypeId', '') as string;
53 const duration = ctx.evaluateInput(node.id, 'duration', 0) as number;
54 const sourceId = ctx.evaluateInput(node.id, 'sourceId', '') as string;
55
56 const container = ctx.getEffectContainer();
57 if (!container || !effectTypeId) {
58 return {
59 outputs: { success: false, instanceId: '' },
60 nextExec: 'exec'
61 };
62 }
63
64 // Create a basic effect definition
65 const definition: IEffectDefinition = {
66 typeId: effectTypeId,
67 displayName: effectTypeId,
68 tags: [],
69 duration: duration > 0
70 ? { type: 'timed', duration, remainingTime: duration }
71 : { type: 'permanent' },
72 stacking: { rule: 'refresh' }
73 };
74
75 const instance = container.apply(definition, sourceId || undefined);
76
77 return {
78 outputs: {
79 success: instance !== null,
80 instanceId: instance?.instanceId ?? ''
81 },
82 nextExec: 'exec'
83 };
84 }
85}
86
87// =============================================================================

Callers

nothing calls this directly

Calls 3

getEffectContainerMethod · 0.80
evaluateInputMethod · 0.65
applyMethod · 0.45

Tested by

no test coverage detected