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

Zeus - Move to native CBA Settings #8381

Merged
merged 2 commits into from
Aug 16, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
37 changes: 6 additions & 31 deletions addons/zeus/ACE_Settings.hpp
Original file line number Diff line number Diff line change
@@ -1,45 +1,20 @@
class ACE_Settings {
class GVAR(zeusAscension) {
category = CSTRING(DisplayName);
displayName = CSTRING(ascension_DisplayName);
description = CSTRING(ascension_Description);
typeName = "BOOL";
value = 0;
movedToSQF = 1;
};
class GVAR(zeusBird) {
category = CSTRING(DisplayName);
displayName = CSTRING(bird_DisplayName);
description = CSTRING(bird_Description);
typeName = "BOOL";
value = 0;
movedToSQF = 1;
};
class GVAR(remoteWind) {
category = CSTRING(DisplayName);
displayName = CSTRING(remoteWind_DisplayName);
description = CSTRING(remoteWind_Description);
typeName = "BOOL";
value = 0;
movedToSQF = 1;
};
class GVAR(radioOrdnance) {
category = CSTRING(DisplayName);
displayName = CSTRING(radioOrdnance_DisplayName);
description = CSTRING(radioOrdnance_Description);
typeName = "BOOL";
value = 0;
movedToSQF = 1;
};
class GVAR(revealMines) {
category = CSTRING(DisplayName);
displayName = CSTRING(revealMines_DisplayName);
description = CSTRING(revealMines_Description);
typeName = "SCALAR";
value = 0;
values[] = {"$STR_A3_OPTIONS_DISABLED", CSTRING(revealMines_partial), CSTRING(revealMines_full)};
movedToSQF = 1;
};
class GVAR(autoAddObjects) {
category = CSTRING(DisplayName);
typeName = "BOOL";
value = 0;
displayName = CSTRING(AddObjectsToCurator);
description = CSTRING(AddObjectsToCurator_desc);
movedToSQF = 1;
};
};
7 changes: 0 additions & 7 deletions addons/zeus/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@

#define IDD_DISPLAY3DEN 313

["ace_settingsInitialized",{
// Only add an InitPost EH if setting is enabled (and apply retroactively)
if (isServer && {GVAR(autoAddObjects)}) then {
["AllVehicles", "InitPost", FUNC(addObjectToCurator), true, [], true] call CBA_fnc_addClassEventHandler;
};
}] call CBA_fnc_addEventHandler;

// Global skill module PVs values for persistence, just listen for the PV
QGVAR(GlobalSkillAI) addPublicVariableEventHandler FUNC(moduleGlobalSetSkill);

Expand Down
7 changes: 7 additions & 0 deletions addons/zeus/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ PREP_RECOMPILE_END;

if (isServer) then {
[QGVAR(zeusUnitAssigned), FUNC(handleZeusUnitAssigned)] call CBA_fnc_addEventHandler;

// Only add an InitPost EH if setting is enabled (and apply retroactively)
["CBA_settingsInitialized", {
if (GVAR(autoAddObjects)) then {
["AllVehicles", "InitPost", FUNC(addObjectToCurator), true, [], true] call CBA_fnc_addClassEventHandler;
};
}] call CBA_fnc_addEventHandler;
};

