mirror of
https://github.com/litruv/picoGraph.git
synced 2026-07-24 10:46:06 +10:00
Initial commit
moved from private version control
This commit is contained in:
39
scripts/nodes/library/graphics/fget.js
Normal file
39
scripts/nodes/library/graphics/fget.js
Normal file
@@ -0,0 +1,39 @@
|
||||
import { createNodeModule } from "../../nodeTypes.js";
|
||||
|
||||
/**
|
||||
* Reads sprite flag data.
|
||||
*/
|
||||
export const fgetNode = createNodeModule(
|
||||
{
|
||||
id: "graphics_fget",
|
||||
title: "Get Sprite Flag",
|
||||
category: "Graphics",
|
||||
description: "Retrieve the bitfield or specific flag value for a sprite.",
|
||||
searchTags: ["fget", "flag", "sprite", "meta"],
|
||||
inputs: [
|
||||
{
|
||||
id: "sprite",
|
||||
name: "Sprite",
|
||||
direction: "input",
|
||||
kind: "number",
|
||||
defaultValue: 0,
|
||||
},
|
||||
{ id: "flag", name: "Flag", direction: "input", kind: "number" },
|
||||
],
|
||||
outputs: [
|
||||
{ id: "value", name: "Value", direction: "output", kind: "number" },
|
||||
],
|
||||
properties: [],
|
||||
},
|
||||
{
|
||||
evaluateValue: ({ resolveValueInput }) => {
|
||||
const OMIT = "__pg_omit__";
|
||||
const sprite = resolveValueInput("sprite", "0");
|
||||
const flag = resolveValueInput("flag", OMIT);
|
||||
if (flag === OMIT) {
|
||||
return `fget(${sprite})`;
|
||||
}
|
||||
return `fget(${sprite}, ${flag})`;
|
||||
},
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user