ready for dedi -- improvements to resupply, triageIcons too

This commit is contained in:
2024-02-06 17:36:01 -08:00
parent 0a64d9e170
commit 91b982e06e
44 changed files with 586 additions and 354 deletions

View File

@@ -16,11 +16,29 @@ private _supplyCrateTypesCfgs = _supplyCratesCfg call BIS_fnc_returnChildren;
{
// add scroll wheel action to spawn different supply box types
private _arsenalBox = _x;
// always remove old actions if they exist
private _actionIDs = _arsenalBox getVariable [QGVAR(supplyCrateActionIDs), []];
{
_arsenalBox removeAction _x;
} forEach _actionIDs;
_arsenalBox setVariable [QGVAR(supplyCrateActionIDs), []];
// if setting disabled, skip adding actions
if (not (
[QGVAR(setting_allowSupplyBoxScrollWheelSpawning)] call CBA_settings_fnc_get
)) then {continue};
{ // add an action for each supply crate type
private _cfg = _x;
private _supplyCrateDisplayName = (_cfg >> "displayName") call BIS_fnc_getCfgData;
_arsenalBox addAction [format ["<t color='#ffffff'>Spawn %1</t>", _supplyCrateDisplayName], {
private _actionID = _arsenalBox addAction [format ["<t color='#ffffff'>Spawn %1</t>", _supplyCrateDisplayName], {
params ["_target", "_caller", "_actionId", "_arguments"];
_arguments params ["_supplyCrateCfg"];
[
@@ -29,5 +47,6 @@ private _supplyCrateTypesCfgs = _supplyCratesCfg call BIS_fnc_returnChildren;
getPos _target
] call FUNC(createBox);
}, [_cfg], 0, false, true, "", ""];
(_arsenalBox getVariable [QGVAR(supplyCrateActionIDs), []]) pushBack _actionID;
} forEach _supplyCrateTypesCfgs;
} forEach _arsenalBoxes;

View File

@@ -13,6 +13,10 @@
QGVAR(setting_allowSupplyBoxScrollWheelSpawning),
_value
] call EFUNC(common,logSettingChanged);
if (_value && hasInterface && time > 0) then {
[] call FUNC(addArsenalObjectSpawnBoxActions);
};
},
true // requires mission restart
] call CBA_fnc_addSetting;

View File

@@ -1,12 +0,0 @@
#include "..\script_component.hpp"
// 5 seconds after the client is loaded, add the resupply action to all arsenal boxes
[
{time > 5},
{
if (missionNamespace getVariable [
QGVAR(setting_allowSupplyBoxScrollWheelSpawning),
false
]) then {call FUNC(addSpawnBoxActions)}
}
] call CBA_fnc_waitUntilAndExecute;

View File

@@ -0,0 +1,13 @@
#include "..\script_component.hpp"
if (!hasInterface) exitWith {};
call FUNC(addArsenalObjectSpawnBoxActions);
[
LEVEL_DEBUG,
QUOTE(COMPONENT),
"postInit complete",
[]
] call EFUNC(common,log);
localNamespace setVariable [QGVAR(complete), true];