Merge branch 'Development' into Experimental

This commit is contained in:
Chris Cardozo 2020-10-04 15:51:53 -04:00
commit 3e2f5ed99b
10 changed files with 33 additions and 24 deletions

View File

@ -13,12 +13,12 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/ http://creativecommons.org/licenses/by-nc-sa/4.0/
*/ */
#include "\q\addons\custom_server\Configs\blck_defines.hpp"; #include "\q\addons\custom_server\Configs\blck_defines.hpp";
private _startTime = diag_tickTime;
private _minDistFromBases = blck_minDistanceToBases; private _minDistFromBases = blck_minDistanceToBases;
private _minDistFromMission = blck_MinDistanceFromMission; private _minDistFromMission = blck_MinDistanceFromMission;
private _minDistanceFromTowns = blck_minDistanceFromTowns; private _minDistanceFromTowns = blck_minDistanceFromTowns;
private _minDistanceFromPlayers = blck_minDistanceToPlayer; private _minDistanceFromPlayers = blck_minDistanceToPlayer;
//private _blacklistedLocations = +blck_minDistanceFromTowns;
private _weightBlckList = 0.95; private _weightBlckList = 0.95;
private _weightBases = 0.9; private _weightBases = 0.9;
private _weightMissions = 0.8; private _weightMissions = 0.8;
@ -27,10 +27,6 @@ private _weightPlayers = 0.6;
private _weightRecentMissions = 0.6; private _weightRecentMissions = 0.6;
private _minDistanceRecentMissions = 500; private _minDistanceRecentMissions = 500;
private _pole = "";
if (blck_modType isEqualTo "Epoch") then {_pole = "PlotPole_EPOCH"};
if (blck_modType isEqualTo "Exile") then {_pole = "Exile_Construction_Flag_Static"};
// remove any recent mission locations that have timed out // remove any recent mission locations that have timed out
for "_i" from 1 to (count blck_recentMissionCoords) do for "_i" from 1 to (count blck_recentMissionCoords) do
{ {
@ -61,10 +57,11 @@ while {_coords isEqualTo []} do
private _searchCenter = blck_mapCenter getPos[_searchDist, random(359)]; private _searchCenter = blck_mapCenter getPos[_searchDist, random(359)];
_coords = [_searchCenter,0,_searchDist,_minObjDist,_waterMode,_maxGrad,_shoreMode] call BIS_fnc_findSafePos; _coords = [_searchCenter,0,_searchDist,_minObjDist,_waterMode,_maxGrad,_shoreMode] call BIS_fnc_findSafePos;
_tries = _tries + 1; _tries = _tries + 1;
[format["_fnc_findSafePosn(57): _tries = %1 | _coords = %2",_tries,_coords]] call blck_fnc_log; //[format["_fnc_findSafePosn(57): _tries = %1 | _coords = %2",_tries,_coords]] call blck_fnc_log;
}; };
{ {
//diag_log format["_fnc_findSafePosn(67): _recentMissionCoords %1 = %2",_forEachIndex,_x];
if (((_x select 0) distance2D _coords) < _minDistanceRecentMissions) then if (((_x select 0) distance2D _coords) < _minDistanceRecentMissions) then
{ {
_findNew = true; _findNew = true;
@ -75,7 +72,7 @@ while {_coords isEqualTo []} do
//diag_log format["_fnc_findSafePosn (61): _coords = %1 | _tries = %2 | count blck_locationBlackList = %1",_coords,_tries, count blck_locationBlackList]; //diag_log format["_fnc_findSafePosn (61): _coords = %1 | _tries = %2 | count blck_locationBlackList = %1",_coords,_tries, count blck_locationBlackList];
{ {
diag_log format["_fnc_findSafePosn (77): location _x = %1",_x]; //diag_log format["_fnc_findSafePosn (77): location _x = %1",_x];
if ( ((_x select 0) distance2D _coords) < (_x select 1)) exitWith if ( ((_x select 0) distance2D _coords) < (_x select 1)) exitWith
{ {
_findNew = true; _findNew = true;
@ -96,13 +93,17 @@ while {_coords isEqualTo []} do
if !(_findNew) then if !(_findNew) then
{ {
private _poles = [];
if (blck_modType isEqualTo "Epoch") then {_poles = allMissionObjects "PlotPole_EPOCH"};
if (blck_modType isEqualTo "Exile") then {_poles = allMissionObjects "Exile_Construction_Flag_Static"};
//diag_log format["_fnc_findSafePosn: count _poles = %1 | _poles = %2",count _poles,_poles];
{ {
if ((_x distance2D _coords) < blck_minDistanceToBases) then if ((_x distance2D _coords) < blck_minDistanceToBases) then
{ {
_findNew = true; _findNew = true;
if (blck_debugLevel >= 3) then {[format["_findSafePosn(98): too close to bases"]] call blck_fnc_log}; if (blck_debugLevel >= 3) then {[format["_findSafePosn(98): too close to bases"]] call blck_fnc_log};
}; };
}forEach (allmissionobjects _pole); }forEach _poles;
}; };
if !(_findNew) then if !(_findNew) then
@ -163,7 +164,6 @@ while {_coords isEqualTo []} do
_minDistanceRecentMissions = _minDistanceRecentMissions * _weightRecentMissions; _minDistanceRecentMissions = _minDistanceRecentMissions * _weightRecentMissions;
_coords = []; _coords = [];
}; };
[format["_fnc_findSafePosn(140) end of cycle logging: _tries = %1 | _coords = %2 | _findNew = %3",_tries,_coords,_findNew]] call blck_fnc_log; [format["_fnc_findSafePosn(140) end of cycle logging: _tries = %1 | _coords = %2 | _findNew = %3",_tries,_coords,_findNew]] call blck_fnc_log;
}; };
@ -173,7 +173,7 @@ if ((count _coords) > 2) then
_temp = [_coords select 0, _coords select 1]; _temp = [_coords select 0, _coords select 1];
_coords = _temp; _coords = _temp;
}; };
[format["_fnc_findSafePosn(148) final logging: _tries = %1 | _coords = %2",_tries,_coords]] call blck_fnc_log; [format["_fnc_findSafePosn(148) final logging: _elapsedTime %3 | _tries = %1 | _coords = %2",_tries,_coords,diag_tickTime - _startTime]] call blck_fnc_log;
_coords; _coords;

View File

@ -27,13 +27,7 @@ for "_i" from 1 to (count blck_oldMissionObjects) do {
{ {
{ {
if (typeName _x isEqualTo "OBJECT") then {deleteVehicle _x}; if (typeName _x isEqualTo "OBJECT") then {deleteVehicle _x};
if (_x isEqualType []) then if (typeName _x isEqualTo "STRING") then {deleteVehicle (objectFromNetId _x)};
{
//[format["_fnc_cleanUpObjects: case of _x is array: %1",_x]] call blck_fnc_log;
{
if (typeName _x isEqualTo "OBJECT") then {deleteVehicle _x};
} forEach _x;
};
} forEach _objarr; } forEach _objarr;
} else { } else {
blck_oldMissionObjects pushback _oldObjs; blck_oldMissionObjects pushback _oldObjs;

View File

@ -159,6 +159,16 @@ switch (_endCondition) do
if (local _x) then {deleteVehicle _x}; if (local _x) then {deleteVehicle _x};
}forEach _crates; }forEach _crates;
[_coords,_mines,_objects,_hiddenObjects,_blck_AllMissionAI,_markerName,cleanupAliveAITimer,cleanupCompositionTimer,_isScubaMission] call _fn_missionCleanup;
};
case 5: {
#define cleanupCompositionTimer 0
#define cleanupAliveAITimer 0
{
if (local _x) then {deleteVehicle _x};
}forEach _crates;
[_coords,_mines,_objects,_hiddenObjects,_blck_AllMissionAI,_markerName,cleanupAliveAITimer,cleanupCompositionTimer,_isScubaMission] call _fn_missionCleanup; [_coords,_mines,_objects,_hiddenObjects,_blck_AllMissionAI,_markerName,cleanupAliveAITimer,cleanupCompositionTimer,_isScubaMission] call _fn_missionCleanup;
}; };
}; };

