mirror of
https://github.com/IT07/a3_vemf_reloaded.git
synced 2024-08-30 16:52:11 +00:00
Moved from CfgFunctions
This commit is contained in:
parent
fefe173e3d
commit
ec7c0074aa
38
exile_vemf_reloaded/sqf/REMOTEguard.sqf
Normal file
38
exile_vemf_reloaded/sqf/REMOTEguard.sqf
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
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
|
||||||
|
*/
|
||||||
|
|
||||||
|
[] spawn
|
||||||
|
{
|
||||||
|
uiNamespace setVariable ["VEMFrHcLoad", []];
|
||||||
|
uiNamespace setVariable ["vemfGroups", []];
|
||||||
|
while {true} do
|
||||||
|
{
|
||||||
|
_groups = uiNamespace getVariable "vemfGroups";
|
||||||
|
waitUntil { uiSleep 1; count _groups > 0 };
|
||||||
|
{
|
||||||
|
if (local _x) then
|
||||||
|
{
|
||||||
|
if ((count units _x) < 1) then
|
||||||
|
{
|
||||||
|
deleteGroup _x;
|
||||||
|
};
|
||||||
|
if (count (units _x) > 0) then
|
||||||
|
{
|
||||||
|
// Group still has units, check if there is anyone that can be the owner
|
||||||
|
[_x] call VEMFr_fnc_transferOwner;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach _groups;
|
||||||
|
};
|
||||||
|
};
|
70
exile_vemf_reloaded/sqf/checkLoot.sqf
Normal file
70
exile_vemf_reloaded/sqf/checkLoot.sqf
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
Author: IT07
|
||||||
|
|
||||||
|
Description:
|
||||||
|
checks the VEMF loot table for invalid classnames. Reports to RPT if invalid classes found.
|
||||||
|
|
||||||
|
Params:
|
||||||
|
none
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
nothing
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ("validateLoot" call VEMFr_fnc_getSetting isEqualTo 1) then
|
||||||
|
{ // _validateLoot is enabled, go ahead...
|
||||||
|
if ("debugMode" call VEMFr_fnc_getSetting < 1) then
|
||||||
|
{
|
||||||
|
["CheckLoot", 0, "Failed to validate loot: no output allowed in RPT"] spawn VEMFr_fnc_log;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
["CheckLoot", 1, "Validating loot tables..."] spawn VEMFr_fnc_log;
|
||||||
|
_invalidClasses = [];
|
||||||
|
|
||||||
|
_mags = [];
|
||||||
|
_cfgMags = "_mags pushBack (configName _x); true" configClasses (configFile >> "cfgMagazines");
|
||||||
|
|
||||||
|
_weapons = [];
|
||||||
|
_cfgWeapons = "_weapons pushBack (configName _x); true" configClasses (configFile >> "cfgWeapons");
|
||||||
|
|
||||||
|
_bags = [];
|
||||||
|
_cfgBags = "getText (_x >> 'vehicleClass') isEqualTo 'Backpacks'" configClasses (configFile >> "cfgVehicles");
|
||||||
|
{
|
||||||
|
_bags pushBack (configName _x);
|
||||||
|
} forEach _cfgBags;
|
||||||
|
|
||||||
|
_aiGear = [["aiGear"],["aiUniforms","aiVests","aiRifles","aiBackpacks","aiLaunchers","aiPistols"]] call VEMFr_fnc_getSetting;
|
||||||
|
{
|
||||||
|
{
|
||||||
|
if not((_x in _mags) OR (_x in _weapons) OR (_x in _bags)) then
|
||||||
|
{
|
||||||
|
_invalidClasses pushBack _x;
|
||||||
|
};
|
||||||
|
} forEach _x;
|
||||||
|
} forEach _aiGear;
|
||||||
|
|
||||||
|
_loot = [["crateLoot"],["primaryWeaponLoot","secondaryWeaponLoot","magazinesLoot","attachmentsLoot","itemsLoot","vestsLoot","headGearLoot","backpacksLoot"]] call VEMFr_fnc_getSetting;
|
||||||
|
{
|
||||||
|
{
|
||||||
|
_class = _x select 0;
|
||||||
|
if not((_class in _mags) OR (_class in _weapons) OR (_class in _bags)) then
|
||||||
|
{
|
||||||
|
_invalidClasses pushBack _x;
|
||||||
|
};
|
||||||
|
} forEach _x;
|
||||||
|
} forEach _loot;
|
||||||
|
|
||||||
|
_invalid = if (count _invalidClasses isEqualTo 0) then { false } else { true };
|
||||||
|
switch true do
|
||||||
|
{
|
||||||
|
case _invalid:
|
||||||
|
{
|
||||||
|
["CheckLoot", 0, format["Invalid classes found in loot! | %1", _invalidClasses]] spawn VEMFr_fnc_log;
|
||||||
|
};
|
||||||
|
case (not _invalid):
|
||||||
|
{
|
||||||
|
["CheckLoot", 1, "Loot tables are all valid :)"] spawn VEMFr_fnc_log;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
77
exile_vemf_reloaded/sqf/missionTimer.sqf
Normal file
77
exile_vemf_reloaded/sqf/missionTimer.sqf
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
/*
|
||||||
|
Author: IT07
|
||||||
|
|
||||||
|
Description:
|
||||||
|
Handles the start and timeout of missions
|
||||||
|
|
||||||
|
Params:
|
||||||
|
none
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
nothing
|
||||||
|
*/
|
||||||
|
|
||||||
|
_maxGlobalMissions = "maxGlobalMissions" call VEMFr_fnc_getSetting;
|
||||||
|
if (_maxGlobalMissions > 0) then
|
||||||
|
{
|
||||||
|
_minNew = "minNew" call VEMFr_fnc_getSetting;
|
||||||
|
if (_minNew > -1) then
|
||||||
|
{
|
||||||
|
_maxNew = "maxNew" call VEMFr_fnc_getSetting;
|
||||||
|
if (_maxNew > 0) then
|
||||||
|
{
|
||||||
|
_missionList = "missionList" call VEMFr_fnc_getSetting;
|
||||||
|
if (count _missionList > 0) then
|
||||||
|
{
|
||||||
|
[_maxGlobalMissions, _minNew, _maxNew, _missionList] spawn
|
||||||
|
{
|
||||||
|
_maxGlobalMissions = _this select 0;
|
||||||
|
_minNew = _this select 1;
|
||||||
|
_maxNew = _this select 2;
|
||||||
|
_missionList = _this select 3;
|
||||||
|
_minFps = "minServerFPS" call VEMFr_fnc_getSetting;
|
||||||
|
_minPlayers = "minPlayers" call VEMFr_fnc_getSetting;
|
||||||
|
waitUntil { uiSleep 5; (if (([_minPlayers] call VEMFr_fnc_playerCount) AND (diag_fps > _minFps)) then { true } else { false }) };
|
||||||
|
["missionTimer", 1, format["Enough players online (%1) and server FPS (%2) is above %3. Starting missionTimer...", count allPlayers, diag_fps, _minFps]] spawn VEMFr_fnc_log;
|
||||||
|
|
||||||
|
VEMFrMissionCount = 0;
|
||||||
|
private ["_ignoreLimit"];
|
||||||
|
_ignoreLimit = false;
|
||||||
|
if (_maxGlobalMissions isEqualTo 0) then
|
||||||
|
{
|
||||||
|
_ignoreLimit = true;
|
||||||
|
};
|
||||||
|
while {true} do
|
||||||
|
{
|
||||||
|
// Wait random amount
|
||||||
|
uiSleep ((_minNew*60)+ floor random ((_maxNew*60)-(_minNew*60)));
|
||||||
|
|
||||||
|
// Pick A Mission if enough players online
|
||||||
|
if ([_minPlayers] call VEMFr_fnc_playerCount) then
|
||||||
|
{
|
||||||
|
if _ignoreLimit then
|
||||||
|
{
|
||||||
|
_missionName = selectRandom _missionList;
|
||||||
|
[_missionName] execVM format["exile_vemf_reloaded\missions\%1.sqf", _missionName];
|
||||||
|
_lastMission = serverTime;
|
||||||
|
};
|
||||||
|
if not _ignoreLimit then
|
||||||
|
{
|
||||||
|
if (VEMFrMissionCount <= _maxGlobalMissions) then
|
||||||
|
{
|
||||||
|
_missionName = selectRandom _missionList;
|
||||||
|
[_missionName] execVM format["exile_vemf_reloaded\missions\%1.sqf", _missionName];
|
||||||
|
VEMFrMissionCount = VEMFrMissionCount +1;
|
||||||
|
_lastMission = serverTime;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
["missionTimer", 0, format["Invalid maximum global missions number! it is: %1", _maxGlobalMissions]] spawn VEMFr_fnc_log;
|
||||||
|
};
|
28
exile_vemf_reloaded/sqf/spawnStaticAI.sqf
Normal file
28
exile_vemf_reloaded/sqf/spawnStaticAI.sqf
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
Author: IT07
|
||||||
|
|
||||||
|
Description:
|
||||||
|
spawns AI at all given locations in config file
|
||||||
|
|
||||||
|
Params:
|
||||||
|
none
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
nothing
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ([["aiStatic"],["enabled"]] call VEMFr_fnc_getSetting isEqualTo 1) then
|
||||||
|
{
|
||||||
|
["spawnStaticAI", 3, "launching..."] spawn VEMFr_fnc_log;
|
||||||
|
_settings = [["aiStatic"],["positions","amount"]] call VEMFr_fnc_getSetting;
|
||||||
|
_positions = _settings select 0;
|
||||||
|
if (count _positions > 0) then
|
||||||
|
{
|
||||||
|
["spawnStaticAI", 3, "spawning AI on positions..."] spawn VEMFr_fnc_log;
|
||||||
|
_amounts = _settings select 1;
|
||||||
|
{
|
||||||
|
_amount = _amounts select _foreachindex;
|
||||||
|
[_x, 2, _amount / 2, "aiMode" call VEMFr_fnc_getSetting] spawn VEMFr_fnc_spawnAI;
|
||||||
|
} forEach _positions;
|
||||||
|
};
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user