mirror of
https://github.com/Defent/DMS_Exile.git
synced 2024-08-30 16:52:12 +00:00
CleanUpManager + Tweaks + Idiot-proofing
Created function CleanUpManager CleanUp will now throw an error for attempting cleanup on non-object CleanUp now uses CleanUpManager Use "select" instead of if-else for _safePosParams Removed "DMS_Mission_Arr is empty" logging because it will spam RPT
This commit is contained in:
parent
0b0c290495
commit
370825a7f9
@ -21,6 +21,7 @@ if(DMS_StaticMission) then {
|
||||
|
||||
if (DMS_DynamicMission) then {
|
||||
// Use FSM to spawn missions and check mission status instead
|
||||
|
||||
//call compileFinal preprocessFileLineNumbers "\x\addons\dms\missions\mission_init.sqf";
|
||||
//[1, DMS_MissionStatusCheck, [], true] call ExileServer_system_thread_addTask;
|
||||
};
|
||||
|
@ -6,6 +6,7 @@
|
||||
// Initialize Variables
|
||||
DMS_Mission_Arr = [];
|
||||
DMS_MissionCount = 0;
|
||||
DMS_CleanUpList = [];
|
||||
|
||||
/* compiles
|
||||
DMS_CreateMarker = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\DMS_CreateMarker.sqf";
|
||||
@ -27,10 +28,11 @@ load_ammo = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\loa
|
||||
|
||||
//Completed
|
||||
DMS_MissionStatusCheck = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\MissionStatusCheck.sqf";
|
||||
DMS_MissionSuccessState = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\MissionSuccessState.sqf";//<--- TODO
|
||||
DMS_MissionSuccessState = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\MissionSuccessState.sqf";
|
||||
DMS_findSafePos = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\FindSafePos.sqf";
|
||||
DMS_BroadcastMissionStatus = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\BroadcastMissionStatus.sqf";
|
||||
DMS_CleanUp = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\CleanUp.sqf";
|
||||
DMS_CleanUpManager = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\CleanUpManager.sqf";
|
||||
DMS_isPlayerNearbyARRAY = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\IsPlayerNearbyARRAY.sqf";
|
||||
DMS_FillCrate = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\FillCrate.sqf";
|
||||
DMS_isNearWater = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\IsNearWater.sqf";
|
||||
|
@ -37,8 +37,13 @@ if ([_this,20] call DMS_isPlayerNearbyARRAY) exitWith //<-----Not sure if it's m
|
||||
};
|
||||
*/
|
||||
|
||||
private "_skippedObjects";
|
||||
|
||||
_skippedObjects = [];
|
||||
|
||||
|
||||
{
|
||||
if ((typeName _x) isEqualTo "OBJECT") then {
|
||||
if !([_x,DMS_CleanUp_PlayerNearLimit] call ExileServer_util_position_isPlayerNearby) then {
|
||||
_x enableSimulationGlobal false;
|
||||
_x removeAllMPEventHandlers "mpkilled";
|
||||
@ -53,10 +58,21 @@ if ([_this,20] call DMS_isPlayerNearbyARRAY) exitWith //<-----Not sure if it's m
|
||||
_x removeAllEventHandlers "Local";
|
||||
deleteVehicle _x;
|
||||
} else {
|
||||
_skippedObjects pushBack _x;
|
||||
if (DMS_DEBUG) then
|
||||
{
|
||||
diag_log format ["DMS_DEBUG CleanUp :: Skipping cleanup for |%1|, player within %2 meters!",_this,DMS_CleanUp_PlayerNearLimit];
|
||||
};
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
diag_log format ["DMS ERROR :: Attempted to call DMS_CleanUp on non-object %1 from array %2",_x,_this];
|
||||
};
|
||||
|
||||
false;
|
||||
} count _this;
|
||||
|
||||
if !(_skippedObjects isEqualTo []) then {
|
||||
DMS_CleanUpList pushBack [_skippedObjects,diag_tickTime,30];
|
||||
};
|
52
@ExileServer/addons/a3_dms/scripts/CleanUpManager.sqf
Normal file
52
@ExileServer/addons/a3_dms/scripts/CleanUpManager.sqf
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
DMS_CleanUpManager
|
||||
Created by eraser1
|
||||
|
||||
Objects to be cleaned up together have an entry in "DMS_CleanUpList"
|
||||
The list is formatted as:
|
||||
[
|
||||
[
|
||||
_objectToClean1,
|
||||
_objectToClean2,
|
||||
...
|
||||
_objectToCleanN
|
||||
],
|
||||
_timeAddedToList,
|
||||
_timeUntilClean
|
||||
]
|
||||
|
||||
A single object can also be placed for (_this select 0)
|
||||
*/
|
||||
if (DMS_CleanUpList isEqualTo []) exitWith {}; // Empty array, no objects to clean :)
|
||||
|
||||
{
|
||||
if (DMS_DEBUG) then
|
||||
{
|
||||
diag_log format ["DMS_DEBUG CleanUpManager :: Checking Cleaning Status for: %1",_x];
|
||||
};
|
||||
private ["_objs","_timeAddedToList","_timeUntilClean"];
|
||||
_OK = params
|
||||
[
|
||||
["_objs",[objNull],[objNull,[]]],
|
||||
["_timeAddedToList",diag_tickTime,[0]],
|
||||
["_timeUntilClean",DMS_CompletedMissionCleanupTime,[0]]
|
||||
];
|
||||
if (!_OK) then
|
||||
{
|
||||
diag_log format ["DMS ERROR :: Invalid parameters for DMS_CleanUpManager: %1 replaced with %2",_x,[_objs,_timeAddedToList,_timeUntilClean]];
|
||||
};
|
||||
|
||||
if ((diag_tickTime-_timeAddedToList)>=_timeUntilClean) then
|
||||
{
|
||||
_objs call DMS_CleanUp;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DMS_DEBUG) then
|
||||
{
|
||||
diag_log format ["DMS_DEBUG CleanUpManager :: %1 is not yet ready to clean!",_x];
|
||||
};
|
||||
};
|
||||
|
||||
false;
|
||||
} count DMS_CleanUpList;
|
@ -19,11 +19,11 @@
|
||||
_markers
|
||||
]
|
||||
*/
|
||||
if (DMS_Mission_Arr isEqualTo []) exitWith
|
||||
if (DMS_Mission_Arr isEqualTo []) exitWith // Empty array, no missions running
|
||||
{
|
||||
if (DMS_DEBUG) then
|
||||
{
|
||||
diag_log "DMS_DEBUG MissionStatusCheck :: DMS_Mission_Arr is empty!";
|
||||
//diag_log "DMS_DEBUG MissionStatusCheck :: DMS_Mission_Arr is empty!";
|
||||
};
|
||||
};
|
||||
|
||||
@ -50,8 +50,9 @@ _index = 0;
|
||||
|
||||
if (_success) exitWith
|
||||
{
|
||||
//Use FSM instead
|
||||
//Use FSM for cleanup instead
|
||||
//[DMS_CompletedMissionCleanupTime,DMS_CleanUp,(_units+_buildings),false] call ExileServer_system_thread_addTask;
|
||||
DMS_CleanUpList pushBack [_units+_building,diag_tickTime,DMS_CompletedMissionCleanupTime];
|
||||
_arr = DMS_Mission_Arr deleteAt _index;
|
||||
|
||||
[_loot select 0,_crate_loot_values] call DMS_FillCrate;
|
||||
@ -76,6 +77,7 @@ _index = 0;
|
||||
|
||||
if ((diag_tickTime-_timeStarted)>_timeUntilFail) exitWith
|
||||
{
|
||||
//Nobody is nearby so just cleanup objects from here
|
||||
(_units+_buildings+_loot) call DMS_CleanUp;
|
||||
_arr = DMS_Mission_Arr deleteAt _index;
|
||||
|
||||
|
@ -14,11 +14,11 @@ private ["_nearestObjectMinDistance","_maxTerrainGradient","_safePosParams","_va
|
||||
|
||||
params [["_nearestObjectMinDistance",25,[0]],["_maxTerrainGradient",10,[0]]];
|
||||
|
||||
if (worldName=="Altis") then {
|
||||
_safePosParams = [[16000,16000],0,16000,_nearestObjectMinDistance,0,_maxTerrainGradient,0,DMS_findSafePosBlacklist];
|
||||
} else {
|
||||
_safePosParams = [[],0,-1,_nearestObjectMinDistance,0,_maxTerrainGradient,0,DMS_findSafePosBlacklist];
|
||||
};
|
||||
_safePosParams =
|
||||
[
|
||||
[[],0,-1,_nearestObjectMinDistance,0,_maxTerrainGradient,0,DMS_findSafePosBlacklist],
|
||||
[[16000,16000],0,16000,_nearestObjectMinDistance,0,_maxTerrainGradient,0,DMS_findSafePosBlacklist] //[16000,16000] w/ radius of 16000 works well for Altis
|
||||
] select (worldName=="Altis");
|
||||
|
||||
_validspot = false;
|
||||
_i = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user