## Summary This finishes the org credit line workflow so it behaves like reserved treasury-backed credit instead of a simple member allowance. ## What changed - reserve org funds immediately when a credit line is assigned - track credit lines with: - approved amount - available amount - outstanding principal - interest rate - amount due - consume reserved credit during store checkout without charging org funds a second time - add credit line repayment through the bank app - sync richer credit line state into org and bank payloads/UI - keep legacy `amount` compatibility mapped to available credit for older consumers ## User-facing behavior - assigning a credit line now reduces available org funds immediately - spending on `credit_line` reduces available credit and creates debt with interest - the bank app now shows outstanding credit debt and allows repayment from personal bank funds - the org treasury view now shows reserved credit and outstanding due totals ## Validation - `cargo fmt` - `npm run build:webui` - `cargo test -p forge-services --quiet` - `cargo test -p forge-server --quiet` ## Follow-up checks - validate in-game that assigning a credit line reduces org funds immediately - validate store checkout with `credit_line` updates available credit and debt correctly - validate bank repayment decreases player bank balance, increases org funds, and reduces amount due Co-authored-by: Jacob Schmidt <innovativestudios@outlook.com> Reviewed-on: #2
96 lines
3.1 KiB
Plaintext
96 lines
3.1 KiB
Plaintext
#include "..\script_component.hpp"
|
|
|
|
/*
|
|
* File: fnc_openVG.sqf
|
|
* Author: IDSolutions
|
|
* Date: 2025-12-16
|
|
* Last Update: 2026-01-30
|
|
* Public: No
|
|
*
|
|
* Description:
|
|
* Opens the Virtual Garage.
|
|
*
|
|
* Arguments:
|
|
* None
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* call forge_client_garage_fnc_openVG
|
|
*/
|
|
|
|
private _locations = (missionConfigFile >> "FORGE_CfgGarages" >> "locations") call BFUNC(getCfgData);
|
|
{
|
|
FORGE_VehSpawnPos = (_x select 1) getPos [5, (_x select 2)];
|
|
true;
|
|
} count _locations;
|
|
|
|
BIS_fnc_garage_center = createVehicle ["Land_HelipadEmpty_F", FORGE_VehSpawnPos, [], 0, "NONE"];
|
|
BIS_fnc_garage_centerType = getText (configFile >> "CfgVehicles" >> "B_Quadbike_01_F" >> "model");
|
|
|
|
if !(GVAR(isPreLoaded)) then {
|
|
[missionNamespace, "garageOpened", {
|
|
params ["_display", "_toggleSpace"];
|
|
|
|
missionNamespace setVariable ["BIS_fnc_garage_data", [
|
|
GVAR(Cars),
|
|
GVAR(Armor),
|
|
GVAR(Helis),
|
|
GVAR(Planes),
|
|
GVAR(Naval),
|
|
GVAR(Other)
|
|
]];
|
|
|
|
{
|
|
lbClear (_display displayCtrl (960 + _forEachIndex));
|
|
} forEach BIS_fnc_garage_data;
|
|
|
|
_display displayAddEventHandler ["KeyDown", "_this select 3"];
|
|
{ (_display displayCtrl _x) ctrlShow false } forEach [44151, 44150, 44146, 44147, 44148, 44149, 44346, 44347, 978];
|
|
|
|
["ListAdd", [_display]] call BFUNC(garage);
|
|
}] call BFUNC(addScriptedEventHandler);
|
|
|
|
[missionNamespace, "garageClosed", {
|
|
private _nearestObjects = BIS_fnc_garage_center nearEntities [["Car","Tank","Air","Ship"], 15];
|
|
|
|
if (!isNil "_nearestObjects") then {
|
|
private _obj = _nearestObjects select 0;
|
|
private _veh = typeOf _obj;
|
|
private _textures = getObjectTextures _obj;
|
|
private _animationNames = animationNames _obj;
|
|
|
|
{ deleteVehicle _x } forEach _nearestObjects;
|
|
private _createVehicle = createVehicle [_veh, FORGE_VehSpawnPos, [], 0, "CAN_COLLIDE"];
|
|
|
|
if (_textures isNotEqualTo []) then {
|
|
private _count = 0;
|
|
{
|
|
_createVehicle setObjectTextureGlobal [_count, _x];
|
|
_count = _count + 1;
|
|
} forEach _textures;
|
|
};
|
|
|
|
if (_animationNames isNotEqualTo []) then {
|
|
private _animationPhase = [];
|
|
|
|
for "_i" from 0 to count _animationNames -1 do {
|
|
_animationPhase pushBack [_animationNames select _i, _obj animationPhase (_animationNames select _i)];
|
|
{ _createVehicle animate _x; } forEach _animationPhase;
|
|
};
|
|
};
|
|
};
|
|
}] call BFUNC(addScriptedEventHandler);
|
|
|
|
GVAR(isPreLoaded) = true;
|
|
};
|
|
|
|
private _nearVehicles = FORGE_VehSpawnPos nearEntities [["Car", "Tank", "Air", "Ship"], 5];
|
|
if (_nearVehicles isNotEqualTo []) exitWith {
|
|
private _params = ["warning", "Virtual Garage", "Vehicle spawn position is blocked. Please move the vehicle before accessing the garage.", 3000];
|
|
EGVAR(notifications,NotificationService) call ["create", _params];
|
|
};
|
|
|
|
["Open", true] call BFUNC(garage);
|