update to node site

This commit is contained in:
2026-04-15 05:02:45 +10:00
parent 3c45406f6f
commit 7e7e6f2c22
710 changed files with 10532 additions and 8324 deletions

View File

@@ -0,0 +1,40 @@
/**
* @file BindEventNode.js
* @UCLASS(BlueprintType, Blueprintable)
*/
import { NodeBase } from './NodeBase.js';
import { NodeRegistry } from './NodeRegistry.js';
/**
* @UCLASS(BlueprintType)
* Binds the OnMessage event on a ChatNode. When a message arrives, updates
* the username/message output pins and fires the event_out exec pin.
*/
export class BindEventNode extends NodeBase {
/** @UCLASS(BlueprintType) */
static NodeType = "bind_event";
/**
* @UFUNCTION(BlueprintCallable)
* @param {import('./NodeExecutionContext.js').NodeExecutionContext} ctx
*/
async BlueprintCallable_Execute(ctx) {
const chatInstance = ctx.BlueprintPure_ResolveInput("target");
const node = ctx.BlueprintPure_GetNode();
if (!chatInstance || typeof chatInstance.setOnMessage !== "function" || !node) return;
chatInstance.setOnMessage((username, message) => {
const usernamePin = node.outputs.find(p => p.id === "username");
const messagePin = node.outputs.find(p => p.id === "message");
if (usernamePin) usernamePin.defaultValue = username;
if (messagePin) messagePin.defaultValue = message;
// Fire event_out — async, fire-and-forget
ctx.BlueprintCallable_RunExecPin("event_out").catch(console.error);
});
}
}
NodeRegistry.UCLASS_Register(BindEventNode);