View File

@ -40,7 +40,7 @@ if !(isNull _group) then
_building = createVehicle[_bldClassName,[0,0,0],[],0,"CAN_COLLIDE"]; _building = createVehicle[_bldClassName,[0,0,0],[],0,"CAN_COLLIDE"];
_building setPosATL (_bldRelPos vectorAdd _center); _building setPosATL (_bldRelPos vectorAdd _center);
_building setDir _bldDir; _building setDir _bldDir;
_buildingsSpawned pushBack _building; _buildingsSpawned pushBack (netID _building);
_staticsSpawned = [_building,_group,_statics,_men,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,"none",_weaponList,_sideArms] call blck_fnc_spawnGarrisonInsideBuilding_ATL; _staticsSpawned = [_building,_group,_statics,_men,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,"none",_weaponList,_sideArms] call blck_fnc_spawnGarrisonInsideBuilding_ATL;
}forEach _garrisonedBuilding_ATLsystem; }forEach _garrisonedBuilding_ATLsystem;
}; };

View File

@ -43,7 +43,7 @@ if !(isNull _group) then
_x params["_bldClassName","_bldRelPos","_bldDir","_s","_d","_p","_noStatics","_typesStatics","_noUnits"]; _x params["_bldClassName","_bldRelPos","_bldDir","_s","_d","_p","_noStatics","_typesStatics","_noUnits"];
if (_typesStatics isEqualTo []) then {_typesStatics = ["B_HMG_01_high_F"]}; if (_typesStatics isEqualTo []) then {_typesStatics = ["B_HMG_01_high_F"]};
_building = createVehicle[_bldClassName,[0,0,0],[],0,"CAN_COLLIDE"]; _building = createVehicle[_bldClassName,[0,0,0],[],0,"CAN_COLLIDE"];
_buildingsSpawned pushBack _building; _buildingsSpawned pushBack (netID _building);
_building setPosATL (_bldRelPos vectorAdd _center); _building setPosATL (_bldRelPos vectorAdd _center);
[_building, _bldDir] call blck_fnc_setDirUp; [_building, _bldDir] call blck_fnc_setDirUp;
_staticsSpawned = [_building,_group,_noStatics,_typesStatics,_noUnits,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,"none",_weaponList,_sideArms] call blck_fnc_spawnGarrisonInsideBuilding_relPos; _staticsSpawned = [_building,_group,_noStatics,_typesStatics,_noUnits,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,"none",_weaponList,_sideArms] call blck_fnc_spawnGarrisonInsideBuilding_relPos;

