Skip to content

Commit

Permalink
Fixed introduced bug and added better logging (#1071)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasBrostrom authored Nov 7, 2023
1 parent 2700bef commit 829a46b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
10 changes: 6 additions & 4 deletions cScripts/functions/gear/fn_gear_applyLoadout.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if (_loadConfig) then {
_config = missionConfigFile >> "CfgLoadouts" >> _loadout;
_scope = getNumber (_config >> "scope");
if (_scope == 0) exitWith {
SHOW_CHAT_WARNING_3("Gear", "Scope for loadout %1 is %2 and will not be applied to %3", _loadout, _scope, _unit)
SHOW_CHAT_WARNING_4("Gear", "Scope for loadout %1 is %2 and will not be applied to %3 [%4]", _loadout, _scope, _unit, typeOf _unit);
};
_unit setVariable [QEGVAR(Gear,LoadoutClass), _loadout];

Expand All @@ -45,14 +45,15 @@ if (_loadConfig) then {

// preLoadout
if (_loadConfig) then {
INFO_2("Gear", "Applying preLoadout for %1 [%2]", _unit, typeOf _unit);
[_unit, _loadout] call compile (getText (_config >> "preLoadout"));
};

// Set loadout
switch (true) do {
case _loadArray: {
[_unit, _loadout] call CBA_fnc_setLoadout;
INFO("Gear", "Loadout array applied to %1", _unit);
INFO_2("Gear", "Loadout array applied to %1 [%2]", _unit, typeOf _unit);
};
case _loadConfig: {
_loadout = getText (_config >> "loadout");
Expand All @@ -61,7 +62,7 @@ switch (true) do {
_loadout = parseSimpleArray _loadout;
if (EGVAR(patches,usesACRE)) then { _loadout = [_loadout] call acre_api_fnc_filterUnitLoadout };
[_unit, _loadout] call CBA_fnc_setLoadout;
INFO_2("Gear", "Loadout %1 applied to %2", _classname, _unit);
INFO_3("Gear", "Loadout config %1 applied to %2 [%3]", _classname, _unit, typeOf _unit);
} else {
SHOW_CHAT_WARNING_1("Gear", "No loadout discoverd nothing will be applied for %1.", _unit);
};
Expand All @@ -75,7 +76,7 @@ if (!_loadArray) then {
};

// Functions
if (GVAR(isPlayer)) exitWith {
if (GVAR(isPlayer)) then {
call EFUNC(gear,applyFunctions);
};

Expand All @@ -90,5 +91,6 @@ if !(weaponLowered _unit) then {_unit action ["WeaponOnBack", _unit]};


if (_loadConfig) then {
INFO_2("Gear", "Applying postLoadout code for %1 [%2]", _unit, typeOf _unit);
[_unit, _loadout] call compile (getText (_config >> "postLoadout"));
};
8 changes: 1 addition & 7 deletions cScripts/functions/init/fn_init_eventHandlers.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ if (GVAR(isPlayer)) then {
// _this params ["_zeus"];
//}] call CBA_fnc_addEventHandler;


// CavArsenal
["ace_arsenal_displayClosed", {
if (GVAR(StagingArsenalOpen)) then {
Expand All @@ -61,9 +60,6 @@ if (GVAR(isPlayer)) then {
call EFUNC(init,aceArsenalDefault);

}] call CBA_fnc_addEventHandler;



};


Expand All @@ -80,6 +76,4 @@ INFO("InitEventHandlers","Creating Server EventHandlers");
private _playerLog = missionNamespace getVariable [QEGVAR(log,players), []];
_playerLog pushBack _playerName;
missionNamespace setVariable [QEGVAR(log,players), _playerLog];
}] call CBA_fnc_addEventHandler;


}] call CBA_fnc_addEventHandler;

0 comments on commit 829a46b

Please sign in to comment.