Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow guests to use of arsenal limits dialog and set default guest limit to 0 #3234

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion A3A/addons/core/Params.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ class Params
title = $STR_A3A_Params_guestItemLimit_title;
values[] = {0,10,15,25,40};
texts[] = {$STR_A3A_Params_generic_nolimit,"10","15","25","40"};
default = 25;
default = 0;
};
class unlockedUnlimitedAmmo
{
Expand Down
2 changes: 1 addition & 1 deletion A3A/addons/core/dialogs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1802,7 +1802,7 @@ class commander_comm {
w = 0.175015 * safezoneW;
h = 0.0560125 * safezoneH;
tooltip = "Manage arsenal limitations of guests"; //$STR_antistasi_dialogs_commander_comm_faction_garage_tooltip;
action = "if (player == theBoss && theBoss call A3A_fnc_isMember) then {closeDialog 0; createDialog ""A3A_ArsenalLimitsDialog""} else {[""Arsenal limits"", ""Only member commanders have access to this function""] call A3A_fnc_customHint}";
action = "if (player == theBoss) then {closeDialog 0; createDialog ""A3A_ArsenalLimitsDialog""} else {[""Arsenal limits"", ""Only commanders have access to this function""] call A3A_fnc_customHint}";
};
class 8slots_L4: A3A_core_BattleMenuRedButton
{
Expand Down
2 changes: 1 addition & 1 deletion A3A/addons/core/functions/Save/fn_deleteSave.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private _savedPlayers = _namespace getVariable ["savedPlayers" + _postfix, []];
"outpostsFIA", "tasks", "idlebases", "idleassets", "killZones", "controlsSDK", "params",
"attackCountdownOccupants", "attackCountdownInvaders", "prestigeNATO", "prestigeCSAT",
"savedPlayers", "testingTimerIsActive", "HR_Garage", "A3A_fuelAmountleftArray", "HQKnowledge", "enemyResources",
"version", "name", "saveTime", "ended", "factions", "addonVics", "DLC"];
"version", "name", "saveTime", "ended", "factions", "addonVics", "DLC", "arsenalLimits"];


// Remove this campaign from the save list, if present
Expand Down
1 change: 1 addition & 0 deletions A3A/addons/core/functions/Save/fn_loadServer.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ if (isServer) then {
["killZones"] call A3A_fnc_getStatVariable;
["controlsSDK"] call A3A_fnc_getStatVariable;
["bombRuns"] call A3A_fnc_getStatVariable;
["arsenalLimits"] call A3A_fnc_getStatVariable;
["jna_dataList"] call A3A_fnc_getStatVariable;
//===========================================================================

Expand Down
5 changes: 4 additions & 1 deletion A3A/addons/core/functions/Save/fn_loadStat.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private _specialVarLoads = [
"garrison","tasks","membersX","vehInGarage","destroyedBuildings","idlebases",
"chopForest","weather","killZones","jna_dataList","controlsSDK","mrkCSAT","nextTick",
"bombRuns","wurzelGarrison","aggressionOccupants", "aggressionInvaders", "enemyResources", "HQKnowledge",
"testingTimerIsActive", "version", "HR_Garage", "A3A_fuelAmountleftArray"
"testingTimerIsActive", "version", "HR_Garage", "A3A_fuelAmountleftArray", "arsenalLimits"
];

private _varName = _this select 0;
Expand Down Expand Up @@ -375,6 +375,9 @@ if (_varName in _specialVarLoads) then {
};
};
};
if (_varname == "arsenalLimits") then {
A3A_arsenalLimits = _varValue; publicVariable "A3A_arsenalLimits";
};

if(_varname == 'testingTimerIsActive') then
{
Expand Down
1 change: 1 addition & 0 deletions A3A/addons/core/functions/Save/fn_saveLoop.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ private _antennasDeadPositions = [];
["maxUnits", 140] call A3A_fnc_setStatVariable; // backwards compatibility
["nextTick", nextTick - time] call A3A_fnc_setStatVariable;
["weather",[fogParams,rain]] call A3A_fnc_setStatVariable;
["arsenalLimits", A3A_arsenalLimits] call A3A_fnc_setStatVariable;
private _destroyedPositions = destroyedBuildings apply { getPosATL _x };
["destroyedBuildings",_destroyedPositions] call A3A_fnc_setStatVariable;

Expand Down
2 changes: 1 addition & 1 deletion A3A/addons/gui/dialogues/arsenalLimitsDialog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class A3A_ArsenalLimitsDialog {
idd = A3A_IDD_ARSENALLIMITSDIALOG;
movingenable = false;

onLoad = "['typeSelect'] spawn A3A_fnc_arsenalLimitsDialog";
onLoad = "['init'] spawn A3A_fnc_arsenalLimitsDialog";
onUnload = "publicVariable 'A3A_arsenalLimits'";

class ControlsBackground {
Expand Down
1 change: 1 addition & 0 deletions A3A/addons/gui/dialogues/ids.inc
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ Maintainer: DoomMetal
#define A3A_IDC_ARSLIMTYPESELECT 9504
#define A3A_IDC_ARSLIMSTEPBUTTON 9505
#define A3A_IDC_ARSLIMCLOSEBUTTON 9506
#define A3A_IDC_ARSLIMRESETBUTTON 9507
#define A3A_IDC_ARSLIMTYPESBASE 9550

// Setup interface
Expand Down
11 changes: 11 additions & 0 deletions A3A/addons/gui/functions/GUI/fn_arsenalLimitsDialog.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ private _listBox = _display displayCtrl A3A_IDC_ARSLIMLISTBOX;

switch (_mode) do
{
case ("init"):
{
if !(player call A3A_fnc_isMember) then {
["Arsenal limits", "As a guest commander you can only increase arsenal limits, not decrease them."] call A3A_fnc_customHint;
(_display displayctrl A3A_IDC_ARSLIMRESETBUTTON) ctrlEnable false;
};
["typeSelect"] call A3A_fnc_arsenalLimitsDialog;
};

case ("typeSelect"):
{
private _typeIndex = if (isNil "_params") then { 0 } else { (_params#0) - A3A_IDC_ARSLIMTYPESBASE };
Expand Down Expand Up @@ -61,13 +70,15 @@ switch (_mode) do

case ("listButton"):
{
if (_params#0 < 0 and !(player call A3A_fnc_isMember)) exitWith {};
if (isNil {_display getVariable "stepSize"}) exitWith {};
private _stepSize = _display getVariable "stepSize";
private _curRow = lnbCurSelRow _listBox;
private _class = _listBox lnbData [_curRow, 0];

private _curVal = _listBox lnbValue [_curRow, 2];
private _newVal = 0 max (_curVal + _stepSize*(_params#0));
_newVal = if (minWeaps < 0) then { _newVal min 100 } else { _newVal min minWeaps };
_listBox lnbSetText [[_curRow, 2], str _newVal];
_listBox lnbSetValue [[_curRow, 2], _newVal];
A3A_arsenalLimits set [_class, _newVal];
Expand Down