From 06a13b1e3264f70ad705c6e3e199cda9e47afa15 Mon Sep 17 00:00:00 2001 From: eraser1 Date: Tue, 13 Feb 2018 00:07:34 -0600 Subject: [PATCH] I haven't COMPLETELY forgotten about this... --- .../a3_dms/scripts/fn_AddMissionToMonitor.sqf | 12 ++---------- .../scripts/fn_AddMissionToMonitor_Static.sqf | 4 ++-- .../scripts/fn_GroupReinforcementsManager.sqf | 18 +++++++++--------- .../a3_dms/scripts/fn_MissionSuccessState.sqf | 2 +- .../a3_dms/scripts/fn_SetGroupBehavior.sqf | 2 +- .../scripts/fn_SetGroupBehavior_Separate.sqf | 10 +++++----- .../a3_dms/scripts/fn_SpawnAIStaticMG.sqf | 10 +--------- .../a3_dms/scripts/fn_SpawnAIVehicle.sqf | 10 +--------- .../a3_dms/scripts/fn_SpawnBanditMission.sqf | 2 +- .../addons/a3_dms/scripts/fn_SpawnCrate.sqf | 2 +- .../scripts/fn_SpawnHeliReinforcement.sqf | 2 +- .../a3_dms/scripts/fn_SpawnMinefield.sqf | 13 ++----------- .../scripts/fn_SpawnPersistentVehicle.sqf | 2 +- .../a3_dms/scripts/fn_SpawnStaticMission.sqf | 16 ++-------------- 14 files changed, 30 insertions(+), 75 deletions(-) diff --git a/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor.sqf b/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor.sqf index c31c5f0..0079866 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor.sqf @@ -112,15 +112,7 @@ try throw format["_missionObjs |%1|",_missionObjs]; }; - private _mines = - if ((count _missionObjs)>3) then - { - _missionObjs param [3,[],[[]]] - } - else - { - [] - }; + private _mines = _missionObjs param [3,[],[[]]]; // Don't spawn a minefield if there is one already defined in _missionObjs. if (DMS_SpawnMinefieldForEveryMission && {_mines isEqualTo []}) then @@ -153,7 +145,7 @@ try ]) then { - throw format["_onEndingScripts |%1|",_onEndingScripts]; + //throw format["_onEndingScripts |%1|",_onEndingScripts]; }; private _unitCount = count (_units call DMS_fnc_GetAllUnits); diff --git a/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor_Static.sqf b/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor_Static.sqf index 254fe0b..4581c18 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor_Static.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor_Static.sqf @@ -123,7 +123,7 @@ try throw format["_missionObjs |%1|",_missionObjs]; }; - private _mines = if ((count _missionObjs)>3) then { _missionObjs param [3,[],[[]]] } else { [] }; + private _mines = _missionObjs param [3,[],[[]]]; // Don't spawn a minefield if there is one already defined in _missionObjs. if (DMS_SpawnMinefieldForEveryMission && {_mines isEqualTo []}) then @@ -155,7 +155,7 @@ try ]) then { - throw format["_onEndingScripts |%1|",_onEndingScripts]; + //throw format["_onEndingScripts |%1|",_onEndingScripts]; }; private _unitCount = count (_units call DMS_fnc_GetAllUnits); diff --git a/@ExileServer/addons/a3_dms/scripts/fn_GroupReinforcementsManager.sqf b/@ExileServer/addons/a3_dms/scripts/fn_GroupReinforcementsManager.sqf index 9c1f9a1..c97a67a 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_GroupReinforcementsManager.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_GroupReinforcementsManager.sqf @@ -258,7 +258,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the if ([_posOrObj,_radius] call DMS_fnc_IsPlayerNearby) then { - private _maxAICount = if ((count _monitorParams)>3) then {_monitorParams param [3, 0, [0]]} else {0}; + private _maxAICount = _monitorParams param [3, 0, [0]]; _unitsToSpawn = _reinforcementCount min ((_maxAICount-_remainingUnits) max 0); }; @@ -299,7 +299,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the if (_remainingUnits<_AICount) then { - private _maxAICount = if ((count _monitorParams)>2) then {_monitorParams param [2, 0, [0]]} else {_AICount}; + private _maxAICount = _monitorParams param [2, _AICount, [0]]; _unitsToSpawn = _reinforcementCount min ((_maxAICount-_remainingUnits) max 0); }; @@ -322,7 +322,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the if (_remainingUnits<_AICount) then { - private _maxAICount = if ((count _monitorParams)>3) then {_monitorParams param [3, 0, [0]]} else {_AICount}; + private _maxAICount = _monitorParams param [3, _AICount, [0]]; _unitsToSpawn = _reinforcementCount min ((_maxAICount-_remainingUnits) max 0); @@ -355,7 +355,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the case "hardcore": {"hardcore"}; }; - private _maxAICount = if ((count _monitorParams)>3) then {_monitorParams param [3, 0, [0]]} else {_AICount}; + private _maxAICount = _monitorParams param [3, _AICount, [0]]; _unitsToSpawn = _reinforcementCount min ((_maxAICount-_remainingUnits) max 0); }; @@ -375,7 +375,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the if (_remainingUnits<_AICount) then { - private _vehClass = if ((count _monitorParams)>1) then {_monitorParams param [1, "", [""]]} else {"random"}; + private _vehClass = _monitorParams param [1, "random", [""]]; private _leaderPos = getPosATL (leader _AIGroup); @@ -419,7 +419,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the { deleteVehicle _vehicle; - private _vehClass = if ((count _monitorParams)>1) then {_monitorParams param [1, "", [""]]} else {"random"}; + private _vehClass = _monitorParams param [1, "random", [""]]; private _leaderPos = getPosATL (leader _AIGroup); @@ -466,7 +466,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the { deleteVehicle _staticGun; - private _staticGunClass = if ((count _monitorParams)>1) then {_monitorParams param [1, "", [""]]} else {"random"}; + private _staticGunClass = _monitorParams param [1, "random", [""]]; private _leaderPos = getPosATL (leader _AIGroup); @@ -512,8 +512,8 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the if (_remainingUnits<_AICount) then { - private _dropPoint = if ((count _monitorParams)>4) then {_monitorParams param [4, getPosATL (leader _AIGroup), [objNull,[]], [2,3]]} else {getPosATL (leader _AIGroup)}; - private _heliClass = if ((count _monitorParams)>5) then {_monitorParams param [5, "", [""]]} else {selectRandom DMS_ReinforcementHelis}; + private _dropPoint = _monitorParams param [4, getPosATL (leader _AIGroup), [objNull,[]], [2,3]]; + private _heliClass = _monitorParams param [5, selectRandom DMS_ReinforcementHelis, [""]]; private _params = [ diff --git a/@ExileServer/addons/a3_dms/scripts/fn_MissionSuccessState.sqf b/@ExileServer/addons/a3_dms/scripts/fn_MissionSuccessState.sqf index f7bd720..c0c57d0 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_MissionSuccessState.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_MissionSuccessState.sqf @@ -36,7 +36,7 @@ private _exit = false; }; - private _absoluteWinCondition = if ((count _x)>2) then {_x select 2} else {false}; + private _absoluteWinCondition = _x param [2, false, [true]]; if (!_success && {!_absoluteWinCondition}) then { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SetGroupBehavior.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SetGroupBehavior.sqf index 50c26be..01e891a 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SetGroupBehavior.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SetGroupBehavior.sqf @@ -49,7 +49,7 @@ catch if (_exit) exitWith {false}; -private _behavior = if ((count _this)>3) then {_this select 3;} else {"COMBAT"}; +private _behavior = param [3, "COMBAT", [""]]; _group setCombatMode "RED"; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SetGroupBehavior_Separate.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SetGroupBehavior_Separate.sqf index 485a9ad..2202447 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SetGroupBehavior_Separate.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SetGroupBehavior_Separate.sqf @@ -24,17 +24,17 @@ if !(params [ - "_units", - "_finalGroup", - "_pos", - "_difficulty" + "_units", + "_finalGroup", + "_pos", + "_difficulty" ]) then { diag_log format ["DMS ERROR :: Calling DMS_fnc_SetGroupBehavior_Separate with invalid params: %1",_this]; }; -private _behavior = if ((count _this)>3) then {_this select 3;} else {"COMBAT"}; +private _behavior = param [3, "COMBAT", [""]]; private _tmpGroup = createGroup (side _finalGroup); diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStaticMG.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStaticMG.sqf index 4f369e2..58f6ac6 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStaticMG.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStaticMG.sqf @@ -34,15 +34,7 @@ exitWith diag_log format ["DMS ERROR :: Calling DMS_fnc_SpawnAIStaticMG with invalid parameters: %1",_this]; }; -private _MGClassInput = - if ((count _this)>5) then - { - _this select 5 - } - else - { - "random" - }; +private _MGClassInput = param [5, "random", [""]]; private _guns = _positions apply diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIVehicle.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIVehicle.sqf index 0bee2dc..77163d9 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIVehicle.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIVehicle.sqf @@ -34,15 +34,7 @@ exitWith _spawnPos = _positions select 0; -private _vehClass = - if ((count _this)>5) then - { - param [5,"random",[""]] - } - else - { - "random" - }; +private _vehClass = param [5, "random", [""]]; if (_vehClass == "random") then { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnBanditMission.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnBanditMission.sqf index e5870f6..55d3611 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnBanditMission.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnBanditMission.sqf @@ -27,7 +27,7 @@ if (_missionCode isEqualTo "no") then } else { - private _parameters = if ((count _this)>1) then {_this select 1} else {[]}; + private _parameters = _this param [1,[]]; DMS_MissionCount = DMS_MissionCount + 1; DMS_RunningBMissionCount = DMS_RunningBMissionCount + 1; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnCrate.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnCrate.sqf index c80d331..a3354b8 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnCrate.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnCrate.sqf @@ -29,7 +29,7 @@ if !(isClass (configFile >> "CfgVehicles" >> _crateClassName)) exitWith objNull }; -private _spawnATL = if ((count _this)>2) then {_this select 2} else {true}; +private _spawnATL = param [2, true, [true]]; private _crate = createVehicle [_crateClassName,_pos,[], 0, "CAN_COLLIDE"]; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnHeliReinforcement.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnHeliReinforcement.sqf index 712b6fb..1201ba2 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnHeliReinforcement.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnHeliReinforcement.sqf @@ -44,7 +44,7 @@ if (isNull _AIGroup) exitWith -1 }; -private _heliClass = if ((count _this)>8) then {_this param [8, "", [""]]} else {selectRandom DMS_ReinforcementHelis}; +private _heliClass = param [8, selectRandom DMS_ReinforcementHelis, [""]]; // Make the AI group local to add passengers. if !(local _AIGroup) then diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf index 44156a1..e213429 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf @@ -27,17 +27,8 @@ if (DMS_SpawnMinesAroundMissions) then diag_log format ["DMS ERROR :: Calling DMS_fnc_SpawnMinefield with invalid parameters: %1",_this]; }; - _spawnWarningSign = DMS_SpawnMineWarningSigns; - _mineClassname = "ATMine"; - if ((count _this)>3) then - { - _spawnWarningSign = param [3,DMS_SpawnMineWarningSigns,[true]]; - - if ((count _this)>4) then - { - _mineClassname = param [4,"ATMine",[true]]; - }; - }; + private _spawnWarningSign = param [3,DMS_SpawnMineWarningSigns,[true]]; + private _mineClassname = param [4,"ATMine",[true]]; if !(getText (configfile >> "CfgVehicles" >> _mineClassname >> "vehicleClass") isEqualTo "Mines") exitWith diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnPersistentVehicle.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnPersistentVehicle.sqf index 3b581eb..4fcc9c4 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnPersistentVehicle.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnPersistentVehicle.sqf @@ -76,7 +76,7 @@ try throw (format ["invalid STRING _pinCode value (must be 4 digits): %1",_pinCode]); }; - private _spawnATL = if ((count _this)>3) then {_this select 3} else {true}; + private _spawnATL = param [3, true, [true]]; // Create and set the vehicle _vehObj = [_vehicleClass,_pos] call DMS_fnc_SpawnNonPersistentVehicle; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnStaticMission.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnStaticMission.sqf index 722f855..775415c 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnStaticMission.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnStaticMission.sqf @@ -37,25 +37,12 @@ try }; - private _parameters = if ((count _this)>1) then {_this select 1} else {[]}; - - DMS_MissionCount = DMS_MissionCount + 1; + private _parameters = param [1, []]; private _return = _parameters call _mission; if ((!isNil "_return") && {_return isEqualTo "delay"}) then { - DMS_MissionCount = DMS_MissionCount - 1; - - if (DMS_SpawnMissions_Scheduled) then - { - [60, DMS_fnc_SpawnStaticMission, [_missionType], false] call ExileServer_system_thread_addTask; - } - else - { - [60, {[_this, DMS_fnc_SpawnStaticMission] execFSM "exile_server\fsm\call.fsm";}, [_missionType], false] call ExileServer_system_thread_addTask; - }; - if (DMS_DEBUG) then { (format ["SpawnStaticMission :: Mission ""%1"" requested delay",_missionType]) call DMS_fnc_DebugLog; @@ -63,6 +50,7 @@ try } else { + DMS_MissionCount = DMS_MissionCount + 1; DMS_StaticMissionDelay = DMS_TimeBetweenStaticMissions call DMS_fnc_SelectRandomVal; DMS_StaticMissionLastStart = diag_tickTime; DMS_RunningStaticMissions pushBack _missionType;