bunker update 2

This commit is contained in:
vbawol 2017-10-19 16:36:53 -05:00
parent e0b6a011e8
commit 829682429d

View File

@ -22,11 +22,11 @@ if (worldName == "VR") then {
_instanceID = call EPOCH_fn_InstanceID; _instanceID = call EPOCH_fn_InstanceID;
// size // size
_maxRows = 100; _maxRows = 20;
_maxColumns = 100; _maxColumns = 20;
_rngChance = 0; // Lower this to spawn more positions _rngChance = 0; // Lower this to spawn more positions
_scriptHiveKey = "EPOCH:DynamicBunker002"; // change this to force a new seed to be generated. _scriptHiveKey = "EPOCH:DynamicBunker003"; // change this to force a new seed to be generated.
_bunkerLocationsKey = format ["%1:%2", _instanceID, worldname]; _bunkerLocationsKey = format ["%1:%2", _instanceID, worldname];
_response = [_scriptHiveKey, _bunkerLocationsKey] call EPOCH_fnc_server_hiveGETRANGE; _response = [_scriptHiveKey, _bunkerLocationsKey] call EPOCH_fnc_server_hiveGETRANGE;
@ -38,6 +38,20 @@ if (worldName == "VR") then {
// check for proper return and data type // check for proper return and data type
if (_status == 1 && _data isEqualType [] && !(_data isEqualTo [])) then { if (_status == 1 && _data isEqualType [] && !(_data isEqualTo [])) then {
_bunkerLocations = _data; _bunkerLocations = _data;
// spawn cached bunkers
{
if (_x isEqualType [] && !(_x isEqualTo [])) then {
_x params ["_selectedBunker", "_posWorld", ["_memoryPointsStatus",[]] ];
_object = createSimpleObject [_selectedBunker, _posWorld];
if (isNull _firstBunker) then {_firstBunker = _object;};
{
_object animate [_x,(_memoryPointsStatus param [_forEachIndex,1]),true];
} forEach _memoryPoints;
_bunkerCounter = _bunkerCounter + 1;
};
} forEach _bunkerLocations;
} else { } else {
// generate new bunker // generate new bunker
@ -77,6 +91,7 @@ if (worldName == "VR") then {
if (_rng > _rngChance) then { if (_rng > _rngChance) then {
_selectedBunker = selectRandomWeighted _valuesAndWeights; _selectedBunker = selectRandomWeighted _valuesAndWeights;
_object = createSimpleObject [_selectedBunker, _location]; _object = createSimpleObject [_selectedBunker, _location];
if (isNull _firstBunker) then {_firstBunker = _object;};
_allBunkers pushBack _object; _allBunkers pushBack _object;
_newBunkerCounter = _newBunkerCounter + 1; _newBunkerCounter = _newBunkerCounter + 1;
}; };
@ -101,34 +116,22 @@ if (worldName == "VR") then {
_list = nearestObjects[_loc1, [], 1]; _list = nearestObjects[_loc1, [], 1];
if !(_list isEqualTo []) then { if !(_list isEqualTo []) then {
_score = _score + 1; _score = _score + 1;
_animationStates pushBack 0 _animationStates pushBack 0;
_veh animate [_x,0];
} else { } else {
_animationStates pushBack 1 _animationStates pushBack 1;
_veh animate [_x,1];
}; };
}; };
} forEach _memoryPoints; } forEach _memoryPoints;
_modelInfo = getModelInfo _veh; _modelInfo = getModelInfo _veh;
_bunkerLocations pushBack [_modelInfo select 1, getPosWorld _veh, _animationStates, _score]; _bunkerLocations pushBack [_modelInfo select 1, getPosWorld _veh, _animationStates, _score];
} forEach _allBunkers; } forEach _allBunkers;
// remove temp bunkers, otherwise door ways do not seem to animate
{deleteVehicle _x} forEach _allBunkers;
// save to DB // save to DB
[_scriptHiveKey, _bunkerLocationsKey, _expiresBunker, _bunkerLocations] call EPOCH_fnc_server_hiveSETEX; [_scriptHiveKey, _bunkerLocationsKey, _expiresBunker, _bunkerLocations] call EPOCH_fnc_server_hiveSETEX;
}; };
// spawn final bunkers
{
if (_x isEqualType [] && !(_x isEqualTo [])) then {
_x params ["_selectedBunker", "_posWorld", ["_memoryPointsStatus",[]] ];
_object = createSimpleObject [_selectedBunker, _posWorld];
if (isNull _firstBunker) then {_firstBunker = _object;};
{
_object animate [_x,(_memoryPointsStatus param [_forEachIndex,1]),true];
} forEach _memoryPoints;
_bunkerCounter = _bunkerCounter + 1;
};
} forEach _bunkerLocations;
// move respawn point into first bunker. // move respawn point into first bunker.
if (!(isNull _firstBunker) && {_firstBunker distance _debugLocation > 1}) then { if (!(isNull _firstBunker) && {_firstBunker distance _debugLocation > 1}) then {
deleteMarker "respawn_west"; deleteMarker "respawn_west";