From 218d65b8a0181322c2b4200ba8740026db8fb94d Mon Sep 17 00:00:00 2001 From: eraser1 Date: Sun, 15 May 2016 13:55:18 -0500 Subject: [PATCH] Fixes + micro-optimizations --- @ExileServer/addons/a3_dms/config.cpp | 2 +- @ExileServer/addons/a3_dms/config.sqf | 9 +-- @ExileServer/addons/a3_dms/fn_DMS_preInit.sqf | 11 ++- .../a3_dms/scripts/fn_AILocalityManager.sqf | 5 +- .../addons/a3_dms/scripts/fn_FillCrate.sqf | 73 ++++++++++--------- .../addons/a3_dms/scripts/fn_FindSafePos.sqf | 9 ++- .../scripts/fn_GroupReinforcementsManager.sqf | 4 +- .../scripts/fn_HeliParatroopers_Monitor.sqf | 7 +- .../a3_dms/scripts/fn_MissionParams.sqf | 11 ++- .../addons/a3_dms/scripts/fn_OnKilled.sqf | 22 +++--- .../a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf | 4 +- .../a3_dms/scripts/fn_SelectMission.sqf | 2 +- .../addons/a3_dms/scripts/fn_SpawnAIGroup.sqf | 9 ++- .../scripts/fn_SpawnAIGroup_MultiPos.sqf | 10 +-- .../a3_dms/scripts/fn_SpawnAIStaticMG.sqf | 4 +- .../scripts/fn_SpawnHeliReinforcement.sqf | 6 +- .../a3_dms/scripts/fn_SpawnMinefield.sqf | 6 +- .../a3_dms/scripts/fn_SpawnStaticMission.sqf | 2 +- README.md | 5 ++ 19 files changed, 103 insertions(+), 98 deletions(-) diff --git a/@ExileServer/addons/a3_dms/config.cpp b/@ExileServer/addons/a3_dms/config.cpp index 12aae08..6537e84 100644 --- a/@ExileServer/addons/a3_dms/config.cpp +++ b/@ExileServer/addons/a3_dms/config.cpp @@ -4,7 +4,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; - a3_DMS_version = "May 6, 2016 (TEST)"; + a3_DMS_version = "May 15, 2016 (TEST)"; requiredVersion = 1.36; requiredAddons[] = {"exile_client","exile_server_config"}; }; diff --git a/@ExileServer/addons/a3_dms/config.sqf b/@ExileServer/addons/a3_dms/config.sqf index 19ee0e5..1793772 100644 --- a/@ExileServer/addons/a3_dms/config.sqf +++ b/@ExileServer/addons/a3_dms/config.sqf @@ -6,13 +6,6 @@ */ -// Enables debug logging in DMS functions. -// Logs will be written in the RPT, and if you have infiSTAR's "ARMA_LOG" DLL loaded, it will also produce logs in the server directory. -// If you have mARMA by maca134, DMS will also utilize mARMA logs. -// This will produce A LOT of logs, so make sure you leave it to false unless you know what you're doing. -DMS_DEBUG = false; - - DMS_Use_Map_Config = true; // Whether or not to use config overwrites specific to the map. /* @@ -240,7 +233,7 @@ DMS_SpawnMissions_Scheduled = false; // Whether or not to spawn missions in a sc - DMS_findSafePosBlacklist = [ // For BIS_fnc_findSafePos position blacklist info refer to: http://www.exilemod.com/topic/61-dms-defents-mission-system/?page=18#comment-31190 + DMS_findSafePosBlacklist = [ // For position blacklist info refer to: http://www.exilemod.com/topic/61-dms-defents-mission-system/?do=findComment&comment=31190 // An example is given in the altis_config.sqf (it blacklists the salt flats). /* // Blacklists most of the Northern Taviana Volcano diff --git a/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf b/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf index c2f1e89..313bbfa 100644 --- a/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf +++ b/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf @@ -4,7 +4,13 @@ */ #define CALLFILE(FILE) call compile preprocessFileLineNumbers FILE; -DMS_HC_Object = objNull; +// Enables debug logging in DMS functions. !!!NOTE:!!! You must uncomment the line above if you want DMS to even check whether or not debug mode is enabled! +// Logs will be written in the RPT, and if you have infiSTAR's "ARMA_LOG" DLL loaded, it will also produce logs in the server directory. +// If you have mARMA by maca134, DMS will also utilize mARMA logs. +// This will produce A LOT of logs, so make sure you leave it to false unless you know what you're doing. +DMS_DEBUG = false; + + DMS_CleanUpList = []; @@ -42,6 +48,9 @@ M3E_fnc_getCenter = DMS_fnc_GetCenter; M3E_fnc_subArr = DMS_fnc_SubArr; +// Because I fucked up the name on first implementation and don't want to mess anybody up who didn't realize to change every occurence of "DMS_MaxSurfaceNormal" to "DMS_MinSurfaceNormal". +DMS_MaxSurfaceNormal = DMS_MinSurfaceNormal; + DMS_AttemptsUntilThrottle = DMS_AttemptsUntilThrottle + 1; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_AILocalityManager.sqf b/@ExileServer/addons/a3_dms/scripts/fn_AILocalityManager.sqf index a93f711..bc611fd 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_AILocalityManager.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_AILocalityManager.sqf @@ -21,8 +21,9 @@ if (!DMS_ai_offload_to_client) exitWith {}; private _groupOwner = groupOwner _group; private _ownerObj = objNull; + private _isLocal = local _group; - if !(local _group) then // Only check for the group owner in players if it doesn't belong to the server. + if !(_isLocal) then // Only check for the group owner in players if it doesn't belong to the server. { { if (_groupOwner isEqualTo (owner _x)) exitWith @@ -33,7 +34,7 @@ if (!DMS_ai_offload_to_client) exitWith {}; }; // If the owner doesn't exist or is too far away... Attempt to set a new player owner, and if none are found... and if the group doesn't belong to the server... - if (((isNull _ownerObj) || {(_ownerObj distance2D _leader)>3500}) && {!([_group,_leader] call DMS_fnc_SetAILocality)} && {!(local _group)}) then + if (((isNull _ownerObj) || {(_ownerObj distance2D _leader)>3500}) && {!([_group,_leader] call DMS_fnc_SetAILocality)} && {!_isLocal}) then { // Reset locality to the server _group setGroupOwner 2; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_FillCrate.sqf b/@ExileServer/addons/a3_dms/scripts/fn_FillCrate.sqf index 3d4e896..dabd81a 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_FillCrate.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_FillCrate.sqf @@ -114,46 +114,52 @@ if (_crate getVariable ["DMS_CrateEnableRope",DMS_EnableBoxMoving]) then if ((_lootValues isEqualType []) && {!((_lootValues select 1) isEqualType {})}) then { - private ["_wepCount", "_weps", "_itemCount", "_items", "_backpackCount", "_backpacks"]; - // Weapons - if ((_lootValues select 0) isEqualType []) then - { - _wepCount = (_lootValues select 0) select 0; - _weps = (_lootValues select 0) select 1; - } - else - { - _wepCount = _lootValues select 0; - _weps = DMS_boxWeapons; - }; + private _wepValues = _lootValues select 0; + private _wepCount = 0; + private _weps = + if (_wepValues isEqualType []) then + { + _wepCount = _wepValues select 0; + _wepValues select 1 + } + else + { + _wepCount = _wepValues; + DMS_boxWeapons + }; // Items - if ((_lootValues select 1) isEqualType []) then - { - _itemCount = (_lootValues select 1) select 0; - _items = (_lootValues select 1) select 1; - } - else - { - _itemCount = _lootValues select 1; - _items = DMS_boxItems; - }; + private _itemValues = _lootValues select 1; + private _itemCount = 0; + private _items = + if (_itemValues isEqualType []) then + { + _itemCount = _itemValues select 0; + _itemValues select 1 + } + else + { + _itemCount = _itemValues; + DMS_boxItems + }; // Backpacks - if ((_lootValues select 2) isEqualType []) then - { - _backpackCount = (_lootValues select 2) select 0; - _backpacks = (_lootValues select 2) select 1; - } - else - { - _backpackCount = _lootValues select 2; - _backpacks = DMS_boxBackpacks; - }; - + private _backpackValues = _lootValues select 2; + private _backpackCount = 0; + private _backpacks = + if ((_backpackValues) isEqualType []) then + { + _backpackCount = _backpackValues select 0; + _backpackValues select 1 + } + else + { + _backpackCount = _backpackValues; + DMS_boxBackpacks + }; if (DMS_DEBUG) then { @@ -260,7 +266,6 @@ else _crate addBackpackCargoGlobal _x; } forEach _backpacks; - if (DMS_DEBUG) then { (format["FillCrate :: Filled crate %1 (at %5) with weapons |%2|, items |%3|, and backpacks |%4|",_crate, _weps, _items, _backpacks, getPosATL _crate]) call DMS_fnc_DebugLog; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos.sqf b/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos.sqf index 1d2dc52..08ea615 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos.sqf @@ -20,8 +20,6 @@ */ #define MAX_ATTEMPTS 5000 -private ["_pos", "_presetLocs", "_attempts"]; - params [ ["_nearestObjectMinDistance", 25, [0] ], @@ -45,6 +43,7 @@ DMS_DebugMarkers = []; private _isValidSpot = false; +private _presetLocs = []; private _presetLocsLength = 0; if (DMS_UsePredefinedMissionLocations) then @@ -55,6 +54,8 @@ if (DMS_UsePredefinedMissionLocations) then }; +private _pos = []; + for "_attempts" from 1 to MAX_ATTEMPTS do { _pos = @@ -64,7 +65,7 @@ for "_attempts" from 1 to MAX_ATTEMPTS do } else { - [DMS_MinMax_X_Coords call DMS_fnc_SelectRandomVal,DMS_MinMax_Y_Coords call DMS_fnc_SelectRandomVal] isFlatEmpty [_nearestObjectMinDistance, 0, 9999, 1, 0, _waterSpawn, objNull] + [DMS_MinMax_X_Coords call DMS_fnc_SelectRandomVal,DMS_MinMax_Y_Coords call DMS_fnc_SelectRandomVal] isFlatEmpty [_nearestObjectMinDistance, 0, 9999, 1, 0, -1, objNull] }; /* @@ -97,7 +98,7 @@ for "_attempts" from 1 to MAX_ATTEMPTS do if (_isValidSpot) exitWith {}; }; -if (_attempts isEqualTo MAX_ATTEMPTS) exitWith +if !(_isValidSpot) exitWith { diag_log format["DMS ERROR :: Number of attempts in DMS_fnc_findSafePos (%1) reached maximum number of attempts!",MAX_ATTEMPTS]; }; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_GroupReinforcementsManager.sqf b/@ExileServer/addons/a3_dms/scripts/fn_GroupReinforcementsManager.sqf index 96d0495..980a815 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_GroupReinforcementsManager.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_GroupReinforcementsManager.sqf @@ -545,7 +545,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the if ((!isNil "_unitsToSpawn") && {_unitsToSpawn>0}) then { - private ["_spawnPos"]; + private _spawnPos = []; if (_maxReinforcementUnits>0) then { @@ -583,7 +583,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the // Add extra spawning locations if there are not enough. for "_i" from 0 to (_unitsToSpawn-_spawningLocations_count-1) do { - _spawningLocations pushBack (_spawningLocations select floor(random(_spawningLocations_count+_i))); + _spawningLocations pushBack (selectRandom _spawningLocations); }; // Now to spawn the AI... diff --git a/@ExileServer/addons/a3_dms/scripts/fn_HeliParatroopers_Monitor.sqf b/@ExileServer/addons/a3_dms/scripts/fn_HeliParatroopers_Monitor.sqf index 26fb8c9..d09e0f4 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_HeliParatroopers_Monitor.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_HeliParatroopers_Monitor.sqf @@ -70,7 +70,7 @@ if ((_heli distance2D _dropPoint)<200) then { - private ["_groupOwner"]; + private _groupOwner = []; private _AIGroup = group _heli; @@ -89,8 +89,7 @@ { /* moveOut _unit; - private ["_parachute", "_dir"]; - _parachute = createVehicle ["Steerable_Parachute_F", (getPosATL _unit), [], 0, "CAN_COLLIDE"]; + private _parachute = createVehicle ["Steerable_Parachute_F", (getPosATL _unit), [], 0, "CAN_COLLIDE"]; _parachute setDir (getDir _unit); _parachute enableSimulationGlobal true; @@ -149,7 +148,7 @@ // Revert and unlock locality if necessary. - if !(isNil "_groupOwner") then + if !(_groupOwner isEqualTo []) then { _AIGroup setGroupOwner _groupOwner; _AIGroup setVariable ["DMS_LockLocality", false]; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_MissionParams.sqf b/@ExileServer/addons/a3_dms/scripts/fn_MissionParams.sqf index ad0ec66..5ffebd1 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_MissionParams.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_MissionParams.sqf @@ -47,8 +47,7 @@ ] */ -private ["_missionPosition"]; - +private _missionPosition = []; private _extraParams = []; @@ -62,7 +61,7 @@ if (isNil "_this") then // Simply use generated position with default values. _missionPosition = [ - 25,DMS_WaterNearBlacklist,DMS_MaxSurfaceNormal,DMS_SpawnZoneNearBlacklist,DMS_TraderZoneNearBlacklist,DMS_MissionNearBlacklist,DMS_PlayerNearBlacklist,DMS_TerritoryNearBlacklist,DMS_ThrottleBlacklists + 25,DMS_WaterNearBlacklist,DMS_MinSurfaceNormal,DMS_SpawnZoneNearBlacklist,DMS_TraderZoneNearBlacklist,DMS_MissionNearBlacklist,DMS_PlayerNearBlacklist,DMS_TerritoryNearBlacklist,DMS_ThrottleBlacklists ] call DMS_fnc_FindSafePos; } else @@ -71,7 +70,7 @@ else { if (params [ - ["_findSafePosParams",[25,DMS_WaterNearBlacklist,DMS_MaxSurfaceNormal,DMS_SpawnZoneNearBlacklist,DMS_TraderZoneNearBlacklist,DMS_MissionNearBlacklist,DMS_PlayerNearBlacklist,DMS_TerritoryNearBlacklist,DMS_ThrottleBlacklists],[[]]], + ["_findSafePosParams",[25,DMS_WaterNearBlacklist,DMS_MinSurfaceNormal,DMS_SpawnZoneNearBlacklist,DMS_TraderZoneNearBlacklist,DMS_MissionNearBlacklist,DMS_PlayerNearBlacklist,DMS_TerritoryNearBlacklist,DMS_ThrottleBlacklists],[[]]], ["_posInfo",[],[[]],[1,2]] ]) then @@ -98,7 +97,7 @@ else _missionPosition set [2,0]; }; - if (!_forceSpawn && {!([_missionPosition,DMS_WaterNearBlacklist,DMS_MaxSurfaceNormal,DMS_SpawnZoneNearBlacklist,DMS_TraderZoneNearBlacklist,DMS_MissionNearBlacklist,DMS_PlayerNearBlacklist,DMS_TerritoryNearBlacklist] call DMS_fnc_IsValidPosition)}) then + if (!_forceSpawn && {!([_missionPosition,DMS_WaterNearBlacklist,DMS_MinSurfaceNormal,DMS_SpawnZoneNearBlacklist,DMS_TraderZoneNearBlacklist,DMS_MissionNearBlacklist,DMS_PlayerNearBlacklist,DMS_TerritoryNearBlacklist] call DMS_fnc_IsValidPosition)}) then { if (DMS_DEBUG) then { @@ -124,7 +123,7 @@ else { _missionPosition = [ - 25,DMS_WaterNearBlacklist,DMS_MaxSurfaceNormal,DMS_SpawnZoneNearBlacklist,DMS_TraderZoneNearBlacklist,DMS_MissionNearBlacklist,DMS_PlayerNearBlacklist,DMS_TerritoryNearBlacklist,DMS_ThrottleBlacklists + 25,DMS_WaterNearBlacklist,DMS_MinSurfaceNormal,DMS_SpawnZoneNearBlacklist,DMS_TraderZoneNearBlacklist,DMS_MissionNearBlacklist,DMS_PlayerNearBlacklist,DMS_TerritoryNearBlacklist,DMS_ThrottleBlacklists ] call DMS_fnc_FindSafePos; _extraParams = _this; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_OnKilled.sqf b/@ExileServer/addons/a3_dms/scripts/fn_OnKilled.sqf index 46c9867..0ad65ac 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_OnKilled.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_OnKilled.sqf @@ -50,12 +50,12 @@ moveOut _unit; _unit removeAllEventHandlers "HandleDamage"; // Remove gear according to configs -if (DMS_clear_AI_body && {(random 100) <= DMS_clear_AI_body_chance}) then +if ((_unit getVariable ["DMS_clear_AI_body",DMS_clear_AI_body]) && {(random 100) <= (_unit getVariable ["DMS_clear_AI_body_chance",DMS_clear_AI_body_chance])}) then { _unit call _removeAll; }; -if (DMS_ai_remove_launchers && {(_launcherVar != "") || {_launcher != ""}}) then +if ((_unit getVariable ["DMS_ai_remove_launchers",DMS_ai_remove_launchers]) && {(_launcherVar != "") || {_launcher != ""}}) then { // Because arma is stupid sometimes if (_launcher isEqualTo "") then @@ -91,7 +91,7 @@ if (DMS_ai_remove_launchers && {(_launcherVar != "") || {_launcher != ""}}) then } forEach (magazines _unit); }; -if(DMS_RemoveNVG) then +if (_unit getVariable ["DMS_RemoveNVG",DMS_RemoveNVG]) then { _unit unlinkItem "NVGoggles"; }; @@ -188,9 +188,9 @@ if (!isNull _av) then _grp setVariable ["DMS_LockLocality",true]; // The AI has to be local in order for these commands to work, so I reset locality, just because it's really difficult to deal with otherwise - if (_owner!=2) then + if !(_owner in [2,0]) then { - diag_log format ["Temporarily setting owner of %1 to server from %2. Success: %3",_grp,_owner,_grp setGroupOwner 2]; + diag_log format ["DMS Seat Switcher :: Temporarily setting owner of %1 to server from %2. Success: %3",_grp,_owner,_grp setGroupOwner 2]; }; sleep 5+(random 3); // 5 to 8 seconds delay after gunner death @@ -227,7 +227,7 @@ if (!isNull _av) then (format["OnKilled :: Switched driver of AI Vehicle (%1) to gunner.",typeOf _av]) call DMS_fnc_DebugLog; }; - if (_owner!=2) then + if !(_owner in [2,0]) then { private _start = time; @@ -261,7 +261,7 @@ if (!isNull _av) then sleep 15; - diag_log format ["Resetting ownership of %1 to %2. Success: %3",_grp,_owner,_grp setGroupOwner _owner]; + diag_log format ["DMS Seat Switcher :: Resetting ownership of %1 to %2. Success: %3",_grp,_owner,_grp setGroupOwner _owner]; }; _grp setVariable ["DMS_LockLocality",false]; @@ -293,7 +293,7 @@ if (isPlayer _killer) then _roadKilled = true; - if (DMS_explode_onRoadkill) then + if (_unit getVariable ["DMS_explode_onRoadkill",DMS_explode_onRoadkill]) then { private _boom = createVehicle ["SLAMDirectionalMine_Wire_Ammo", [0,0,100], [], 0, "CAN_COLLIDE"]; _boom setPosATL (getPosATL _playerObj); @@ -306,7 +306,7 @@ if (isPlayer _killer) then // Remove gear from roadkills if configured to do so - if (DMS_remove_roadkill && {(random 100) <= DMS_remove_roadkill_chance}) then + if ((_unit getVariable ["DMS_remove_roadkill",DMS_remove_roadkill]) && {(random 100) <= (_unit getVariable ["DMS_remove_roadkill_chance",DMS_remove_roadkill_chance])}) then { _unit call _removeAll; }; @@ -316,7 +316,7 @@ if (isPlayer _killer) then // Reveal the killer to the AI units - if (DMS_ai_share_info) then + if (_unit getVariable ["DMS_ai_share_info",DMS_ai_share_info]) then { private _revealAmount = 4.0; @@ -333,7 +333,7 @@ if (isPlayer _killer) then { - if ((alive _x) && {!(isPlayer _x) && {(_x distance2D _unit) <= DMS_ai_share_info_distance}}) then + if ((alive _x) && {!(isPlayer _x) && {(_x distance2D _unit) <= (_unit getVariable ["DMS_ai_share_info_distance",DMS_ai_share_info_distance])}}) then { _x reveal [_killer, _revealAmount max (_x knowsAbout _playerObj)]; }; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf b/@ExileServer/addons/a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf index c740cf5..82eb346 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf @@ -83,7 +83,7 @@ if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_U if (_moneyChange!=0) then { - private ["_distance"]; + private _distance = []; // Set client's money // I also make sure that they don't get negative poptabs @@ -202,7 +202,7 @@ if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_U "%1 killed %2 from %3 meters away and received %4 poptabs, and %5 respect.", name _playerObj, _unitName, - if !(isNil "_distance") then {_distance} else {floor(_unit distance _playerObj)}, + if (_distance isEqualTo []) then {floor(_unit distance _playerObj)} else {_distance}, _moneyChange, _repChange ]; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SelectMission.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SelectMission.sqf index 1a8fe15..e62a6cb 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SelectMission.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SelectMission.sqf @@ -46,7 +46,7 @@ if (diag_fps >= DMS_MinServerFPS && {(count allPlayers) >= DMS_MinPlayerCount}) if (_availableMissions isEqualTo []) exitWith { - DMS_StaticMissionLastStart = _time; + DMS_StaticMissionLastStar if (DMS_DEBUG) then { (format ["SelectMission :: No available missions! Running missions: %1", DMS_RunningStaticMissions]) call DMS_fnc_DebugLog; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf index 1c2670a..0e87300 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf @@ -15,8 +15,6 @@ Returns AI Group */ -private ["_launcherType"]; - if !(params [ @@ -44,6 +42,9 @@ if (DMS_DEBUG) then (format["SpawnAIGroup :: Spawning %1 %2 %3 AI at %4 with %5 difficulty.",_count,_class,_side,_pos,_difficulty]) call DMS_fnc_DebugLog; }; + +private _launcherType = ""; + // if soldier have AT/AA weapons if (_class isEqualType []) then { @@ -80,9 +81,9 @@ for "_i" from 1 to _count do }; // An AI will definitely spawn with a launcher if you define type -if ((!isNil "_launcherType") || {DMS_ai_use_launchers && {DMS_ai_launchers_per_group>0}}) then +if ((DMS_ai_use_launchers && {DMS_ai_launchers_per_group>0}) || {!_launcherType isEqualTo ""}) then { - if (isNil "_launcherType") then + if (_launcherType isEqualTo "") then { _launcherType = "AT"; }; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup_MultiPos.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup_MultiPos.sqf index f263b1e..341885d 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup_MultiPos.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup_MultiPos.sqf @@ -23,9 +23,6 @@ Returns AI Group */ -private ["_launcherType"]; - - if !(params [ ["_positions","_positions ERROR",[[]]], @@ -60,6 +57,9 @@ if (DMS_DEBUG) then (format["SpawnAIGroup_MultiPos :: Spawning %1 %2 %3 AI at positions %4 with %5 difficulty.",_count,_class,_side,_positions,_difficulty]) call DMS_fnc_DebugLog; }; + +private _launcherType = ""; + // if soldier have AT/AA weapons if (_class isEqualType []) then { @@ -97,9 +97,9 @@ for "_i" from 1 to _count do }; // An AI will definitely spawn with a launcher if you define type -if ((!isNil "_launcherType") || {DMS_ai_use_launchers && {DMS_ai_launchers_per_group>0}}) then +if ((DMS_ai_use_launchers && {DMS_ai_launchers_per_group>0}) || {!_launcherType isEqualTo ""}) then { - if (isNil "_launcherType") then + if (_launcherType isEqualTo "") then { _launcherType = "AT"; }; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStaticMG.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStaticMG.sqf index 03a1caa..6fff976 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStaticMG.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStaticMG.sqf @@ -37,7 +37,7 @@ exitWith private _MGClassInput = if ((count _this)>5) then { - param [5]; + _this select 5 } else { @@ -60,8 +60,6 @@ private _guns = _positions apply _group addVehicle _gun; - _guns pushBack _gun; - private _unit = [_group,_x,_class,_difficulty,_side,"Static"] call DMS_fnc_SpawnAISoldier; _unit moveInGunner _gun; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnHeliReinforcement.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnHeliReinforcement.sqf index 80ab9f0..843a00c 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnHeliReinforcement.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnHeliReinforcement.sqf @@ -21,9 +21,6 @@ Returns the index of the paratrooper info in "DMS_HeliParatrooper_Arr", -1 on error. */ -private ["_pilot", "_paratrooperCount", "_unit", "_cargoIndex"]; - - if !(params [ ["_AIGroup", 0, [grpNull]], @@ -114,7 +111,7 @@ private _units = (fullCrew [_heli, "", true]) apply _unit = [_AIGroup,_spawnPos,_class,_difficulty,_side,"Vehicle"] call DMS_fnc_SpawnAISoldier; _unit moveInDriver _heli; _unit setVariable ["DMS_AssignedVeh",_heli]; - _pilot = _unit; + _unit setDestination [_dropPoint, "VEHICLE PLANNED", true]; }; case "commander"; @@ -155,7 +152,6 @@ private _units = (fullCrew [_heli, "", true]) apply // Set the heli pilot's behavior. -_pilot setDestination [_dropPoint, "VEHICLE PLANNED", true]; _heli flyInHeight DMS_RHeli_Height; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf index 9fe8e24..b39a8df 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf @@ -65,10 +65,8 @@ if (DMS_SpawnMinesAroundMissions) then for "_i" from 1 to _mineCount do { - private ["_minePos", "_mine"]; - - _minePos = _centerPos getPos [random _radius,random 360]; - _mine = createMine ["ATMine", [0,0,0], [], 0]; + private _minePos = _centerPos getPos [random _radius,random 360]; + private _mine = createMine ["ATMine", [0,0,0], [], 0]; // Fixes players shooting the mine and causing premature 'splosions if (DMS_BulletProofMines) then diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnStaticMission.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnStaticMission.sqf index cfe1f55..61dcd5d 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnStaticMission.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnStaticMission.sqf @@ -48,6 +48,7 @@ try DMS_MissionCount = DMS_MissionCount - 1; // This will cause mission spawning to run in scheduled, but that should be a fairly minor issue. [60, DMS_fnc_SpawnStaticMission, [_missionType], false] call ExileServer_system_thread_addTask; + if (DMS_DEBUG) then { (format ["SpawnStaticMission :: Mission ""%1"" requested delay",_missionType]) call DMS_fnc_DebugLog; @@ -58,7 +59,6 @@ try DMS_StaticMissionLastStart = diag_tickTime; DMS_RunningStaticMissions pushBack _missionType; - if (DMS_DEBUG) then { (format ["SpawnStaticMission :: Spawned mission %1 with parameters (%2) | DMS_StaticMissionDelay set to %3 seconds", _missionType, _parameters, DMS_StaticMissionDelay]) call DMS_fnc_DebugLog; diff --git a/README.md b/README.md index 9b1495e..b798e28 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,7 @@ ___ - [Valthos from The Altis Project](https://www.thealtisproject.co.uk/) - [Flowrider from Optimum Gaming](http://www.optimum-multigaming.com/) - [CEN from ATD Gaming](http://atdgaming.com/) +- [second coming from ExileYorkshire](http://exileyorkshire.co.uk/) ___ @@ -153,6 +154,10 @@ ___ # Changelog: ### Test Branch: +#### May 14, 2016 (2:00 PM CST-America): +* More Micro-optimizations. +* Fixed a lot of various errors from the last test branch update. + #### May 6, 2016 (10:45 PM CST-America): * **NEW CONFIG VALUES:**