Improved performance and speed

This commit is contained in:
IT07 2016-04-16 13:11:18 +02:00
parent 5c53f35ab6
commit fcc7f91f00
6 changed files with 279 additions and 286 deletions

View File

@ -16,36 +16,33 @@ if (_this isEqualType "") then
_cfg = configFile >> "CfgVehicles" >> _this >> "faction";
if not isNull _cfg then
{
scopeName "isNull";
private ["_faction"];
_faction = getText _cfg;
switch _faction do
if (_faction isEqualTo "BLU_G_F") then
{
case "BLU_G_F":
{
_return = WEST;
};
case "CIV_F":
{
_return = civilian;
};
case "IND_F":
{
_return = independent;
};
case "IND_G_F":
{
_return = resistance;
};
case "OPF_F":
{
_return = EAST;
};
default
{
["fn_checkSide", 0, format["Fatal error; Unknown faction '%1'", _faction]] spawn VEMFr_fnc_log;
};
_return = WEST;
breakOut "isNull";
};
if (_faction isEqualTo "CIV_F") then
{
_return = civilian;
breakOut "isNull";
};
if (_faction isEqualTo "IND_F") then
{
_return = independent;
breakOut "isNull";
};
if (_faction isEqualTo "IND_G_F") then
{
_return = resistance;
breakOut "isNull";
};
if (_faction isEqualTo "OPF_F") then
{
_return = EAST;
};
};
_return
};
_return

View File

@ -9,54 +9,57 @@
uiNamespace setVariable ["VEMFrUsedLocs", []];
uiNamespace setVariable ["VEMFrHcLoad", []];
if ("overridesToRPT" call VEMFr_fnc_getSetting isEqualTo 1) then
[] spawn
{
_root = configProperties [configFile >> "CfgVemfReloaded" >> "CfgSettingsOverride", "true", false];
if (count _root > 0) then
if ("overridesToRPT" call VEMFr_fnc_getSetting isEqualTo 1) then
{
_root = configProperties [configFile >> "CfgVemfReloaded" >> "CfgSettingsOverride", "true", false];
if (count _root > 0) then
{
if (isClass _x) then
{
_classLv1Name = configName _x;
_levelOne = configProperties [configFile >> "CfgVemfReloaded" >> "CfgSettingsOverride" >> _classLv1Name, "true", false];
if (count _levelOne > 0) then
if (isClass _x) then
{
_classLv1Name = configName _x;
_levelOne = configProperties [configFile >> "CfgVemfReloaded" >> "CfgSettingsOverride" >> _classLv1Name, "true", false];
if (count _levelOne > 0) then
{
if (isClass _x) then
{
_classLv2Name = configName _x;
_levelTwo = configProperties [configFile >> "CfgVemfReloaded" >> "CfgSettingsOverride" >> _classLv1Name >> _classLv2Name, "true", false];
if (count _levelTwo > 0) then
if (isClass _x) then
{
_classLv2Name = configName _x;
_levelTwo = configProperties [configFile >> "CfgVemfReloaded" >> "CfgSettingsOverride" >> _classLv1Name >> _classLv2Name, "true", false];
if (count _levelTwo > 0) then
{
if not(isClass _x) then
{
["overridesToRPT", 1, format["Overriding 'CfgVemfReloaded >> %1 >> %2 >> %3'", _classLv1Name, _classLv2Name, configName _x]] spawn VEMFr_fnc_log;
};
} forEach _levelTwo;
if not(isClass _x) then
{
["overridesToRPT", 1, format["Overriding 'CfgVemfReloaded >> %1 >> %2 >> %3'", _classLv1Name, _classLv2Name, configName _x]] spawn VEMFr_fnc_log;
};
} forEach _levelTwo;
};
};
};
if not(isClass _x) then
{
["overridesToRPT", 1, format["Overriding 'CfgVemfReloaded >> %1 >> %2", _classLv1Name, configName _x]] spawn VEMFr_fnc_log;
};
} forEach _levelOne;
if not(isClass _x) then
{
["overridesToRPT", 1, format["Overriding 'CfgVemfReloaded >> %1 >> %2", _classLv1Name, configName _x]] spawn VEMFr_fnc_log;
};
} forEach _levelOne;
};
};
};
if not(isClass _x) then
{
["overridesToRPT", 1, format["Overriding 'CfgVemfReloaded >> %1'", configName _x]] spawn VEMFr_fnc_log;
};
} forEach _root;
if not(isClass _x) then
{
["overridesToRPT", 1, format["Overriding 'CfgVemfReloaded >> %1'", configName _x]] spawn VEMFr_fnc_log;
};
} forEach _root;
};
};
_scripts = ["checkLoot","missionTimer","REMOTEguard","spawnStaticAI"];
{
private ["_script"];
_script = [] ExecVM format["exile_vemf_reloaded\sqf\%1.sqf", _x];
waitUntil { uiSleep 0.5; scriptDone _script };
} forEach _scripts;
west setFriend [independent, 0];
independent setFriend [west, 0];
};
_scripts = ["checkLoot","missionTimer","REMOTEguard","spawnStaticAI"];
{
private ["_script"];
_script = [] ExecVM format["exile_vemf_reloaded\sqf\%1.sqf", _x];
waitUntil { uiSleep 0.5; scriptDone _script };
} forEach _scripts;
west setFriend [independent, 0];
independent setFriend [west, 0];

