DMS_Exile/@ExileServer/addons/a3_dms/scripts/fn_CleanUp.sqf
eraser1 8562289765 Some more required changes... sorry
* **You must update all of your mission files; the mission message
system as well as the calling parameters for DMS_fnc_FindSafePos have
been overhauled and will be incompatible with previous versions.**
* NEW CONFIG VALUES:

|DMS_ThrottleBlacklists|
|DMS_AttemptsUntilThrottle|
|DMS_ThrottleCoefficient|
|DMS_MinThrottledDistance|
* Decreased
"DMS_TraderZoneNearBlacklist","DMS_MissionNearBlacklist","DMS_WaterNearBlacklist"
* Changed "DMS_dynamicText_Color" to "#FFFFFF" (white)
* Replaced weapon classes in "DMS_CrateCase_Sniper" to the base classes;
all attachments should now spawn in the box separately.
* New function DMS_fnc_IsValidPosition (uses logic that was previously
from "DMS_fnc_FindSafePos").
* You can now manually define every individual parameter for
DMS_fnc_findSafePos per-mission, instead of using global parameters.
* AI will now be offloaded to an HC even with "DMS_ai_offload_to_client"
set to false.
* All of the previously "supported" values for
"DMS_PlayerNotificationTypes" are now PROPERLY supported.
DMS_PlayerNotificationTypes is now set to default "dynamicTextRequest"
and "systemChatRequest".
* Tweaked "cardealer" mission, the cars should no longer spawn inside of
each other.
2015-10-03 22:32:42 -05:00

108 lines
2.7 KiB
Plaintext

/*
DMS_fnc_CleanUp
Created by eraser1
Usage:
[
_objectOrGroup1,
_objectOrGroup2,
...
_objectOrGroupN
] call DMS_fnc_CleanUp;
Alternative Usage:
_objectOrGroup call DMS_fnc_CleanUp;
*/
if (DMS_DEBUG) then
{
diag_log ("DMS_DEBUG CleanUp :: CLEANING UP: "+str _this);
};
if !((typeName _this) == "ARRAY") then
{
_this = [_this];
};
private ["_skippedObjects","_clean"];
_skippedObjects = [];
_clean =
{
{
detach _x;
_x call _clean;
} forEach (attachedObjects _x);
_this enableSimulationGlobal false;
_this removeAllMPEventHandlers "mpkilled";
_this removeAllMPEventHandlers "mphit";
_this removeAllMPEventHandlers "mprespawn";
_this removeAllEventHandlers "FiredNear";
_this removeAllEventHandlers "HandleDamage";
_this removeAllEventHandlers "Killed";
_this removeAllEventHandlers "Fired";
_this removeAllEventHandlers "GetOut";
_this removeAllEventHandlers "GetIn";
_this removeAllEventHandlers "Local";
deleteVehicle _this;
};
{
if ((typeName _x) == "OBJECT") then
{
if (isNull _x) exitWith {};
if !([_x,DMS_CleanUp_PlayerNearLimit] call DMS_fnc_IsPlayerNearby) then
{
_x call _clean;
}
else
{
_skippedObjects pushBack _x;
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG CleanUp :: Skipping cleanup for |%1|, player within %2 meters!",_x,DMS_CleanUp_PlayerNearLimit];
};
};
}
else
{
if ((typeName _x) == "GROUP") exitWith
{
if (!isNull _x) then
{
// Group cleanup should only be called when it has to be deleted regardless, so no need to check for nearby players
{
_x call _clean;
} forEach (units _x);
if(local _x)then
{
deleteGroup _x;
}
else
{
[groupOwner _x,"DeleteGroupPlz",[_x]] call ExileServer_system_network_send_to;
};
};
};
if ((typeName _x) == "ARRAY") exitWith
{
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG CleanUp :: Doing recursive call for ARRAY: %1",_x];
};
_x call DMS_fnc_CleanUp;
};
diag_log format ["DMS ERROR :: Attempted to call DMS_fnc_CleanUp on non- group or object %1 from array %2",_x,_this];
};
} forEach _this;
if !(_skippedObjects isEqualTo []) then
{
DMS_CleanUpList pushBack [_skippedObjects,diag_tickTime,30];
};