Skip to content

Commit

Permalink
Merge pull request official-antistasi-community#234 from SilenceIsFat…
Browse files Browse the repository at this point in the history
…to/revealed-zones-saving

Save/load revealed zones
  • Loading branch information
AUC-bot authored Jul 14, 2024
2 parents a056352 + a84419c commit 19aceaf
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 5 deletions.
3 changes: 3 additions & 0 deletions A3A/addons/core/functions/Save/fn_loadServer.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ if (isServer) then {
["constructionsX"] call A3A_fnc_getStatVariable;
["isRivalsDiscoveryQuestAssigned"] call A3A_fnc_getStatVariable;

//Antistasi Ultimate variables
["revealedZones"] call A3A_fnc_getStatVariable; publicVariable "revealedZones";

//===========================================================================

//RESTORE THE STATE OF THE 'UNLOCKED' VARIABLES USING JNA_DATALIST
Expand Down
14 changes: 12 additions & 2 deletions A3A/addons/core/functions/Save/fn_loadStat.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ if (isNil "specialVarLoads") then {
"destroyedMilAdmins",
"rebelLoadouts", "randomizeRebelLoadoutUniforms",
"areRivalsDefeated", "areRivalsDiscovered", "inactivityRivals", "rivalsLocationsMap", "rivalsExcludedLocations",
"nextRivalsLocationReveal", "isRivalsDiscoveryQuestAssigned"
"nextRivalsLocationReveal", "isRivalsDiscoveryQuestAssigned", "revealedZones"
] createHashMapFromArray [];
};

Expand Down Expand Up @@ -657,12 +657,22 @@ if (_varName in specialVarLoads) then {
};

case 'isRivalsDiscoveryQuestAssigned': {
isRivalsDiscoveryQuestAssigned = _varvalue;
isRivalsDiscoveryQuestAssigned = _varValue;
publicVariable "isRivalsDiscoveryQuestAssigned";
if (isRivalsDiscoveryQuestAssigned && {!areRivalsDiscovered}) then {
[] call SCRT_fnc_rivals_prepareQuest;
};
};

case 'revealedZones': {
revealedZones = _varValue;

if (isNil "revealedZones") then {
revealedZones = [];
};

publicVariable "revealedZones";
};
};
} else {
call compile format ["%1 = %2",_varName,_varValue];
Expand Down
16 changes: 16 additions & 0 deletions A3A/addons/core/functions/Save/fn_saveLoop.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,22 @@ private _milAdminPositions = [];
{ _milAdminPositions pushBack getPos _x; } forEach A3A_destroyedMilAdministrations;
["destroyedMilAdmins", _milAdminPositions] call A3A_fnc_setStatVariable;

//Antistasi Ultimate variables
private _revealedZones = [];

{
private _markerSide = sidesX getVariable [_x, sideUnknown];
if (_markerSide isNotEqualTo sideUnknown && {_markerSide isNotEqualTo resistance} && {!(_x in markersImmune)}) then
{
private _dummyMarker = "Dum"+_x;
if (markerAlpha _dummyMarker isNotEqualTo 0) then {_revealedZones pushBack _x};
};
} forEach markersX;

["revealedZones", _revealedZones] call A3A_fnc_setStatVariable;

diag_log format["Saving revealed zones: %1", _revealedZones];
//Antistasi Ultimate variables ^

private ["_hrBackground","_resourcesBackground","_veh","_typeVehX","_weaponsX","_ammunition","_items","_backpcks","_containers","_arrayEst","_posVeh","_dierVeh","_prestigeOPFOR","_prestigeBLUFOR","_city","_dataX","_markersX","_garrison","_arrayMrkMF","_positionOutpost","_typeMine","_posMine","_detected","_typesX","_exists","_friendX"];

Expand Down
18 changes: 15 additions & 3 deletions A3A/addons/ultimate/functions/init/fn_initZones.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,24 @@ markersImmune = markersX select {
{(_x in airportsX)}
}; // this var should in theory only be seen by the server

private _revealedZones = revealedZones;

if (isNil "revealedZones") then {
revealedZones = [];
};

{
private _markerSide = sidesX getVariable [_x, sideUnknown];

if (_x in _revealedZones) then {
[_x] call A3U_fnc_revealZone;
continue;
};

if (_markerSide isNotEqualTo sideUnknown && {_markerSide isNotEqualTo resistance}) then
{
if (_x in airportsX || {_x in citiesX}) then {} else {
"Dum"+_x setMarkerAlpha 0; // "Dum" is for dummy marker, the actual one you see in-game. The editor one is hidden
};
if (_x in airportsX || {_x in citiesX}) then {continue};

"Dum"+_x setMarkerAlpha 0; // "Dum" is for dummy marker, the actual one you see in-game. The editor one is hidden
};
} forEach _markersX;

0 comments on commit 19aceaf

Please sign in to comment.