View File

@ -27,202 +27,198 @@ if (_this isEqualType []) then
_missionName = param [1, "", [""]];
if (_missionName in ("missionList" call VEMFr_fnc_getSetting) OR _missionName isEqualTo "Static") then
{
scopeName "this";
private ["_aiMode"];
_aiMode = param [2, 0, [0]];
switch _aiMode do
if (_aiMode isEqualTo 0) then
{
case 0:
private ["_aiGear","_uniforms","_headGear","_vests","_backpacks","_rifles","_pistols","_aiLaunchers","_launchers","_launcherChance"];
// Define settings
_aiGear = [["aiGear"],["aiUniforms","aiHeadGear","aiVests","aiBackpacks","aiLaunchers","aiRifles","aiPistols"]] call VEMFr_fnc_getSetting;
_uniforms = _aiGear select 0;
_headGear = _aiGear select 1;
_vests = _aiGear select 2;
_backpacks = _aiGear select 3;
_rifles = _aiGear select 5;
_pistols = _aiGear select 6;
_aiLaunchers = ([[_missionName],["aiLaunchers"]] call VEMFr_fnc_getSetting) select 0;
if (_aiLaunchers isEqualTo 1) then
{
private ["_aiGear","_uniforms","_headGear","_vests","_backpacks","_rifles","_pistols","_aiLaunchers","_launchers","_launcherChance"];
// Define settings
_aiGear = [["aiGear"],["aiUniforms","aiHeadGear","aiVests","aiBackpacks","aiLaunchers","aiRifles","aiPistols"]] call VEMFr_fnc_getSetting;
_uniforms = _aiGear select 0;
_headGear = _aiGear select 1;
_vests = _aiGear select 2;
_backpacks = _aiGear select 3;
_rifles = _aiGear select 5;
_pistols = _aiGear select 6;
_aiLaunchers = ([[_missionName],["aiLaunchers"]] call VEMFr_fnc_getSetting) select 0;
_launchers = _aiGear select 4;
_launcherChance = ([["DynamicLocationInvasion"],["hasLauncherChance"]] call VEMFr_fnc_getSetting) select 0;
};
{
private ["_unit","_gear","_ammo"];
_unit = _x;
// Strip it
removeAllWeapons _unit;
removeAllItems _unit;
if ("removeAllAssignedItems" call VEMFr_fnc_getSetting isEqualTo 1) then
{
removeAllAssignedItems _unit;
};
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeGoggles _unit;
removeHeadGear _unit;
_gear = selectRandom _uniforms;
_unit forceAddUniform _gear; // Give the poor naked guy some clothing :)
_gear = selectRandom _headGear;
_unit addHeadGear _gear;
_gear = selectRandom _vests;
_unit addVest _gear;
if (_aiLaunchers isEqualTo 1) then
{
_launchers = _aiGear select 4;
_launcherChance = ([["DynamicLocationInvasion"],["hasLauncherChance"]] call VEMFr_fnc_getSetting) select 0;
};
{
private ["_unit","_gear","_ammo"];
_unit = _x;
// Strip it
removeAllWeapons _unit;
removeAllItems _unit;
if ("removeAllAssignedItems" call VEMFr_fnc_getSetting isEqualTo 1) then
if (_launcherChance isEqualTo 100 OR (ceil random (100 / _launcherChance) isEqualTo (ceil random (100 / _launcherChance)))) then
{
removeAllAssignedItems _unit;
};
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeGoggles _unit;
removeHeadGear _unit;
_gear = selectRandom _uniforms;
_unit forceAddUniform _gear; // Give the poor naked guy some clothing :)
_gear = selectRandom _headGear;
_unit addHeadGear _gear;
_gear = selectRandom _vests;
_unit addVest _gear;
if (_aiLaunchers isEqualTo 1) then
{
if (_launcherChance isEqualTo 100 OR (ceil random (100 / _launcherChance) isEqualTo (ceil random (100 / _launcherChance)))) then
_gear = selectRandom _backpacks;
_unit addBackpack _gear;
private ["_ammo"];
_gear = selectRandom _launchers;
_unit addWeapon _gear;
_ammo = getArray (configFile >> "cfgWeapons" >> _gear >> "magazines");
if (count _ammo > 2) then
{
_gear = selectRandom _backpacks;
_unit addBackpack _gear;
private ["_ammo"];
_gear = selectRandom _launchers;
_unit addWeapon _gear;
_ammo = getArray (configFile >> "cfgWeapons" >> _gear >> "magazines");
if (count _ammo > 2) then
{
_ammo resize 2;
};
for "_i" from 0 to (2 + (round random 1)) do
{
_unit addMagazine (selectRandom _ammo);
};
_ammo resize 2;
};
for "_i" from 0 to (2 + (round random 1)) do
{
_unit addMagazine (selectRandom _ammo);
};
};
};
// Add Weapons & Ammo
_gear = selectRandom _rifles;
_unit addWeapon _gear;
_unit selectWeapon _gear;
// Add Weapons & Ammo
_gear = selectRandom _rifles;
_unit addWeapon _gear;
_unit selectWeapon _gear;
_gear = selectRandom _pistols;
_unit addWeapon _gear;
_gear = selectRandom _pistols;
_unit addWeapon _gear;
// Give this guy some ammo
_givenAmmo = [_unit] call VEMFr_fnc_giveAmmo;
if not _givenAmmo then
{
["fn_loadInv", 0, format["FAILED to give ammo to AI: %1", _unit]] spawn VEMFr_fnc_log;
};
// Give this guy some weaponItems
_giveAttachments = [_unit] call VEMFr_fnc_giveWeaponItems;
if not _giveAttachments then
{
["fn_loadInv", 0, format["FAILED to giveWeaponItems to %1", _unit]] spawn VEMFr_fnc_log;
};
} forEach _units;
_ok = true;
};
case 1:
{
private ["_policeGear","_headGear","_vests","_uniforms","_rifles","_pistols","_backpacks"];
_policeGear = [["policeConfig"],["headGear","vests","uniforms","rifles","pistols","backpacks"]] call VEMFr_fnc_getSetting;
_headGear = _policeGear select 0;
_vests = _policeGear select 1;
_uniforms = _policeGear select 2;
_rifles = _policeGear select 3;
_pistols = _policeGear select 4;
_backpacks = _policeGear select 5;
// Give this guy some ammo
_givenAmmo = [_unit] call VEMFr_fnc_giveAmmo;
if not _givenAmmo then
{
private ["_unit","_hat","_vest","_uniform","_rifle","_pistol","_backpack","_givenAmmo","_giveAttachments"];
_unit = _x;
// Strip it
removeAllWeapons _unit;
removeAllItems _unit;
if ("removeAllAssignedItems" call VEMFr_fnc_getSetting isEqualTo 1) then
{
removeAllAssignedItems _unit;
};
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeGoggles _unit;
removeHeadGear _unit;
_hat = selectRandom _headGear;
_unit addHeadGear _hat;
_vest = selectRandom _vests;
_unit addVest _vest;
_uniform = selectRandom _uniforms;
_unit forceAddUniform _uniform;
_rifle = selectRandom _rifles;
_unit addWeapon _rifle;
_unit selectWeapon _rifle;
_pistol = selectRandom _pistols;
_unit addWeapon _pistol;
_backpack = selectRandom _backpacks;
_unit addBackPack _backpack;
// Give this guy some ammo
_givenAmmo = [_unit] call VEMFr_fnc_giveAmmo;
if not _givenAmmo then
{
["fn_loadInv", 0, format["FAILED to give ammo to AI: %1", _unit]] spawn VEMFr_fnc_log;
};
// Give this guy some weaponItems
_giveAttachments = [_unit] call VEMFr_fnc_giveWeaponItems;
if not _giveAttachments then
{
["fn_loadInv", 0, format["FAILED to giveWeaponItems to %1", _unit]] spawn VEMFr_fnc_log;
};
} forEach _units;
_ok = true;
};
case 2:
{
private ["_policeGear","_rifles","_pistols"];
_policeGear = [["policeConfig"],["rifles","pistols"]] call VEMFr_fnc_getSetting;
_rifles = _policeGear select 0;
_pistols = _policeGear select 1;
["fn_loadInv", 0, format["FAILED to give ammo to AI: %1", _unit]] spawn VEMFr_fnc_log;
};
// Give this guy some weaponItems
_giveAttachments = [_unit] call VEMFr_fnc_giveWeaponItems;
if not _giveAttachments then
{
private ["_unit","_rifle","_pistol","_givenAmmo","_giveAttachments"];
_unit = _x;
// Strip it
removeAllWeapons _unit;
removeAllItems _unit;
if ("removeAllAssignedItems" call VEMFr_fnc_getSetting isEqualTo 1) then
{
removeAllAssignedItems _unit;
};
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeGoggles _unit;
removeHeadGear _unit;
_unit addHeadGear "H_HelmetB_light_black";
_unit addGoggles "G_Balaclava_blk";
_unit addVest "V_PlateCarrier2_blk";
_unit forceAddUniform "Exile_Uniform_ExileCustoms";
_rifle = selectRandom _rifles;
["fn_loadInv", 0, format["FAILED to giveWeaponItems to %1", _unit]] spawn VEMFr_fnc_log;
};
} forEach _units;
_ok = true;
breakOut "this";
};
if (_aiMode isEqualTo 1) then
{
private ["_policeGear","_headGear","_vests","_uniforms","_rifles","_pistols","_backpacks"];
_policeGear = [["policeConfig"],["headGear","vests","uniforms","rifles","pistols","backpacks"]] call VEMFr_fnc_getSetting;
_headGear = _policeGear select 0;
_vests = _policeGear select 1;
_uniforms = _policeGear select 2;
_rifles = _policeGear select 3;
_pistols = _policeGear select 4;
_backpacks = _policeGear select 5;
{
private ["_unit","_hat","_vest","_uniform","_rifle","_pistol","_backpack","_givenAmmo","_giveAttachments"];
_unit = _x;
// Strip it
removeAllWeapons _unit;
removeAllItems _unit;
if ("removeAllAssignedItems" call VEMFr_fnc_getSetting isEqualTo 1) then
{
removeAllAssignedItems _unit;
};
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeGoggles _unit;
removeHeadGear _unit;
_hat = selectRandom _headGear;
_unit addHeadGear _hat;
_vest = selectRandom _vests;
_unit addVest _vest;
_uniform = selectRandom _uniforms;
_unit forceAddUniform _uniform;
_rifle = selectRandom _rifles;
_unit addWeapon _rifle;
_unit selectWeapon _rifle;
_pistol = selectRandom _pistols;
_pistol = selectRandom _pistols;
_unit addWeapon _pistol;
_backpack = selectRandom _backpacks;
_unit addBackPack _backpack;
// Give this guy some ammo
_givenAmmo = [_unit] call VEMFr_fnc_giveAmmo;
if not _givenAmmo then
{
["fn_loadInv", 0, format["FAILED to give ammo to AI: %1", _unit]] spawn VEMFr_fnc_log;
};
// Give this guy some weaponItems
_giveAttachments = [_unit] call VEMFr_fnc_giveWeaponItems;
if not _giveAttachments then
{
["fn_loadInv", 0, format["FAILED to giveWeaponItems to %1", _unit]] spawn VEMFr_fnc_log;
};
} forEach _units;
_ok = true;
};
default
// Give this guy some ammo
_givenAmmo = [_unit] call VEMFr_fnc_giveAmmo;
if not _givenAmmo then
{
["fn_loadInv", 0, format["FAILED to give ammo to AI: %1", _unit]] spawn VEMFr_fnc_log;
};
// Give this guy some weaponItems
_giveAttachments = [_unit] call VEMFr_fnc_giveWeaponItems;
if not _giveAttachments then
{
["fn_loadInv", 0, format["FAILED to giveWeaponItems to %1", _unit]] spawn VEMFr_fnc_log;
};
} forEach _units;
_ok = true;
breakOut "this";
};
if (_aiMode isEqualTo 2) then
{
private ["_policeGear","_rifles","_pistols"];
_policeGear = [["policeConfig"],["rifles","pistols"]] call VEMFr_fnc_getSetting;
_rifles = _policeGear select 0;
_pistols = _policeGear select 1;
{
["fn_loadInv", 0, format["Incorrect _aiMode (%1) given!", _aiMode]] spawn VEMFr_fnc_log;
};
private ["_unit","_rifle","_pistol","_givenAmmo","_giveAttachments"];
_unit = _x;
// Strip it
removeAllWeapons _unit;
removeAllItems _unit;
if ("removeAllAssignedItems" call VEMFr_fnc_getSetting isEqualTo 1) then
{
removeAllAssignedItems _unit;
};
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeGoggles _unit;
removeHeadGear _unit;
_unit addHeadGear "H_HelmetB_light_black";
_unit addGoggles "G_Balaclava_blk";
_unit addVest "V_PlateCarrier2_blk";
_unit forceAddUniform "Exile_Uniform_ExileCustoms";
_rifle = selectRandom _rifles;
_unit addWeapon _rifle;
_unit selectWeapon _rifle;
_pistol = selectRandom _pistols;
_unit addWeapon _pistol;
// Give this guy some ammo
_givenAmmo = [_unit] call VEMFr_fnc_giveAmmo;
if not _givenAmmo then
{
["fn_loadInv", 0, format["FAILED to give ammo to AI: %1", _unit]] spawn VEMFr_fnc_log;
};
// Give this guy some weaponItems
_giveAttachments = [_unit] call VEMFr_fnc_giveWeaponItems;
if not _giveAttachments then
{
["fn_loadInv", 0, format["FAILED to giveWeaponItems to %1", _unit]] spawn VEMFr_fnc_log;
};
} forEach _units;
_ok = true;
};
};
};

