Skip to content

Commit

Permalink
Fixed and improved staging and loadout selection process (#1099)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasBrostrom authored Dec 10, 2023
1 parent 9b6ae23 commit 2805898
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 30 deletions.
2 changes: 1 addition & 1 deletion cScripts/functions/init/fn_init_staging.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ player addEventHandler ["InventoryClosed", {
[player, _category] call FUNC(addReGear);
if !(GVAR(OneLife)) then {[player, _category] call FUNC(addHeal)};
[player, _category] call FUNC(addInsigniaSelectionList);
[player, true, "ACE_SelfActions"] call FUNC(setupLoadoutSelection);
[player, "ACE_SelfActions", false] call FUNC(setupLoadoutSelection);
[_category] call FUNC(addArsenal);

INFO_1("Staging", "Staging options for %1 have been setup.", name player)
2 changes: 1 addition & 1 deletion cScripts/functions/mission/fn_addBaseCrate.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ params [

if (_object isKindOf "Man") exitWith {false};

[_object, _type, true, true, true, true, false, true] call FUNC(doStarterCrate);
[_object, _type, true, true, true, false, false, true] call FUNC(doStarterCrate);

true
10 changes: 5 additions & 5 deletions cScripts/functions/mission/fn_doStarterCrate.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* 2: ReGear action <BOOL> (Default: true)
* 3: Heal action <BOOL> (Default: true)
* 4: Insignia Selection <BOOL> (Default: true)
* 5: Company variable <BOOL> (Default: true)
* 5: Show all Loadouts <BOOL> (Default: false)
* 6: Arsenal <BOOL> (Default: false)
* 7: Staging <BOOL> (Default: true)
*
Expand All @@ -20,8 +20,8 @@
* Example:
* [this] call cScripts_fnc_doStarterCrate;
* [this,"none",true] call cScripts_fnc_doStarterCrate;
* [this,"none",true,true,true,true,false] call cScripts_fnc_doStarterCrate;
* [this,"none",true,true,true,true,false,true] call cScripts_fnc_doStarterCrate;
* [this,"none",true,true,true,false,false] call cScripts_fnc_doStarterCrate;
* [this,"none",true,true,true,false,false,true] call cScripts_fnc_doStarterCrate;
*
*/

Expand All @@ -31,7 +31,7 @@ params [
["_reGearOption", true, [true]],
["_reHealOption", true, [true]],
["_InsigniaSelectOption", true, [true]],
["_allowOnlyForCompany", true, [true]],
["_allowAllLoadouts", false, [false]],
["_arsenal", false, [false]], // not used
["_hasStagingZone", true, [true]]
];
Expand Down Expand Up @@ -71,7 +71,7 @@ if (_reHealOption) then {
};

// Call Quick Selection
[_object, _allowOnlyForCompany] call FUNC(setupLoadoutSelection);
[_object, "ACE_MainActions", _allowAllLoadouts] call FUNC(setupLoadoutSelection);

// Call Insignia Selection
if (_InsigniaSelectOption) then {
Expand Down
12 changes: 3 additions & 9 deletions cScripts/functions/modules/fn_zenModule_createStarterCrate.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ params ["_modulePos", "_objectPos"];
[
"7th Cavalry Starter Crate",
[
["CHECKBOX", ["Regear action", "Allow you to regear on the crate."], true, false],
["CHECKBOX", ["Heal action", "Enables the crate to heal your wonds on regear as well as a separat action."], true, false],
["CHECKBOX", ["Insignia Selection", "Allow the selection of our insignias"], true, false],
["LIST", ["Company, squad or group", "Select the company, group or squad the crate should populate loadouts with."],
[
[
Expand Down Expand Up @@ -67,22 +65,18 @@ params ["_modulePos", "_objectPos"];
1,
12
], false],
["CHECKBOX", ["Show all loadouts", "Allow all loadouts to be shown."], false, false],
["CHECKBOX", ["Arsenal", "Enable the 7Cav Arsenal. It is limited to only cav equipment used."], false, false]
["CHECKBOX", ["Allow all loadouts", "Show and allow all loadouts to be accessable."], false, false]
],
{
params ["_arg", "_pos"];
_arg params [
"_reGearOption",
"_reHealOption",
"_InsigniaSelectOption",
"_quickSelectScale",
"_showAllLoadouts",
"_arsenal"
"_allowAllLoadouts"
];
_pos params ["_modulePos"];
private _crate = "B_supplyCrate_F" createVehicle _modulePos;
[_crate, _quickSelectScale, _reGearOption, _reHealOption, _InsigniaSelectOption, _showAllLoadouts, _arsenal] remoteExec [QFUNC(doStarterCrate), 0, true];
[_crate, _quickSelectScale, true, _reHealOption, true, _allowAllLoadouts] remoteExec [QFUNC(doStarterCrate), 0, true];

// Add object to Zeus
[{
Expand Down
11 changes: 6 additions & 5 deletions cScripts/functions/systems/fn_addLoadoutSelection.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,24 @@ params [
["_icon", "", [""]],
["_category", ["ACE_MainActions", "cScripts_Loadout_Cat_Main"], [[]]],
["_company", "", [""]],
["_showAllLoadouts", false]
["_allowAllLoadouts", false]
];

private _condition = {
params ["", "", "_params"];
_params params ["", "_company", "_showAllLoadouts"];
if (_showAllLoadouts) exitWith {true};
_params params ["_className", "_company", "_allowAllLoadouts"];
if (_allowAllLoadouts) exitWith {true};
if ([player] call EFUNC(gear,getLoadoutName) == _className) exitWith {true};
if ([_company] call FUNC(allowLoadout)) exitWith {true};
false;
false
};

private _action = [format ["cScripts_Loadout_%1", _className], _lable, _icon, {
params ["", "", "_params"];
_params params ["_className"];
[player] call EFUNC(gear,removeLoadout);
[player, _className] call EFUNC(gear,applyLoadout);
}, _condition, {}, [_className, _company, _showAllLoadouts]] call ace_interact_menu_fnc_createAction;
}, _condition, {}, [_className, _company, _allowAllLoadouts]] call ace_interact_menu_fnc_createAction;

private _actionType = if (isPlayer _object) then {1} else {0};
[_object, _actionType, _category, _action] call ace_interact_menu_fnc_addActionToObject;
Expand Down
2 changes: 1 addition & 1 deletion cScripts/functions/systems/fn_allowLoadout.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ if (_playerCompany == "") exitWith {false};

if (_playerCompany == _company) exitWith {true};

true
false
6 changes: 3 additions & 3 deletions cScripts/functions/systems/fn_setupLoadoutCategories.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
* Main category used for creation <STRING>
*
* Example:
* [this, "ACE_MainActions"] call cScripts_fnc_setupLoadoutSelection;
* [this, "ACE_SelfActions"] call cScripts_fnc_setupLoadoutSelection;
* [this, "ACE_MainActions"] call cScripts_fnc_setupLoadoutCategories;
* [this, "ACE_SelfActions"] call cScripts_fnc_setupLoadoutCategories;
*
* Public: No
*/

params[
params[
["_object", objNull, [objNull]],
["_aceCategory", "ACE_MainActions", ["ACE_MainActions"]]
];
Expand Down
10 changes: 5 additions & 5 deletions cScripts/functions/systems/fn_setupLoadoutSelection.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
* Nothing
*
* Example:
* [this, "Charlie", true, "ACE_MainActions"] call cScripts_fnc_setupLoadoutSelection;
* [this, "Charlie", true, "ACE_SelfActions"] call cScripts_fnc_setupLoadoutSelection;
* [this, "Charlie", "ACE_MainActions", true] call cScripts_fnc_setupLoadoutSelection;
* [this, "Charlie", "ACE_SelfActions", true] call cScripts_fnc_setupLoadoutSelection;
*
* Public: No
*/

params[
["_object", objNull, [objNull]],
["_allowOnlyForCompany", true, [true]],
["_aceCategory", "ACE_MainActions", ["ACE_MainActions"]]
["_aceCategory", "ACE_MainActions", ["ACE_MainActions"]],
["_allowAllLoadouts", true, [true]]
];


Expand All @@ -44,7 +44,7 @@ private _classnameList = configProperties [missionconfigfile >> "CfgLoadouts", "
INFO_2("LoadoutSelector", "Setting up %1 loadout on %2.", _displayName, _object);

_category = [_aceCategory, _mainCategory] + _category;
[_object, _displayName, _classname, _icon, _category, _company, _allowOnlyForCompany] call FUNC(addLoadoutSelection);
[_object, _displayName, _classname, _icon, _category, _company, _allowAllLoadouts] call FUNC(addLoadoutSelection);
} forEach _classnameList;

INFO_1("LoadoutSelector", "Done setting up quick selections on %1.", _object);

0 comments on commit 2805898

Please sign in to comment.