forge/docus/content/2.server-extension/2.usage-examples.md
Jacob Schmidt 827f3303a2 feat: add initial Docus setup and sync tool for documentation generation
- Created package.json for Docus with necessary scripts and dependencies.
- Implemented sync-docus-docs.mjs to automate the generation of documentation files from source markdown.
- Defined mappings for generated pages and virtual routes to ensure proper linking in documentation.
- Added static content files for the documentation structure, including navigation and index pages.
2026-04-21 16:07:27 -05:00

1.2 KiB

Forge Server Usage Examples

These examples use the domain command surface exposed by the extension. Persistence is handled by the server through SurrealDB.

Status Check

["status", []] call forge_server_extension_fnc_extCall params ["_status", "_ok"];
if (_ok && {_status isEqualTo "connected"}) then {
    systemChat "Forge persistence is online.";
};

Actor Fetch

private _uid = getPlayerUID player;
["actor:get", [_uid]] call forge_server_extension_fnc_extCall params ["_payload", "_ok"];
if (_ok) then {
    private _actor = fromJSON _payload;
    systemChat format ["Loaded actor %1", _actor getOrDefault ["uid", _uid]];
};

Store Checkout

private _checkout = createHashMapFromArray [
    ["requesterUid", getPlayerUID player],
    ["requesterName", name player],
    ["orgId", "default"],
    ["requesterIsDefaultOrgCeo", false],
    ["paymentMethod", "bank"],
    ["items", [
        createHashMapFromArray [
            ["classname", "FirstAidKit"],
            ["category", "item"],
            ["priceValue", 50],
            ["quantity", 2]
        ]
    ]],
    ["vehicles", []]
];

["store:checkout", [toJSON _checkout]] call forge_server_extension_fnc_extCall;