View File

@ -14,38 +14,35 @@
nothing (use spawn, not call)
*/
private ["_loggingEnabled"];
_loggingEnabled = "debugMode" call VEMFr_fnc_getSetting;
if not(_loggingEnabled isEqualTo 0) then
if ("debugMode" call VEMFr_fnc_getSetting > 0) then
{
scopeName "outer";
private ["_prefix","_type","_line","_doLog"];
_prefix = param [0, "", [""]];
_type = param [1, 3, [0]];
_line = param [2, "", [""]];
_doLog =
{
diag_log text format["IT07: [exile_vemf_reloaded] %1 -- %2", _prefix, _line];
};
switch _type do
_doLog = { diag_log text format["IT07: [exile_vemf_reloaded] %1 -- %2", _prefix, _line] };
_debugMode = "debugMode" call VEMFr_fnc_getSetting;
if (_type isEqualTo 0) then
{
case 0:
{
if (_loggingEnabled isEqualTo 1 OR _loggingEnabled isEqualTo 3) then
{
call _doLog;
};
};
case 1:
{
if (_loggingEnabled isEqualTo 2 OR _loggingEnabled isEqualTo 3) then
{
call _doLog;
};
};
case 2:
if (_debugMode isEqualTo 1 OR _debugMode isEqualTo 3) then
{
call _doLog;
breakOut "outer";
};
};
if (_type isEqualTo 1) then
{
if (_debugMode isEqualTo 2 OR _debugMode isEqualTo 3) then
{
call _doLog;
breakOut "outer";
};
};
if (_type isEqualTo 2) then // This bypasses _debugMode setting. Always logs given params even if debugMode is set to 0
{
call _doLog;
breakOut "outer";
};
};

