Skip to content

Commit

Permalink
Alpha Release v0.2.0 (#72)
Browse files Browse the repository at this point in the history
* RPT logging, syntax, make.cfg proper zip output

* more RPT logging and syntax/formatting

* syntax stuff; core module review complete

* radio module RPT and formatting fixes

* configuration module RPT logging; syntax/format

* bug fixes; misc
- set default value for buttons and arsenals (later commands weren't happy with a nil value)
- removed GUI_THEME_COLOR define from configuration module since it is already defined in main
- scope and scheduled env. fixes in radio clientPostInit
- misc

* Prep v0.2.0-alpha
  • Loading branch information
SiegeToaster authored Oct 4, 2022
1 parent ae9f75e commit a4b8c9b
Show file tree
Hide file tree
Showing 44 changed files with 241 additions and 186 deletions.
4 changes: 2 additions & 2 deletions addons/ace/XEH_clientPostInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ if (!("@ace" call EFUNC(core,checkModPresence)) || (allDisplays isEqualTo [findD

/* ACE3 Interactions */
private ["_action", "_statement"];
private _buttons = EGVAR(configuration,buttons);
private _arsenals = EGVAR(configuration,arsenals);
private _buttons = missionNamespace getVariable [QEGVAR(configuration,buttons), []];
private _arsenals = missionNamespace getVariable [QEGVAR(configuration,arsenals), []];
private _commonObjects = +_buttons + _arsenals;
_commonObjects = _commonObjects arrayIntersect _commonObjects;

Expand Down
3 changes: 0 additions & 3 deletions addons/configuration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,3 @@ Sets the [mission config value](https://community.bistudio.com/wiki/set3DENMissi
|section|The section that the config value belongs to. As of the time of writing, this parameter can be either ``frameworkSettings`` or ``hiddenConfigValues``.|
|var|The config value to set. See the tables above for valid values.|
|value|The value to set to ``var``.

### GUI_THEME_COLOR
Gets the user's "Menu" color scheme "Background" RGBA value. Should always be used in GUI title bars. Default/Example: ``{0.13,0.54,0.21,0.8}``
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
private _category = lbCurSel ((findDisplay 8502) displayCtrl 2300);

// Exit if selected category is not attachments or magazines
if !(_category in [4, 5, 6, 7, 8]) exitWith {};
if !(_category in [4, 5, 6, 7, 8]) exitWith {
LOG_FUNC_END_ERROR("attempted to add compatible items with invalid category");
};

private _configItems = +(uiNamespace getVariable [QGVAR(configItems), []]);
private _items = uiNamespace getVariable [QGVAR(additionalItems), []];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ if (_category == -1) then {
};
};

TRACE_2("Clear button removed items",_category,_categoryItems);
_items = _items - _categoryItems;
TRACE_2("Clear button removed items",_category,_categoryItems);
};

// Refresh the list after clear
Expand Down
2 changes: 1 addition & 1 deletion addons/configuration/functions/fnc_additionalItemsSave.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ LOG_FUNC_START;
private _values = _hash get _name;
_values set [4, uiNamespace getVariable [QGVAR(additionalItems), []]];
_hash set [_name, _values];
TRACE_3("saved values",_hash,_name,_values);
TRACE_2("saved values",_name,_values);

// reopen role/group editor
private "_lbCtrl";
Expand Down
5 changes: 2 additions & 3 deletions addons/configuration/functions/fnc_editGroupsRefresh.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ params [
];

if (floor _index != _index) exitWith {
// error, index must be an integer
LOG_FUNC_END_ERROR("index must be an integer");
};

private _mode = uiNamespace getVariable [QGVAR(editGroupsCurrentMode), 0];
Expand All @@ -47,7 +47,7 @@ lbSort _groupsLbCtrl;

// find proper group index and select according to param
if (_index < 0) then {
_index = ((lbSize _groupsLbCtrl) + _index);
_index = (lbSize _groupsLbCtrl) + _index;
};
if (_setCursor) then {
_groupsLbCtrl lbSetCurSel _index;
Expand All @@ -68,7 +68,6 @@ if (_mode == 0) then {

// update roles based on whether or not they are in the group
lnbClear _rolesLbCtrl;
TRACE_1("refresh roles",_roles);
{
private _symbol = "";
private _alpha = 0.5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ private _lbCtrl = CTRL(1500);
private _index = lbCurSel _lbCtrl;

if (_index == -1) exitWith {
// nothing is selected
LOG_FUNC_END_ERROR("no group selected");
};
LOG_FUNC_START;

private _groups = uiNamespace getVariable [QGVAR(groups), createHashMap];
private _group = _lbCtrl lbText _index;

_groups set [_group, [cbChecked CTRL(2801), cbChecked CTRL(2802), cbChecked CTRL(2803), cbChecked CTRL(2804), (_groups get _group) # 4, (_groups get _group) # 5]];
uiNamespace setVariable [QGVAR(groups), _groups];
TRACE_1("new groups value",_groups);
LOG_FUNC_END;
6 changes: 2 additions & 4 deletions addons/configuration/functions/fnc_editGroupsSelect.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ params [
];

if ((uiNamespace getVariable [QGVAR(editGroupsCurrentMode), 0]) == 1) exitWith {
// incorrect mode
LOG_FUNC_END_ERROR("incorrect mode");
};

private _rolesLbCtrl = (findDisplay 8503) displayCtrl 1503;
Expand All @@ -33,10 +33,8 @@ private _groupName = _groupsLbCtrl lbText (lbCurSel _groupsLbCtrl);
private _groupValue = _groups getOrDefault [_groupName, [false, false, false, false, [], []]];
private _groupRoles = _groupValue # 5; // should update _groupValue too since (I think) assigning an array makes it a reference

TRACE_3("edit groups select",_roleName,_groupName,_groupRoles);

if (_groupName == "") exitWith {
// no group selected
LOG_FUNC_END_ERROR("no group selected");
};

if (_addItem && { !(_roleName in (_groupRoles)) }) exitWith {
Expand Down
2 changes: 2 additions & 0 deletions addons/configuration/functions/fnc_editGroupsSpawn.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ params [
["_index", 0, [0]],
["_mode", 0, [0]]
];
LOG_FUNC_START;

(findDisplay 313) createDisplay ([QGVAR(editGroups), QGVAR(editGroupsSettings)] # _mode);
[_index] call FUNC(editGroupsRefresh);
LOG_FUNC_END;
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* call sia3f_configuration_fnc_editRolesCleanupGlobals
*/

LOG_FUNC_START;
{
uiNamespace setVariable [_x, nil];
} forEach [
Expand All @@ -25,3 +26,4 @@
QGVAR(additionalItemsIsGroup),
QGVAR(additionalItemsCategory)
];
LOG_FUNC_END;
7 changes: 6 additions & 1 deletion addons/configuration/functions/fnc_editRolesCreateRole.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,20 @@ params [
["_roleName", "", [""]]
];

if (_roleName == "") exitWith {};
if (_roleName == "") exitWith {
LOG_FUNC_END_ERROR("empty role name");
};
LOG_FUNC_START;

private _roles = uiNamespace getVariable [QGVAR(roles), createHashMap];

if (_roleName in _roles) exitWith {
systemChat "Cannot create role, role already exists.";
LOG_FUNC_END_ERROR("role already exists");
};

// create role, value array is [isMedic, isEngineer, hasHandheldRadio, hasManpackRadio, additionalItems, groups]
_roles set [_roleName, [false, false, false, false, [], []]];
uiNamespace setVariable [QGVAR(roles), _roles];
[-1] call FUNC(editRolesRefresh);
LOG_FUNC_END;
10 changes: 8 additions & 2 deletions addons/configuration/functions/fnc_editRolesDeleteRole.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,24 @@ params [
["_roleName", "", [""]]
];

if (_roleName == "") exitWith {};
if (_roleName == "") exitWith {
LOG_FUNC_END_ERROR("empty role name");
};

if (_roleName == "default") exitWith {
systemChat "Cannot delete the default role.";
LOG_FUNC_END_ERROR("cannot delete default role");
};
LOG_FUNC_START;

private _roles = uiNamespace getVariable [QGVAR(roles), createHashMap];

if !(_roleName in _roles) exitWith {
systemChat "Invalid role name";
systemChat "Invalid role name - role does not exist";
LOG_FUNC_END_ERROR("role does not exist");
};
_roles deleteAt _roleName;

uiNamespace setVariable [QGVAR(roles), _roles];
[-1] call FUNC(editRolesRefresh);
LOG_FUNC_END;
4 changes: 2 additions & 2 deletions addons/configuration/functions/fnc_editRolesRefresh.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ params [
];

if (floor _index != _index) exitWith {
// error, index must be an integer
LOG_FUNC_END_ERROR("index must be an integer");
};

private _lbCtrl = CTRL(1500);
Expand All @@ -40,7 +40,7 @@ if (_roles isEqualTo createHashMap) then {
["platoon leader", [false, false, true, true, [], ["leadership"]]]
];

{ _roles set [(_x select 0), (_x select 1)] } forEach _defaultRoles; // for new/unsaved missions
{ _roles set [(_x select 0), (_x select 1)]; } forEach _defaultRoles; // for new/unsaved missions
};

lbClear _lbCtrl;
Expand Down
5 changes: 4 additions & 1 deletion addons/configuration/functions/fnc_editRolesSaveRole.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@ private _lbCtrl = CTRL(1500);
private _index = lbCurSel _lbCtrl;

if (_index == -1) exitWith {
// nothing is selected
LOG_FUNC_END_ERROR("no role selected");
};
LOG_FUNC_START;

private _roles = uiNamespace getVariable [QGVAR(roles), createHashMap];
private _role = _lbCtrl lbText _index;

_roles set [_role, [cbChecked CTRL(2801), cbChecked CTRL(2802), cbChecked CTRL(2803), cbChecked CTRL(2804), (_roles get _role) # 4, (_roles get _role) # 5]];
uiNamespace setVariable [QGVAR(roles), _roles];
TRACE_1("new roles value",_roles);
LOG_FUNC_END;
2 changes: 2 additions & 0 deletions addons/configuration/functions/fnc_editRolesSpawn.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@
* call sia3f_configuration_fnc_editRolesSpawn
*/

LOG_FUNC_START;
(findDisplay 313) createDisplay QGVAR(editRole);
[0] call FUNC(editRolesRefresh);
LOG_FUNC_END;
9 changes: 8 additions & 1 deletion addons/configuration/functions/fnc_initFramework.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@
if (("sia3f_configuration_hiddenConfigValues" get3DENMissionAttribute "sia3f_configuration_frameworkInit") isEqualTo true) exitWith {
// attribute starts as '0' and is set to true once initialization is complete, so comparison can't be type strict (no ==)
["SIA Mission Framework has already been initialized.", 1] call BIS_fnc_3DENNotification;
LOG_FUNC_END_ERROR("framework already initialized");
};
LOG_FUNC_START;

private _callback = "make_descriptionExt" callExtension ["", [getMissionPath ""]];
// ToDo: log callback, check for success and notify player if it fails.
// ToDo: check for extension success and notify player if it fails.
TRACE_1("extension callback",_callback);

// create default roles if roles don't already exist
private _roles = GET_CONFIG(roles,createHashMap);
Expand All @@ -37,6 +40,7 @@ if (_roles isEqualTo createHashMap) then {

{ _roles set [(_x select 0), (_x select 1)] } forEach _defaultRoles;
SET_CONFIG(hiddenConfigValues,roles,_roles);
LOG("default roles created");
};

private _groups = GET_CONFIG(groups,createHashMap);
Expand All @@ -47,12 +51,15 @@ if (_groups isEqualTo createHashMap) then {

{ _groups set [(_x select 0), (_x select 1)] } forEach _defaultGroups;
SET_CONFIG(hiddenConfigValues,groups,_groups);
LOG("default group created");
};

// default mission attributes
// ToDo only write if value hasn't been changed?
set3DENMissionAttributes [["Multiplayer", "Respawn", 3], ["Multiplayer", "RespawnDelay", 60], ["Multiplayer", "RespawnTemplates", ["ace_spectator", "Wave", "Counter", "Tickets"]]];
LOG("set mission attributes");

SET_CONFIG(hiddenConfigValues,frameworkInit,true);
do3DENAction "MissionSave";
["SIA Mission Framework Initialization Complete!"] call BIS_fnc_3DENNotification;
LOG_FUNC_END;
10 changes: 8 additions & 2 deletions addons/configuration/functions/fnc_rolesExpression.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ params [
["_value", "", [""]]
];

if (isNull _object || _value isEqualTo "") exitWith {};
if (isNull _object || _value isEqualTo "") exitWith {
LOG_FUNC_END_ERROR("invalid parameters");
};
LOG_FUNC_START;

if (is3DEN) then {
private _roles = GET_CONFIG(roles,createHashMap);
Expand All @@ -34,13 +37,16 @@ if (is3DEN) then {
["platoon leader", [false, false, true, true, [], ["leadership"]]]
];

{ _roles set [(_x select 0), (_x select 1), true] } forEach _defaultRoles;
{ _roles set [(_x select 0), (_x select 1), true]; } forEach _defaultRoles;

private _toSave = _roles set [_value, [false, false, false, false, [], []]];
if (!_toSave) then {
SET_CONFIG(hiddenConfigValues,roles,_roles);
do3DENAction "MissionSave";
TRACE_1("new role created",_value);
};
} else {
_object setVariable [QGVAR(role), _value, true];
LOG("set obj variable");
};
LOG_FUNC_END;
Loading

0 comments on commit a4b8c9b

Please sign in to comment.