a3_vemf_reloaded/exile_vemf_reloaded/sqf/REMOTEguard.sqf
IT07 ea729141c2 Revert "Download v0744.0"
This reverts commit 939b2ce7e4.
2016-06-23 22:56:03 +02:00

39 lines
1.5 KiB
Plaintext

/*
Author: IT07
Description:
this function makes sure that AI spawned by VEMF does NOT become local to the server.
On detection of a local group, it will reassign it to a client or Headless Client if enabled.
Params:
none, this is a Standalone function
Returns:
nothing
*/
uiNamespace setVariable ["VEMFrHcLoad", []];
while {true} do
{
if ((count playableUnits) > 0) then
{
waitUntil {if ((count allGroups) > 0) then {uiSleep 0.25; true} else {uiSleep 0.5; false} };
{
if ((local _x) AND (_x getVariable ["isVEMFrGroup",false])) then
{
if ((count (units _x)) > 0) then
{
["REMOTEguard",1,format["Attempting to transfer group: %1", _x]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
// Group still has units, check if there is anyone that can be the owner
_handle = [_x] ExecVM "exile_vemf_reloaded\sqf\setGroupOwner.sqf";
waitUntil { if (scriptDone _handle) then {true} else {uiSleep 0.1; false} };
["REMOTEguard",1,format["Transfer attempted. Group (%1) is %2", _x, if (local _x) then {"still local!"} else {"now REMOTE"}]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
} else
{
deleteGroup _x;
};
};
} forEach allGroups;
} else { uiSleep 5 };
};