Skip to content

Commit

Permalink
Save MHQ surroundings and vehicle content
Browse files Browse the repository at this point in the history
  • Loading branch information
john681611 committed Apr 17, 2019
1 parent 8a79d8d commit 7299a45
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 19 deletions.
53 changes: 34 additions & 19 deletions common/Server/persistance/game/get_game.sqf
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
_save = [[],[],[]];

getVehicleData = {
_vehicle = [
(typeOf _this),
Expand All @@ -9,24 +11,37 @@ _vehicle = [
];
_vehicle
};
_save = [[],[],[]];
{
if (getMarkerColor _x == "colorGreen") then {
(_save select 0) append [(getMarkerPos _x)];
};
} forEach ztownAll;

{
{
if(!(isnil {_x getvariable "ResistVeh"})) then {
(_save select 1) append [(_x call getVehicleData)];
};
} forEach list (_x select 1);
} forEach Bases;

{
_mhq = (_x select 1);
(_save select 2) append [[(getpos _mhq),(getdir _mhq)]];
} forEach MHQs;

saveSurroundings = {
{
if(!(isnil {_x getvariable "ResistVeh"})) then {
(_save select 1) append [(_x call getVehicleData)];
};
} forEach list _this;
};

getMHQZone = {
_overlap = _this call tooCloseMHQ;
if(!_overlap) then {
(missionNamespace getVariable format["%1_zone",(_this select 2)]) call saveSurroundings;
};
};


{
if (getMarkerColor _x == "colorGreen") then {
(_save select 0) append [(getMarkerPos _x)];
};
} forEach ztownAll;

{
(_x select 1) call saveSurroundings;
} forEach Bases;

{
_mhq = (_x select 1);
(_save select 2) append [[(getpos _mhq),(getdir _mhq), (_mhq call getContent)]];
_x call getMHQZone;
} forEach MHQs;

_save
1 change: 1 addition & 0 deletions common/Server/persistance/game/set_game.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ _index = 0;
_mhq = (_x select 1);
_mhq setpos (((_this select 2) select _index) select 0);
_mhq setdir (((_this select 2) select _index) select 1);
[_mhq,(((_this select 2) select _index) select 2)] call setContent;
_index = _index + 1;
} forEach MHQs;

0 comments on commit 7299a45

Please sign in to comment.