From 015da5b7e4e24d4f433ff56062b9e10fd543f8ab Mon Sep 17 00:00:00 2001 From: oOKexOo Date: Fri, 28 Sep 2018 23:58:05 +0200 Subject: [PATCH 1/5] Do not kill curators and logics --- .../FireSupport/functions/fn_ModuleFireSupportNuke.sqf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/@AresModAchillesExpansion/addons/modules_f_achilles/FireSupport/functions/fn_ModuleFireSupportNuke.sqf b/@AresModAchillesExpansion/addons/modules_f_achilles/FireSupport/functions/fn_ModuleFireSupportNuke.sqf index 0327dd14..d674f9b8 100644 --- a/@AresModAchillesExpansion/addons/modules_f_achilles/FireSupport/functions/fn_ModuleFireSupportNuke.sqf +++ b/@AresModAchillesExpansion/addons/modules_f_achilles/FireSupport/functions/fn_ModuleFireSupportNuke.sqf @@ -49,6 +49,7 @@ _doColorCorrection = _doColorCorrection isEqualTo 0; "_destructionRate" ]; sleep 5; + private _curatorPlayers = [] call BIS_fnc_listCuratorPlayers; // big destruction if (_destructionRadius > 0 && _destructionRate > 0) then { @@ -61,8 +62,8 @@ _doColorCorrection = _doColorCorrection isEqualTo 0; private _currentArrayLength = _numberOfObjects - _idxStart - 1; _currentArrayLength = [_currentArrayLength, _destructionRate] select (_currentArrayLength > _destructionRate); { - // Do not kill HCs and curators. - if (isNull getAssignedCuratorLogic _x && !(_x isKindOf "HeadlessClient_F") && isNil {_x getVariable ["Achilles_var_switchUnit_data", nil]}) then + // Do not kill logics, HCs and curators. + if (!(_x isKindOf "Logic") && !(_x in _curatorPlayers) && !(_x isKindOf "HeadlessClient_F") && isNil {_x getVariable ["Achilles_var_switchUnit_data", nil]}) then { _x setDamage 1; }; From 688675aeaaceef5d5f787d93c00ee3ddac79cc79 Mon Sep 17 00:00:00 2001 From: oOKexOo Date: Thu, 4 Oct 2018 00:57:38 +0200 Subject: [PATCH 2/5] Introduce _unitDies and handle Achilles revive in switchUnit functions --- .../selectUnit/fn_switchUnit_exit.sqf | 39 +++++++++++++------ .../selectUnit/fn_switchUnit_start.sqf | 39 ++++++++++++------- 2 files changed, 53 insertions(+), 25 deletions(-) diff --git a/@AresModAchillesExpansion/addons/functions_f_achilles/functions/selectUnit/fn_switchUnit_exit.sqf b/@AresModAchillesExpansion/addons/functions_f_achilles/functions/selectUnit/fn_switchUnit_exit.sqf index 24521883..61919b75 100644 --- a/@AresModAchillesExpansion/addons/functions_f_achilles/functions/selectUnit/fn_switchUnit_exit.sqf +++ b/@AresModAchillesExpansion/addons/functions_f_achilles/functions/selectUnit/fn_switchUnit_exit.sqf @@ -1,18 +1,32 @@ -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// AUTHOR: Kex -// DATE: 6/6/17 -// VERSION: AMAE001 -// DESCRIPTION: terminates "Achilles_fnc_switchUnit_start". -// -// ARGUMENTS: nothing -// -// RETURNS: nothing -// -// Example: [] call Achilles_fnc_switchUnit_exit; -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/* + Function: + Achilles_fnc_switchUnit_exit + + Authors: + Kex + + Description: + terminates "Achilles_fnc_switchUnit_start" + + Parameters: + _unitDies - [false] True if the unit dies after the exit. + + Returns: + nothing + + Exampes: + (begin example) + [] call Achilles_fnc_switchUnit_end; + (end) +*/ #include "\A3\ui_f_curator\ui\defineResinclDesign.inc" +params +[ + ["_unitDies", false, [false]] +]; + private _unit = bis_fnc_moduleRemoteControl_unit; if (isNull _unit) exitWith {bis_fnc_moduleRemoteControl_unit = nil}; (_unit getVariable "Achilles_var_switchUnit_data") params ["_","_playerUnit","_damageAllowed", "_face", "_speaker", "_goggles"]; @@ -52,3 +66,4 @@ ctrlMapAnimCommit _curatorMapCtrl; _unit addGoggles _goggles; _unit setVariable ["Achilles_var_switchUnit_data", nil, true]; bis_fnc_moduleRemoteControl_unit = nil; +if (_unitDies) then {_unit setDamage 1}; diff --git a/@AresModAchillesExpansion/addons/functions_f_achilles/functions/selectUnit/fn_switchUnit_start.sqf b/@AresModAchillesExpansion/addons/functions_f_achilles/functions/selectUnit/fn_switchUnit_start.sqf index 4c47dc7c..cbb1400d 100644 --- a/@AresModAchillesExpansion/addons/functions_f_achilles/functions/selectUnit/fn_switchUnit_start.sqf +++ b/@AresModAchillesExpansion/addons/functions_f_achilles/functions/selectUnit/fn_switchUnit_start.sqf @@ -1,15 +1,26 @@ -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// AUTHOR: Kex -// DATE: 6/19/17 -// VERSION: AMAE003 -// DESCRIPTION: application of "selectPlayer" script command. -// -// ARGUMENTS: 0: OBJECT - Unit to switch to. -// -// RETURNS: nothing -// -// Example: [_unit] call Achilles_fnc_switchUnit_start; -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/* + Function: + Achilles_fnc_switchUnit_start + + Authors: + Kex + + Description: + Switches the player's unit via the "selectPlayer" script command + The player will switch back to his old unit when Achilles_fnc_switchUnit_end is executed + Achilles_fnc_switchUnit_end is executed automatically when the unit dies or is unconscious + + Parameters: + _unit - The unit to be switched to. + + Returns: + nothing + + Exampes: + (begin example) + [_unit] call Achilles_fnc_switchUnit_start; + (end) +*/ private _error = ""; private _unit = effectiveCommander (param [0]); @@ -62,7 +73,9 @@ private _eh_id = _unit addEventHandler ["HandleDamage", { if (_selection in ["","body","head"]) then { - [] call Achilles_fnc_switchUnit_exit; + // Handle Achilles revive from ZGM Achilles missions + private _unitDies = [true, false] select (_unit getVariable ["Achilles_var_revive_initialized", false]); + [_unitDies] call Achilles_fnc_switchUnit_exit; }; _handler = 0.999; }; From 614e4959eaf688e49df37ce7c619966727456d8e Mon Sep 17 00:00:00 2001 From: oOKexOo Date: Thu, 4 Oct 2018 00:59:01 +0200 Subject: [PATCH 3/5] Nuke now kills switched units as well --- .../functions/fn_ModuleFireSupportNuke.sqf | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/@AresModAchillesExpansion/addons/modules_f_achilles/FireSupport/functions/fn_ModuleFireSupportNuke.sqf b/@AresModAchillesExpansion/addons/modules_f_achilles/FireSupport/functions/fn_ModuleFireSupportNuke.sqf index d674f9b8..d0bee0f4 100644 --- a/@AresModAchillesExpansion/addons/modules_f_achilles/FireSupport/functions/fn_ModuleFireSupportNuke.sqf +++ b/@AresModAchillesExpansion/addons/modules_f_achilles/FireSupport/functions/fn_ModuleFireSupportNuke.sqf @@ -63,9 +63,16 @@ _doColorCorrection = _doColorCorrection isEqualTo 0; _currentArrayLength = [_currentArrayLength, _destructionRate] select (_currentArrayLength > _destructionRate); { // Do not kill logics, HCs and curators. - if (!(_x isKindOf "Logic") && !(_x in _curatorPlayers) && !(_x isKindOf "HeadlessClient_F") && isNil {_x getVariable ["Achilles_var_switchUnit_data", nil]}) then + if (!(_x isKindOf "Logic") && !(_x in _curatorPlayers) && !(_x isKindOf "HeadlessClient_F")) then { - _x setDamage 1; + if (isNil {_x getVariable ["Achilles_var_switchUnit_data", nil]}) then + { + _x setDamage 1; + } + else + { + [true] remoteExecCall ["Achilles_fnc_switchUnit_end", owner _x]; + }; }; } forEach (_objects select [_idxStart , _currentArrayLength]); sleep 1; From 706afb3915f1033ee14236c38af26775bc2d8e36 Mon Sep 17 00:00:00 2001 From: oOKexOo Date: Thu, 4 Oct 2018 01:11:51 +0200 Subject: [PATCH 4/5] Correct function name --- .../functions/selectUnit/fn_switchUnit_exit.sqf | 2 +- .../FireSupport/functions/fn_ModuleFireSupportNuke.sqf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/@AresModAchillesExpansion/addons/functions_f_achilles/functions/selectUnit/fn_switchUnit_exit.sqf b/@AresModAchillesExpansion/addons/functions_f_achilles/functions/selectUnit/fn_switchUnit_exit.sqf index 61919b75..5689efff 100644 --- a/@AresModAchillesExpansion/addons/functions_f_achilles/functions/selectUnit/fn_switchUnit_exit.sqf +++ b/@AresModAchillesExpansion/addons/functions_f_achilles/functions/selectUnit/fn_switchUnit_exit.sqf @@ -16,7 +16,7 @@ Exampes: (begin example) - [] call Achilles_fnc_switchUnit_end; + [] call Achilles_fnc_switchUnit_exit; (end) */ diff --git a/@AresModAchillesExpansion/addons/modules_f_achilles/FireSupport/functions/fn_ModuleFireSupportNuke.sqf b/@AresModAchillesExpansion/addons/modules_f_achilles/FireSupport/functions/fn_ModuleFireSupportNuke.sqf index d0bee0f4..920fe689 100644 --- a/@AresModAchillesExpansion/addons/modules_f_achilles/FireSupport/functions/fn_ModuleFireSupportNuke.sqf +++ b/@AresModAchillesExpansion/addons/modules_f_achilles/FireSupport/functions/fn_ModuleFireSupportNuke.sqf @@ -71,7 +71,7 @@ _doColorCorrection = _doColorCorrection isEqualTo 0; } else { - [true] remoteExecCall ["Achilles_fnc_switchUnit_end", owner _x]; + [true] remoteExecCall ["Achilles_fnc_switchUnit_exit", owner _x]; }; }; } forEach (_objects select [_idxStart , _currentArrayLength]); From 5d888690a1d692124cb03f5f4e54cac742f17c24 Mon Sep 17 00:00:00 2001 From: oOKexOo Date: Sun, 7 Oct 2018 17:29:01 +0200 Subject: [PATCH 5/5] Do not kill 'invincible' units --- .../functions/fn_ModuleFireSupportNuke.sqf | 5 ++--- .../functions/fn_ModuleObjectsMakeInvincible.sqf | 16 +++------------- .../Zeus/functions/fn_ZeusVisibility.sqf | 4 ++-- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/@AresModAchillesExpansion/addons/modules_f_achilles/FireSupport/functions/fn_ModuleFireSupportNuke.sqf b/@AresModAchillesExpansion/addons/modules_f_achilles/FireSupport/functions/fn_ModuleFireSupportNuke.sqf index 920fe689..39201097 100644 --- a/@AresModAchillesExpansion/addons/modules_f_achilles/FireSupport/functions/fn_ModuleFireSupportNuke.sqf +++ b/@AresModAchillesExpansion/addons/modules_f_achilles/FireSupport/functions/fn_ModuleFireSupportNuke.sqf @@ -49,7 +49,6 @@ _doColorCorrection = _doColorCorrection isEqualTo 0; "_destructionRate" ]; sleep 5; - private _curatorPlayers = [] call BIS_fnc_listCuratorPlayers; // big destruction if (_destructionRadius > 0 && _destructionRate > 0) then { @@ -62,8 +61,8 @@ _doColorCorrection = _doColorCorrection isEqualTo 0; private _currentArrayLength = _numberOfObjects - _idxStart - 1; _currentArrayLength = [_currentArrayLength, _destructionRate] select (_currentArrayLength > _destructionRate); { - // Do not kill logics, HCs and curators. - if (!(_x isKindOf "Logic") && !(_x in _curatorPlayers) && !(_x isKindOf "HeadlessClient_F")) then + // Do not kill "invincible" units, logics, HCs and virtual curators. + if ((isDamageAllowed _x) && !(_x isKindOf "Logic") && !(_x isKindOf "VirtualMan_F")) then { if (isNil {_x getVariable ["Achilles_var_switchUnit_data", nil]}) then { diff --git a/@AresModAchillesExpansion/addons/modules_f_achilles/Objects/functions/fn_ModuleObjectsMakeInvincible.sqf b/@AresModAchillesExpansion/addons/modules_f_achilles/Objects/functions/fn_ModuleObjectsMakeInvincible.sqf index 1547f148..86ffb1a8 100644 --- a/@AresModAchillesExpansion/addons/modules_f_achilles/Objects/functions/fn_ModuleObjectsMakeInvincible.sqf +++ b/@AresModAchillesExpansion/addons/modules_f_achilles/Objects/functions/fn_ModuleObjectsMakeInvincible.sqf @@ -34,20 +34,10 @@ if (_objects isEqualTo []) exitWith {[localize "STR_AMAE_NO_OBJECT_SELECTED"] ca { private _object = _x; - if (local _object) then + [_object, _allowDamage] remoteExecCall ["allowDamage"]; + if (_includeCrew) then { - _object allowDamage _allowDamage; - if (_includeCrew) then - { - {_x allowDamage _allowDamage} forEach crew _object; - }; - } else - { - [_object,_allowDamage] remoteExecCall ["allowDamage",_object]; - if (_includeCrew) then - { - [_x,_allowDamage] remoteExecCall ["allowDamage",crew _object]; - }; + {[_x, _allowDamage] remoteExecCall ["allowDamage"]} forEach crew _object; }; } forEach _objects; diff --git a/@AresModAchillesExpansion/addons/modules_f_ares/Zeus/functions/fn_ZeusVisibility.sqf b/@AresModAchillesExpansion/addons/modules_f_ares/Zeus/functions/fn_ZeusVisibility.sqf index 9d724407..16b04674 100644 --- a/@AresModAchillesExpansion/addons/modules_f_ares/Zeus/functions/fn_ZeusVisibility.sqf +++ b/@AresModAchillesExpansion/addons/modules_f_ares/Zeus/functions/fn_ZeusVisibility.sqf @@ -27,7 +27,7 @@ private _curatorLogic = getAssignedCuratorLogic player; if (_invisible and !(isObjectHidden player)) then { [player, true] remoteExecCall ["hideObjectGlobal",2]; - player allowDamage false; + [player, false] remoteExecCall ["allowDamage"]; player setCaptive true; _curatorLogic setVariable ["showNotification", true]; @@ -43,7 +43,7 @@ else if (!_invisible and (isObjectHidden player)) then { [player, false] remoteExecCall ["hideObjectGlobal",2]; - player allowDamage true; + [player, true] remoteExecCall ["allowDamage"]; player setCaptive false; _curatorLogic setVariable ["showNotification", false];