forge/arma/server/addons/extension/functions/fnc_setHandler.sqf
Jacob Schmidt ebfe77a340 feat: implement complete Forge framework with Rust/Redis backend and Arma 3 integration
Implemented features:
- High-performance Rust extension with Redis persistence
- Actor/player management with loadout, position, and state tracking
- Banking system with deposit, withdraw, and transfer operations
- Physical and virtual garage/locker systems for vehicle and equipment storage
- Organization management with member tracking and permissions
- Client-side UI with React-like state management
- Server-side event-driven architecture with CBA Events
- Security: Self-transfer prevention at multiple layers
- Logging system with per-module log files
- ICOM module for inter-server communication

Co-Authored-By: Warp <agent@warp.dev>
2026-01-04 12:52:15 -06:00

46 lines
1.3 KiB
Plaintext

#include "..\script_component.hpp"
/*
* File: fnc_setHandler.sqf
* Author: IDSolutions
* Date: 2026-01-03
* Last Update: 2026-01-03
* Public: No
*
* Description:
* Set handler for extension function callbacks.
*
* Parameter(s):
* 0: Function name to handle callbacks <STRING>
* 1: Callback function to use as handler <CODE>
* 2: Arguments to pass to callback function <ARRAY>
*
* Returns:
* Handler was set <BOOL>
*
* Example(s):
* ["actor:greet", {
* params ["_message"];
* private _player = _arguments select 0;
* systemChat format ["Hello, %1! %2", name _player, _message];
* }, [player]] call forge_x_component_fnc_setHandler;
*/
params [["_function", "", [""]], ["_callback", {}, [{}]], ["_arguments", [], [[]]]];
if (_function isEqualTo "") exitWith {
["WARNING", "Function not specified, handler not set!", nil, nil] call EFUNC(common,log);
false
};
if (_callback isEqualTo {}) exitWith {
["WARNING", "Callback not specified, handler not set!", nil, nil] call EFUNC(common,log);
false
};
if (isNil QGVAR(handlers)) then { GVAR(handlers) = createHashMap; };
private _entry = format ["forge_server:%1", _function];
GVAR(handlers) set [_entry, [_callback, _arguments]];
["INFO", format ["Handler set: %1", _entry], nil, nil] call EFUNC(common,log);
true