View File

@ -6,6 +6,7 @@ if isNil"VEMFrInvasionCount" then { VEMFrInvasionCount = 0; };
_missionName = param [0, "", [""]];
if (VEMFrInvasionCount < (([[_missionName],["maxInvasions"]] call VEMFr_fnc_getSetting) select 0)) then
{
scopeName "outer";
VEMFrInvasionCount = VEMFrInvasionCount + 1;
private ["_settings","_grpCount","_groupUnits","_skipDistance","_loc","_hasPlayers","_spawned","_grpArr","_unitArr","_done","_boxes","_box","_chute","_colors","_lightType","_light","_smoke"];
// Define _settings
@ -63,20 +64,24 @@ if (VEMFrInvasionCount < (([[_missionName],["maxInvasions"]] call VEMFr_fnc_getS
_marker = createMarker [format["VEMFr_DynaLocInva_ID%1", random 9000], _locPos];
_marker setMarkerShape "ICON";
_marker setMarkerType "o_unknown";
switch true do
if (_mode < 0 OR _mode > 2) then
{
case (_mode isEqualTo 0):
{
_marker setMarkerColor "ColorEAST";
};
case (_mode isEqualTo 1):
{
_marker setMarkerColor "ColorWEST";
};
case (_mode isEqualTo 2):
{
_marker setMarkerColor "ColorBlack";
};
["DynamicLocationInvasion", 0, format["Invalid aiMode (%1) detected, failed to setMarkerColor!", _aiMode]] spawn VEMFr_fnc_log;
VEMFrInvasionCount = VEMFrInvasionCount - 1;
VEMFrMissionCount = VEMFrMissionCount - 1;
breakOut "outer";
};
if (_mode isEqualTo 0) then
{
_marker setMarkerColor "ColorEAST";
};
if (_mode isEqualTo 1) then
{
_marker setMarkerColor "ColorWEST";
};
if (_mode isEqualTo 2) then
{
_marker setMarkerColor "ColorBlack";
};
};

View File

@ -54,17 +54,12 @@ if ("validateLoot" call VEMFr_fnc_getSetting isEqualTo 1) then
} forEach _x;
} forEach _loot;
_invalid = if (count _invalidClasses isEqualTo 0) then { false } else { true };
switch true do
if (count _invalidClasses isEqualTo 0) then
{
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;
};
["CheckLoot", 1, "Loot tables are all valid :)"] spawn VEMFr_fnc_log;
} else
{
["CheckLoot", 0, format["Invalid classes found in loot! | %1", _invalidClasses]] spawn VEMFr_fnc_log;
};
};
};