View File

@ -397,6 +397,7 @@ for "_i" from 1 to (count blck_activeMissionsList) do
}; };
try { try {
if (blck_debugLevel >= 4) throw 5;
private _playerIsNear = [_crates,20,true] call blck_fnc_playerInRangeArray; private _playerIsNear = [_crates,20,true] call blck_fnc_playerInRangeArray;
private _minNoAliveForCompletion = (count _blck_AllMissionAI) - (round(blck_killPercentage * (count _blck_AllMissionAI))); private _minNoAliveForCompletion = (count _blck_AllMissionAI) - (round(blck_killPercentage * (count _blck_AllMissionAI)));
private _aiKilled = if (({alive _x} count _blck_AllMissionAI) <= _minNoAliveForCompletion) then {true} else {false}; // mission complete private _aiKilled = if (({alive _x} count _blck_AllMissionAI) <= _minNoAliveForCompletion) then {true} else {false}; // mission complete
@ -555,6 +556,9 @@ for "_i" from 1 to (count blck_activeMissionsList) do
case 4: { // Reserved for grpNull errors in the future case 4: { // Reserved for grpNull errors in the future
}; };
case 5: {
[_coords,_mines,_objects,_hiddenObjects,_crates,_blck_AllMissionAI,_assetKilledMsg,_markers,markerPos (_markers select 1),_markerName,_markerMissionName, _exception] call blck_fnc_endMission;
}
}; };
}; };
}; };

View File

@ -40,5 +40,5 @@ _smoke setVariable ["LAST_CHECK", (diag_tickTime + 14400)];
_smoke setPos _posWreck; _smoke setPos _posWreck;
_smoke attachto [_fire, [0,0,1.5]]; _smoke attachto [_fire, [0,0,1.5]];
_objs = [_fire,_smoke]; _objs = [netID _fire,netID _smoke];
_objs _objs

View File

@ -40,7 +40,8 @@ private _hiddenObjs = [];
}; };
_obj = createVehicle[_className,[0,0,0],[],0,"CAN_COLLIDE"]; _obj = createVehicle[_className,[0,0,0],[],0,"CAN_COLLIDE"];
_obj setPosATL _objPos; _obj setPosATL _objPos;
_newObjs pushback _obj;
_newObjs pushback (netID _obj);
[_obj, _dir] call blck_fnc_setDirUp; [_obj, _dir] call blck_fnc_setDirUp;
_obj setVectorUp [0,0,1]; _obj setVectorUp [0,0,1];
_obj enableDynamicSimulation _sim; _obj enableDynamicSimulation _sim;

View File

@ -38,7 +38,7 @@ private _hiddenObjs = [];
_obj enableSimulationGlobal false; _obj enableSimulationGlobal false;
_obj enableDynamicSimulation false; _obj enableDynamicSimulation false;
_obj setDir (_obj getRelDir _coords); _obj setDir (_obj getRelDir _coords);
_newObjs pushback _obj; _newObjs pushback (netID _obj);
sleep 0.1; sleep 0.1;
} forEach _missionLandscape; } forEach _missionLandscape;

View File

@ -1,4 +1,4 @@
#define blck_buildNumber 227 #define blck_buildNumber 228 // Address issues with cleanup of objects
#define blck_versionNumber 7.02 #define blck_versionNumber 7.02
#define blck_buildDate "10-4-20" #define blck_buildDate "10-4-20"