Skip to main content

Validator

Evaluates prerequisites and unlock conditions.

Functions

validateCostAgainstConfig

Validator.validateCostAgainstConfig(
costCostMap,--

Per-currency spends from node config

configuredCurrencies{string}--

SkillTreeConfig.currencies

) → UnlockResult

Ensures node cost keys are allowed currencies with finite nonnegative amounts (server authoritative).

validateReferencedNodeIds

Validator.validateReferencedNodeIds(
nodeNodeConfig,
allNodes{[string]NodeConfig}
) → UnlockResult

Rejects malformed configs where prerequisites reference unknown node ids.

canUnlock

Validator.canUnlock(
playerIdstring,--

The UserId as a string

nodeNodeConfig,--

The node being evaluated

statePlayerSkillState,--

The player's current state

allNodes{[string]NodeConfig}--

All nodes in the tree

) → UnlockResult

Validates if a player can unlock a node.

checkExclusivity

Validator.checkExclusivity(
nodeNodeConfig,--

The node being evaluated

statePlayerSkillState,--

The player's current state

allNodes{[string]NodeConfig}--

All nodes in the tree

) → UnlockResult

Checks if a node is in an exclusive group and if so, if any siblings are unlocked.

checkCapstone

Validator.checkCapstone(
nodeNodeConfig,--

The node being evaluated

statePlayerSkillState,--

The player's current state

allNodes{[string]NodeConfig}--

All nodes in the tree

) → UnlockResult

Checks if a node is a capstone and if all prior tier nodes are unlocked.

Show raw api
{
    "functions": [
        {
            "name": "validateCostAgainstConfig",
            "desc": "Ensures node cost keys are allowed currencies with finite nonnegative amounts (server authoritative).",
            "params": [
                {
                    "name": "cost",
                    "desc": "Per-currency spends from node config",
                    "lua_type": "CostMap"
                },
                {
                    "name": "configuredCurrencies",
                    "desc": "`SkillTreeConfig.currencies`",
                    "lua_type": "{ string }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "UnlockResult"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 19,
                "path": "src/Validator.luau"
            }
        },
        {
            "name": "validateReferencedNodeIds",
            "desc": "Rejects malformed configs where prerequisites reference unknown node ids.",
            "params": [
                {
                    "name": "node",
                    "desc": "",
                    "lua_type": "NodeConfig"
                },
                {
                    "name": "allNodes",
                    "desc": "",
                    "lua_type": "{ [string]: NodeConfig }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "UnlockResult"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 48,
                "path": "src/Validator.luau"
            }
        },
        {
            "name": "canUnlock",
            "desc": "Validates if a player can unlock a node.",
            "params": [
                {
                    "name": "playerId",
                    "desc": "The UserId as a string",
                    "lua_type": "string"
                },
                {
                    "name": "node",
                    "desc": "The node being evaluated",
                    "lua_type": "NodeConfig"
                },
                {
                    "name": "state",
                    "desc": "The player's current state",
                    "lua_type": "PlayerSkillState"
                },
                {
                    "name": "allNodes",
                    "desc": "All nodes in the tree",
                    "lua_type": "{ [string]: NodeConfig }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "UnlockResult"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 88,
                "path": "src/Validator.luau"
            }
        },
        {
            "name": "checkExclusivity",
            "desc": "Checks if a node is in an exclusive group and if so, if any siblings are unlocked.",
            "params": [
                {
                    "name": "node",
                    "desc": "The node being evaluated",
                    "lua_type": "NodeConfig"
                },
                {
                    "name": "state",
                    "desc": "The player's current state",
                    "lua_type": "PlayerSkillState"
                },
                {
                    "name": "allNodes",
                    "desc": "All nodes in the tree",
                    "lua_type": "{ [string]: NodeConfig }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "UnlockResult"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 158,
                "path": "src/Validator.luau"
            }
        },
        {
            "name": "checkCapstone",
            "desc": "Checks if a node is a capstone and if all prior tier nodes are unlocked.",
            "params": [
                {
                    "name": "node",
                    "desc": "The node being evaluated",
                    "lua_type": "NodeConfig"
                },
                {
                    "name": "state",
                    "desc": "The player's current state",
                    "lua_type": "PlayerSkillState"
                },
                {
                    "name": "allNodes",
                    "desc": "All nodes in the tree",
                    "lua_type": "{ [string]: NodeConfig }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "UnlockResult"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 191,
                "path": "src/Validator.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Validator",
    "desc": "Evaluates prerequisites and unlock conditions.",
    "source": {
        "line": 13,
        "path": "src/Validator.luau"
    }
}