GVAR(GlobalSkillAI) = [0.5,0.5,0.5,0.5,true,true];
Expand Down
4 changes: 2 additions & 2 deletions addons/zeus/functions/fnc_bi_moduleMine.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ if (_activated) then {
_explosive attachto [_logic];

// Added by ace_zeus to control if mines are revealed
if (GVAR(revealMines) > 0) then {
if (GVAR(revealMines) > MINE_REVEAL_NONE) then {
//--- Reveal the mine to curator's side
{
_side = (getassignedcuratorunit _x) call bis_fnc_objectSide;
_side revealmine _explosive;
} forEach (objectcurators _logic);

if (GVAR(revealMines) > 1) then {
if (GVAR(revealMines) == MINE_REVEAL_FULL) then {
//--- Mark minefields in the map
[] spawn bis_fnc_drawMinefields;
};
Expand Down
7 changes: 3 additions & 4 deletions addons/zeus/functions/fnc_bi_moduleProjectile.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,9 @@ if (_activated) then {
};
_fnc_playRadio = {
if (_radio != "") then {
_entities = (getposatl _logic) nearentities ["All",100];
_sides = [];
{
if (isplayer _x) then {
if (_x distance2D _logic < 100) then {
_side = side group _x;
if (_side in [east,west,resistance,civilian]) then {
//--- Play radio (only if it wasn't played recently)
Expand All @@ -103,14 +102,14 @@ if (_activated) then {
};
};
};
} foreach _entities;
} foreach allPlayers;
};
};
if (count _hint > 0 && {count objectcurators _logic > 0}) then {
[[_hint,nil,nil,nil,nil,nil,nil,true],"bis_fnc_advHint",objectcurators _logic] call bis_fnc_mp;
};
if (count _velocity == 3) then {
_altitude = (_logic getvariable ["altitude",_altitude]) call bis_fnc_parsenumber;
_altitude = (_logic getvariable ["altitude",_altitude]) call BIS_fnc_parseNumberSafe;
_radio = _logic getvariable ["radio",_radio];

//--- Create projectile
Expand Down
68 changes: 68 additions & 0 deletions addons/zeus/initSettings.sqf
Original file line number Diff line number Diff line change
@@ -1,3 +1,71 @@
[
QGVAR(zeusAscension),
"CHECKBOX",
[LLSTRING(ascension_DisplayName), LLSTRING(ascension_Description)],
format ["ACE %1", LLSTRING(DisplayName)],
false,
true
] call CBA_fnc_addSetting;

[
QGVAR(zeusBird),
"CHECKBOX",
[LLSTRING(bird_DisplayName), LLSTRING(bird_Description)],
format ["ACE %1", LLSTRING(DisplayName)],
false,
true
] call CBA_fnc_addSetting;

[
QGVAR(remoteWind),
"CHECKBOX",
[LLSTRING(remoteWind_DisplayName), LLSTRING(remoteWind_Description)],
format ["ACE %1", LLSTRING(DisplayName)],
false,
true
] call CBA_fnc_addSetting;

[
QGVAR(radioOrdnance),
"CHECKBOX",
[LLSTRING(radioOrdnance_DisplayName), LLSTRING(radioOrdnance_Description)],
format ["ACE %1", LLSTRING(DisplayName)],
false,
true
] call CBA_fnc_addSetting;

[
QGVAR(revealMines),
"LIST",
[LLSTRING(revealMines_DisplayName), LLSTRING(revealMines_Description)],
format ["ACE %1", LLSTRING(DisplayName)],
[
[
MINE_REVEAL_NONE,
MINE_REVEAL_TO_SIDE,
MINE_REVEAL_FULL
],
[
localize "STR_A3_OPTIONS_DISABLED",
LLSTRING(revealMines_partial),
LLSTRING(revealMines_full)
],
0
],
true
] call CBA_fnc_addSetting;

[
QGVAR(autoAddObjects),
"CHECKBOX",
[LLSTRING(AddObjectsToCurator), LLSTRING(AddObjectsToCurator_desc)],
format ["ACE %1", LLSTRING(DisplayName)],
false,
true,
{},
true // XEH class EH cannot be removed, requires mission restart
] call CBA_fnc_addSetting;

[
QGVAR(canCreateZeus),
"LIST",
Expand Down
4 changes: 4 additions & 0 deletions addons/zeus/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@
#define CAN_CREATE_ADMIN 0
#define CAN_CREATE_CONSOLE 1
#define CAN_CREATE_ALL 2

#define MINE_REVEAL_NONE 0
#define MINE_REVEAL_TO_SIDE 1
#define MINE_REVEAL_FULL 2