From 62fa9184bf9523f5f804b80596d024eba146f864 Mon Sep 17 00:00:00 2001 From: Chris Cardozo Date: Sun, 4 Oct 2020 15:49:31 -0400 Subject: [PATCH 1/5] Addressed minor scripting issues; added logging of time spent on searching for new posn. --- .../Functions/GMS_fnc_findSafePosn_4.sqf | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_findSafePosn_4.sqf b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_findSafePosn_4.sqf index a86baf8..98e1a23 100644 --- a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_findSafePosn_4.sqf +++ b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_findSafePosn_4.sqf @@ -13,12 +13,12 @@ http://creativecommons.org/licenses/by-nc-sa/4.0/ */ #include "\q\addons\custom_server\Configs\blck_defines.hpp"; - +private _startTime = diag_tickTime; private _minDistFromBases = blck_minDistanceToBases; private _minDistFromMission = blck_MinDistanceFromMission; private _minDistanceFromTowns = blck_minDistanceFromTowns; private _minDistanceFromPlayers = blck_minDistanceToPlayer; -//private _blacklistedLocations = +blck_minDistanceFromTowns; + private _weightBlckList = 0.95; private _weightBases = 0.9; private _weightMissions = 0.8; @@ -27,10 +27,6 @@ private _weightPlayers = 0.6; private _weightRecentMissions = 0.6; 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 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)]; _coords = [_searchCenter,0,_searchDist,_minObjDist,_waterMode,_maxGrad,_shoreMode] call BIS_fnc_findSafePos; _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 { _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 (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 { _findNew = true; @@ -96,13 +93,17 @@ while {_coords isEqualTo []} do 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 { _findNew = true; if (blck_debugLevel >= 3) then {[format["_findSafePosn(98): too close to bases"]] call blck_fnc_log}; }; - }forEach (allmissionobjects _pole); + }forEach _poles; }; if !(_findNew) then @@ -163,7 +164,6 @@ while {_coords isEqualTo []} do _minDistanceRecentMissions = _minDistanceRecentMissions * _weightRecentMissions; _coords = []; }; - [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]; _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; From 69316952955c74fa86e84b25eaf1887374a2c407 Mon Sep 17 00:00:00 2001 From: Chris Cardozo Date: Sun, 4 Oct 2020 15:50:13 -0400 Subject: [PATCH 2/5] Bug fixes. Added check for unexpected case where the thing to be deleted is stored as an object rather than netID --- .../Compiles/Missions/GMS_fnc_cleanUpObjects.sqf | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_cleanUpObjects.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_cleanUpObjects.sqf index 4539468..5f3f125 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_cleanUpObjects.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_cleanUpObjects.sqf @@ -27,13 +27,7 @@ for "_i" from 1 to (count blck_oldMissionObjects) do { { { if (typeName _x isEqualTo "OBJECT") then {deleteVehicle _x}; - if (_x isEqualType []) then - { - //[format["_fnc_cleanUpObjects: case of _x is array: %1",_x]] call blck_fnc_log; - { - if (typeName _x isEqualTo "OBJECT") then {deleteVehicle _x}; - } forEach _x; - }; + if (typeName _x isEqualTo "STRING") then {deleteVehicle (objectFromNetId _x)}; } forEach _objarr; } else { blck_oldMissionObjects pushback _oldObjs; From 34204ccdc67e4a06601d6ba0a371b3f84f89f3fd Mon Sep 17 00:00:00 2001 From: Chris Cardozo Date: Sun, 4 Oct 2020 15:50:48 -0400 Subject: [PATCH 3/5] Added Case for debugging with forced completion of spawned mission. --- .../Compiles/Missions/GMS_fnc_endMission.sqf | 10 ++++++++++ .../Missions/GMS_fnc_monitorInitializedMissions.sqf | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_endMission.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_endMission.sqf index a8be680..7950fa9 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_endMission.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_endMission.sqf @@ -161,6 +161,16 @@ switch (_endCondition) do [_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; + }; }; blck_missionsRun = blck_missionsRun + 1; diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_monitorInitializedMissions.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_monitorInitializedMissions.sqf index 0d516fb..0dee976 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_monitorInitializedMissions.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_monitorInitializedMissions.sqf @@ -397,6 +397,7 @@ for "_i" from 1 to (count blck_activeMissionsList) do }; try { + if (blck_debugLevel >= 4) throw 5; private _playerIsNear = [_crates,20,true] call blck_fnc_playerInRangeArray; 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 @@ -555,6 +556,9 @@ for "_i" from 1 to (count blck_activeMissionsList) do 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; + } }; }; }; From ca8105c492a4543124256f66f7a04e31a77d284e Mon Sep 17 00:00:00 2001 From: Chris Cardozo Date: Sun, 4 Oct 2020 15:51:28 -0400 Subject: [PATCH 4/5] store spawned objects as netID This is to try to make sure damaged buildings and other damaged objects are deleted upon mission completion. --- .../Compiles/Missions/GMS_fnc_garrisonBuilding_ATLsystem.sqf | 2 +- .../Missions/GMS_fnc_garrisonBuilding_relPosSystem.sqf | 2 +- .../custom_server/Compiles/Missions/GMS_fnc_smokeAtCrates.sqf | 2 +- .../Compiles/Missions/GMS_fnc_spawnCompositionObjects.sqf | 3 ++- .../Compiles/Missions/GMS_fnc_spawnRandomLandscape.sqf | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_garrisonBuilding_ATLsystem.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_garrisonBuilding_ATLsystem.sqf index b7daa0c..052fd6f 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_garrisonBuilding_ATLsystem.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_garrisonBuilding_ATLsystem.sqf @@ -40,7 +40,7 @@ if !(isNull _group) then _building = createVehicle[_bldClassName,[0,0,0],[],0,"CAN_COLLIDE"]; _building setPosATL (_bldRelPos vectorAdd _center); _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; }forEach _garrisonedBuilding_ATLsystem; }; diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_garrisonBuilding_relPosSystem.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_garrisonBuilding_relPosSystem.sqf index 2969fbc..a792b95 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_garrisonBuilding_relPosSystem.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_garrisonBuilding_relPosSystem.sqf @@ -43,7 +43,7 @@ if !(isNull _group) then _x params["_bldClassName","_bldRelPos","_bldDir","_s","_d","_p","_noStatics","_typesStatics","_noUnits"]; if (_typesStatics isEqualTo []) then {_typesStatics = ["B_HMG_01_high_F"]}; _building = createVehicle[_bldClassName,[0,0,0],[],0,"CAN_COLLIDE"]; - _buildingsSpawned pushBack _building; + _buildingsSpawned pushBack (netID _building); _building setPosATL (_bldRelPos vectorAdd _center); [_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; diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_smokeAtCrates.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_smokeAtCrates.sqf index c76f6c3..d463c34 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_smokeAtCrates.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_smokeAtCrates.sqf @@ -40,5 +40,5 @@ _smoke setVariable ["LAST_CHECK", (diag_tickTime + 14400)]; _smoke setPos _posWreck; _smoke attachto [_fire, [0,0,1.5]]; -_objs = [_fire,_smoke]; +_objs = [netID _fire,netID _smoke]; _objs diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnCompositionObjects.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnCompositionObjects.sqf index 4cb2403..56f2841 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnCompositionObjects.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnCompositionObjects.sqf @@ -40,7 +40,8 @@ private _hiddenObjs = []; }; _obj = createVehicle[_className,[0,0,0],[],0,"CAN_COLLIDE"]; _obj setPosATL _objPos; - _newObjs pushback _obj; + + _newObjs pushback (netID _obj); [_obj, _dir] call blck_fnc_setDirUp; _obj setVectorUp [0,0,1]; _obj enableDynamicSimulation _sim; diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnRandomLandscape.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnRandomLandscape.sqf index d666355..42ef8a1 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnRandomLandscape.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnRandomLandscape.sqf @@ -38,7 +38,7 @@ private _hiddenObjs = []; _obj enableSimulationGlobal false; _obj enableDynamicSimulation false; _obj setDir (_obj getRelDir _coords); - _newObjs pushback _obj; + _newObjs pushback (netID _obj); sleep 0.1; } forEach _missionLandscape; From e12d256057ec61f1a093889d12403eca89028f6f Mon Sep 17 00:00:00 2001 From: Chris Cardozo Date: Sun, 4 Oct 2020 15:51:37 -0400 Subject: [PATCH 5/5] Build 228 --- @GMS/addons/custom_server/init/build.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/@GMS/addons/custom_server/init/build.sqf b/@GMS/addons/custom_server/init/build.sqf index 61585c4..0e1ad01 100644 --- a/@GMS/addons/custom_server/init/build.sqf +++ b/@GMS/addons/custom_server/init/build.sqf @@ -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_buildDate "10-4-20"