From 73bb1251b93926b6e3b858297236e26cf232b090 Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Fri, 19 Nov 2021 09:08:54 -0500 Subject: [PATCH 01/25] add floating helper --- addons/main/CfgVehicles.hpp | 8 ++++++++ addons/main/data/float.p3d | Bin 0 -> 2968 bytes 2 files changed, 8 insertions(+) create mode 100644 addons/main/data/float.p3d diff --git a/addons/main/CfgVehicles.hpp b/addons/main/CfgVehicles.hpp index 74a9e40..3547307 100644 --- a/addons/main/CfgVehicles.hpp +++ b/addons/main/CfgVehicles.hpp @@ -98,6 +98,14 @@ class CfgVehicles { class AnyPerson2 : AnyPerson1 {}; }; }; + class Buoy_base_F; + class GVAR(float): Buoy_base_F { + author = "Ampersand"; + displayName = "Float"; + _generalMacro = QGVAR(float); + model = QPATHTOF(data\float.p3d); + scope = 2; + }; class Man; class CAManBase: Man { class ACE_SelfActions { diff --git a/addons/main/data/float.p3d b/addons/main/data/float.p3d new file mode 100644 index 0000000000000000000000000000000000000000..e97743ef516f999db5b0e91bab484b61ce1f68db GIT binary patch literal 2968 zcmdT`y-veG48HI`At6=L;eHkN`^V4(tuAF-j39JErJt7rgq>%a@}7(4|Gth@sf z1FwOdi`&abTB@*sCD-=ZpJQKhzBCRF>z=37tWxS|v)))CsmMk;+1cOs{G%Jw(Kl(& zSA7bIO_Z2!Gls``1YY zGa^UVg!_V-5sBRnYhumq1~VfPyS16@i96P@4pSZZYLS+`B88^iF^Nvn^^Gz&9M>=o zx?P*Q((j#aw!&Cf!ZHZQM-;S!>+0!LVk(!C0kNKT(D_xuxOLr3o94D#u_vtO^49c% zBi6TdK`)H2R=I%pwfZ<7jN;d-)&4Qux2xpyVd-@IRnq5CPc)GE$RF73-v+;H z3tn(21@EpiKC_+C&sPF7Uj?Fzbk{@|$uXj{EO6Pd#lc4X6$T#;WA+cP4bCWpBM?U< z4quC7RM|7!;ftB^LKtSkfsdIHIl3m?7tD-E>~>faYi>7~8Ijnn%~W=kWFAkx1iYWF llKe~S)h7J+za_`}v2eVxL%W4PeQ!Qpgy-&%sG8;D{0qoo=^Fq5 literal 0 HcmV?d00001 From 512705bbe0217464a3e523d6b9662e0389aeb51e Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Fri, 19 Nov 2021 09:10:40 -0500 Subject: [PATCH 02/25] add space --- addons/main/functions/fnc_actionOnChest.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/main/functions/fnc_actionOnChest.sqf b/addons/main/functions/fnc_actionOnChest.sqf index 46d2fd4..7774bfb 100644 --- a/addons/main/functions/fnc_actionOnChest.sqf +++ b/addons/main/functions/fnc_actionOnChest.sqf @@ -15,7 +15,7 @@ * Public: No */ -params["_unit"]; +params ["_unit"]; private _backpack = backpack _unit; private _backpackLoad = loadBackpack _unit; From a3e881bee949801b93dd21ebe022f014c5cc66af Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Fri, 19 Nov 2021 09:10:52 -0500 Subject: [PATCH 03/25] fix packs not hidden --- addons/main/XEH_postInit.sqf | 5 +++++ addons/main/functions/fnc_EHGetIn.sqf | 4 ++-- addons/main/functions/fnc_EHGetOut.sqf | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/addons/main/XEH_postInit.sqf b/addons/main/XEH_postInit.sqf index 2abff8b..305cde9 100644 --- a/addons/main/XEH_postInit.sqf +++ b/addons/main/XEH_postInit.sqf @@ -16,6 +16,11 @@ [QGVAR(clearCargoBackpacks), {call FUNC(clearCargoBackpacks)}] call CBA_fnc_addEventHandler; if (isServer) then { + [QGVAR(hideObjectGlobal), { + params ["_object", "_hide"]; + _object hideObjectGlobal _hide; + }] call CBA_fnc_addEventHandler; + [QGVAR(handleDisconnect), { addMissionEventHandler ["HandleDisconnect", FUNC(EHHandleDisconnect)]; }] call CBA_fnc_addEventHandler; diff --git a/addons/main/functions/fnc_EHGetIn.sqf b/addons/main/functions/fnc_EHGetIn.sqf index 11f9867..ebc8b19 100644 --- a/addons/main/functions/fnc_EHGetIn.sqf +++ b/addons/main/functions/fnc_EHGetIn.sqf @@ -26,9 +26,9 @@ private _chestpack = [_unit] call FUNC(chestpackContainer); if (_veh isKindOf "ParachuteBase") then { _chestpack attachTo [_veh, [0, -0.03, -0.5]]; _chestpack setVectorDirAndUp [[-0.25, -1, 0], [0, 0, 1]]; - _chestpack hideObjectGlobal false; + [QGVAR(hideObjectGlobal), [_chestpack, false]] call CBA_fnc_serverEvent; } else { detach _chestpack; - hideObjectGlobal _chestpack; _chestpack setPos [-10000,-10000,-100]; + [QGVAR(hideObjectGlobal), [_chestpack, true]] call CBA_fnc_serverEvent; }; diff --git a/addons/main/functions/fnc_EHGetOut.sqf b/addons/main/functions/fnc_EHGetOut.sqf index ac828cc..20b0962 100644 --- a/addons/main/functions/fnc_EHGetOut.sqf +++ b/addons/main/functions/fnc_EHGetOut.sqf @@ -27,7 +27,7 @@ private _chestpackClass = [_unit] call FUNC(chestpack); if !(_chestpackClass in GVAR(exceptions)) then { _chestpack attachTo [_unit,[0,-0.03,-0.5],"pelvis"]; _chestpack setVectorDirAndUp [[-0.25,-1,0],[0,0,1]]; - _chestpack hideObjectGlobal false; + [QGVAR(hideObjectGlobal), [_chestpack, false]] call CBA_fnc_serverEvent; }; if (GVAR(walk)) then { From c8608a6b0e7fb7e36ca44b1a07fd9fc3a4af0fc7 Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Fri, 19 Nov 2021 09:11:28 -0500 Subject: [PATCH 04/25] if pack lands in water, make it float --- addons/main/XEH_PREP.hpp | 1 + addons/main/XEH_postInit.sqf | 19 +-------- addons/main/functions/fnc_checkLandedPFH.sqf | 45 ++++++++++++++++++++ 3 files changed, 48 insertions(+), 17 deletions(-) create mode 100644 addons/main/functions/fnc_checkLandedPFH.sqf diff --git a/addons/main/XEH_PREP.hpp b/addons/main/XEH_PREP.hpp index 8e0cae9..1510180 100644 --- a/addons/main/XEH_PREP.hpp +++ b/addons/main/XEH_PREP.hpp @@ -17,6 +17,7 @@ PREP(canAddItemToChestpack); PREP(canCutLoweringLine); PREP(canMovePack); PREP(canLower); +PREP(checkLandedPFH); PREP(chestpack); PREP(chestpackContainer); PREP(chestpackLoadout); diff --git a/addons/main/XEH_postInit.sqf b/addons/main/XEH_postInit.sqf index 305cde9..39288cf 100644 --- a/addons/main/XEH_postInit.sqf +++ b/addons/main/XEH_postInit.sqf @@ -28,23 +28,8 @@ if (isServer) then { // PFH to check when the helper object _ropeTop and the WeaponHolderSimulated // holding the backpack have landed [QGVAR(checkLandedPFH), { - params ["_ropeTop", "_holder"]; - [{ - params ["_ropeTop", "_pfhID"]; - if (speed _ropeTop < 1 && {getPos _ropeTop # 2 < 1}) exitWith { - deleteVehicle _ropeTop; - [_pfhID] call CBA_fnc_removePerFrameHandler; - }; - }, 1, _ropeTop] call CBA_fnc_addPerFrameHandler; - [{ - params ["_holder", "_pfhID"]; - if (speed _holder < 1 && {getPos _holder # 2 < 1}) exitWith { - private _pos = getPos _holder; - _pos set [2, 0]; - _holder setPos _pos; - [_pfhID] call CBA_fnc_removePerFrameHandler; - }; - }, 1, _holder] call CBA_fnc_addPerFrameHandler; + //params ["_ropeTop", "_holder"]; + [{call FUNC(checkLandedPFH)}, 1, _this] call CBA_fnc_addPerFrameHandler; }] call CBA_fnc_addEventHandler; }; diff --git a/addons/main/functions/fnc_checkLandedPFH.sqf b/addons/main/functions/fnc_checkLandedPFH.sqf new file mode 100644 index 0000000..9948b51 --- /dev/null +++ b/addons/main/functions/fnc_checkLandedPFH.sqf @@ -0,0 +1,45 @@ +#include "script_component.hpp" +/* + * Author: Ampersand + * Called on server when chestpack is lowered. + * + * Arguments: + * 0: Unit + * + * Return Value: + * Nothing + * + * Example: + * [_ropeTop, _holder] call bocr_main_fnc_checkLandedPFH; + * + * Public: No + */ + + params ["_args", "_pfhID"]; + _args params ["_ropeTop", "_holder"]; + + private _pos = getPos _holder; + private _alt = _pos # 2; + if (speed _holder < 1 && {_alt < 1}) exitWith { + deleteVehicle _ropeTop; + _alt = getPosASL _holder # 2; + if (_alt < 1 && {surfaceIsWater _pos}) then { + // Make pack float + private _float = QGVAR(float) createVehicle [0, 0, 0]; + _float setPosASL (_pos vectorAdd [0, 0, -2]); + _holder attachTo [_float, [0, 0, 1.5]]; + _holder setVariable [QGVAR(float), _float]; + _holder addaction ["Discard", { + params ["_holder"]; + deleteVehicle _holder; + }, nil, 7, true, true, "", "backpackCargo _target isEqualTo ['ACE_ReserveParachute']"]; + _holder addEventHandler ["Deleted", { + params ["_holder"]; + deleteVehicle (_holder getVariable QGVAR(float)); + }]; + } else { + _holder setVectorUp [0,0,1]; + _holder setPosASL (_pos vectorAdd [0,0,0.1]); + }; + [_pfhID] call CBA_fnc_removePerFrameHandler; + }; From 1b2125d3f22b120f293893c15173127ebc3d928f Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Fri, 19 Nov 2021 09:11:49 -0500 Subject: [PATCH 05/25] fix incorrect position when lowering over water --- addons/main/functions/fnc_actionLower.sqf | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/main/functions/fnc_actionLower.sqf b/addons/main/functions/fnc_actionLower.sqf index 720579d..035d75f 100644 --- a/addons/main/functions/fnc_actionLower.sqf +++ b/addons/main/functions/fnc_actionLower.sqf @@ -18,17 +18,20 @@ params ["_unit"]; private _chute = vehicle _unit; +private _pos = getPosASL _chute; // Rope top helper, workaround parachute rope visual bug, allow cut -private _ropeTop = createVehicle ["ace_fastroping_helper", getPos _chute, [], 0, "CAN_COLLIDE"]; +private _ropeTop = createVehicle ["ace_fastroping_helper", [0, 0, 100], [], 0, "CAN_COLLIDE"]; _chute setVariable [QGVAR(loweringLine), _ropeTop, true]; _ropeTop allowDamage false; _ropeTop disableCollisionWith _chute; +_ropeTop setPosASL _pos; // Weapon holder with backpack private _holder = [_unit] call FUNC(chestpackToHolder); // Chestpack to holder _holder disableCollisionWith _chute; -_holder setPos (_chute modelToWorld [0, 1, -1]); +_holder attachTo [_chute, [0, 1, -1]]; +detach _holder; _holder setVelocity velocity _chute; private _rope = ropeCreate [ @@ -39,7 +42,7 @@ private _rope = ropeCreate [ [{ params ["_chute", "_ropeTop"]; - _ropeTop attachTo [_chute, [0,0,0]]; + _ropeTop attachTo [_chute, [0, 0, 0]]; }, [_chute, _ropeTop]] call CBA_fnc_execNextFrame; [QGVAR(checkLandedPFH), [_ropeTop, _holder]] call CBA_fnc_serverEvent; From 3cedf0982b806842159ed8e6c7f1e747924858d8 Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Fri, 19 Nov 2021 09:16:49 -0500 Subject: [PATCH 06/25] disable Cut action if rope breaks --- addons/main/XEH_postInit.sqf | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/main/XEH_postInit.sqf b/addons/main/XEH_postInit.sqf index 39288cf..10d0fa3 100644 --- a/addons/main/XEH_postInit.sqf +++ b/addons/main/XEH_postInit.sqf @@ -28,7 +28,11 @@ if (isServer) then { // PFH to check when the helper object _ropeTop and the WeaponHolderSimulated // holding the backpack have landed [QGVAR(checkLandedPFH), { - //params ["_ropeTop", "_holder"]; + params ["_ropeTop", "_holder"]; + _ropeTop addEventHandler ["RopeBreak", { + //params ["_ropeTop", "_rope", "_holder"]; + deleteVehicle _this # 0; + }]; [{call FUNC(checkLandedPFH)}, 1, _this] call CBA_fnc_addPerFrameHandler; }] call CBA_fnc_addEventHandler; }; From 9ffddb6eb798ddc192b9a86a1bfa6f29bda1b5c9 Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Fri, 19 Nov 2021 09:18:39 -0500 Subject: [PATCH 07/25] fix game crash on cut Game seems to crash when trying to detach the ropeTop and attach it again the same frame --- .../functions/fnc_actionCutLoweringLine.sqf | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/addons/main/functions/fnc_actionCutLoweringLine.sqf b/addons/main/functions/fnc_actionCutLoweringLine.sqf index 7809f39..e21ab0b 100644 --- a/addons/main/functions/fnc_actionCutLoweringLine.sqf +++ b/addons/main/functions/fnc_actionCutLoweringLine.sqf @@ -18,15 +18,22 @@ params ["_unit"]; private _chute = vehicle _unit; private _ropeTop = _chute getVariable [QGVAR(loweringLine), objNull]; +_chute setVariable [QGVAR(loweringLine), objNull, true]; if (!isNull _ropeTop) then { private _rope = ropes _ropeTop # 0; - private _holder = ropeAttachedObjects _ropeTop # 0; - _holder ropeDetach _rope; - // ace_fastroping_helper is a helicopter and kind of autorotates down instead - // of falling, much slower than a falling object. Attaching to the holder - // also looks like the rope snapping under tension once cut - _ropeTop attachTo [_holder, [0.1,-0.45,-0.6]]; - - _chute setVariable [QGVAR(loweringLine), objNull, true]; + private _attachedObjects = ropeAttachedObjects _ropeTop; + if (_attachedObjects isEqualTo []) then { + deleteVehicle _ropeTop; + } else { + private _holder = _attachedObjects # 0; + _holder ropeDetach _rope; + // ace_fastroping_helper is a helicopter and kind of autorotates down instead + // of falling, much slower than a falling object. Attaching to the holder + // also looks like the rope snapping under tension once cut + [{ + params ["_ropeTop", "_holder"]; + _ropeTop attachTo [_holder, [0.1,-0.45,-0.6]]; + }, [_ropeTop, _holder]] call CBA_fnc_execNextFrame; + }; }; From 93c7c45cc253587cab686c799fb210d612fff64d Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Fri, 19 Nov 2021 14:24:12 -0500 Subject: [PATCH 08/25] use ASL --- addons/main/functions/fnc_EHKilled.sqf | 3 ++- addons/main/functions/fnc_chestpackToHolder.sqf | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/main/functions/fnc_EHKilled.sqf b/addons/main/functions/fnc_EHKilled.sqf index c4200db..c3f8e5c 100644 --- a/addons/main/functions/fnc_EHKilled.sqf +++ b/addons/main/functions/fnc_EHKilled.sqf @@ -21,7 +21,8 @@ private _chestpack = [_unit] call FUNC(chestpack); private _chestpackLoadout = [_unit] call FUNC(chestpackLoadout); private _chestpackVariables = [_unit] call FUNC(chestpackVariables); -private _holder = createVehicle ["WeaponHolderSimulated", (getPos _unit), [], 0, "CAN_COLLIDE"]; +private _holder = createVehicle ["WeaponHolderSimulated", [0, 0, 0], [], 0, "CAN_COLLIDE"]; +_holder setPosASL getPosASL _unit; //add pack _holder addBackpackCargoGlobal [_chestpack, 1]; diff --git a/addons/main/functions/fnc_chestpackToHolder.sqf b/addons/main/functions/fnc_chestpackToHolder.sqf index 7a0b88e..946f623 100644 --- a/addons/main/functions/fnc_chestpackToHolder.sqf +++ b/addons/main/functions/fnc_chestpackToHolder.sqf @@ -22,7 +22,8 @@ if (_chestpack isEqualTo "") exitWith {objNull}; private _chestpackLoadout = [_unit] call FUNC(chestpackLoadout); private _chestpackVariables = [_unit] call FUNC(chestpackVariables); -private _holder = createVehicle ["WeaponHolderSimulated", (getPos _unit), [], 0, "CAN_COLLIDE"]; +private _holder = createVehicle ["WeaponHolderSimulated", [0, 0, 0], [], 0, "CAN_COLLIDE"]; +_holder setPosASL getPosASL _unit; //add pack _holder addBackpackCargoGlobal [_chestpack, 1]; From b85c658fda81ea9decbfda53cdc2fc32968ed61f Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Fri, 19 Nov 2021 14:24:45 -0500 Subject: [PATCH 09/25] float, sink, and delete parachute pack --- addons/main/XEH_postInit.sqf | 2 + addons/main/functions/fnc_checkLandedPFH.sqf | 14 +----- addons/main/functions/fnc_floatPack.sqf | 48 ++++++++++++++++++++ 3 files changed, 51 insertions(+), 13 deletions(-) create mode 100644 addons/main/functions/fnc_floatPack.sqf diff --git a/addons/main/XEH_postInit.sqf b/addons/main/XEH_postInit.sqf index 10d0fa3..d78f4ef 100644 --- a/addons/main/XEH_postInit.sqf +++ b/addons/main/XEH_postInit.sqf @@ -15,6 +15,8 @@ // Clear inventory of every backpack in a container [QGVAR(clearCargoBackpacks), {call FUNC(clearCargoBackpacks)}] call CBA_fnc_addEventHandler; +[QGVAR(floatPack), {call FUNC(floatPack)}] call CBA_fnc_addEventHandler; + if (isServer) then { [QGVAR(hideObjectGlobal), { params ["_object", "_hide"]; diff --git a/addons/main/functions/fnc_checkLandedPFH.sqf b/addons/main/functions/fnc_checkLandedPFH.sqf index 9948b51..d5ac4b0 100644 --- a/addons/main/functions/fnc_checkLandedPFH.sqf +++ b/addons/main/functions/fnc_checkLandedPFH.sqf @@ -24,19 +24,7 @@ deleteVehicle _ropeTop; _alt = getPosASL _holder # 2; if (_alt < 1 && {surfaceIsWater _pos}) then { - // Make pack float - private _float = QGVAR(float) createVehicle [0, 0, 0]; - _float setPosASL (_pos vectorAdd [0, 0, -2]); - _holder attachTo [_float, [0, 0, 1.5]]; - _holder setVariable [QGVAR(float), _float]; - _holder addaction ["Discard", { - params ["_holder"]; - deleteVehicle _holder; - }, nil, 7, true, true, "", "backpackCargo _target isEqualTo ['ACE_ReserveParachute']"]; - _holder addEventHandler ["Deleted", { - params ["_holder"]; - deleteVehicle (_holder getVariable QGVAR(float)); - }]; + [_holder] call bocr_main_fnc_floatPack; } else { _holder setVectorUp [0,0,1]; _holder setPosASL (_pos vectorAdd [0,0,0.1]); diff --git a/addons/main/functions/fnc_floatPack.sqf b/addons/main/functions/fnc_floatPack.sqf new file mode 100644 index 0000000..1e97f2d --- /dev/null +++ b/addons/main/functions/fnc_floatPack.sqf @@ -0,0 +1,48 @@ +#include "script_component.hpp" +/* + * Author: Ampersand + * Attaches a backpack's weaponholder to a floating helper + * + * Arguments: + * 0: Weapon Holder + * + * Return Value: + * Float + * + * Example: + * [_holder] call bocr_main_fnc_floatPack; + * + * Public: No + */ + +params ["_holder"]; + +// Make pack float +if (isServer) then { + private _float = QGVAR(float) createVehicle [0, 0, 0]; + _float setPosASL (getPosASL _holder vectorAdd [0, 0, -2]); + _holder attachTo [_float, [0, 0, 1.5]]; + _holder setVariable [QGVAR(float), _float, true]; + + _holder addEventHandler ["Deleted", { + params ["_holder"]; + deleteVehicle (_holder getVariable QGVAR(float)); + }]; + _float addEventHandler ["EpeContact", { + //params ["_object1", "_object2", "_selection1", "_selection2", "_force"]; + params ["_float", "_object2"]; + if (isNull _object2) then { + { + deleteVehicle _x; + } forEach attachedObjects _float; + deleteVehicle _float; // Delete when on ocean bottom + }; + }]; +}; + +if (hasInterface) then { + _holder addaction ["Discard", { + // Make pack sink + ((_this # 0) getVariable QGVAR(float) setMass 10000); + }, nil, 7, true, true, "", "firstBackpack _target isKindOf 'B_Parachute'"]; +}; From 10a47723a28293f5d797c6f895b5623078d73f0d Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Fri, 19 Nov 2021 14:25:22 -0500 Subject: [PATCH 10/25] Add discard parachute action --- addons/main/CfgVehicles.hpp | 6 ++++ addons/main/Stringtable.xml | 4 +++ addons/main/XEH_PREP.hpp | 4 +++ .../functions/fnc_actionDiscardParachute.sqf | 31 +++++++++++++++++++ .../functions/fnc_canDiscardParachute.sqf | 23 ++++++++++++++ 5 files changed, 68 insertions(+) create mode 100644 addons/main/functions/fnc_actionDiscardParachute.sqf create mode 100644 addons/main/functions/fnc_canDiscardParachute.sqf diff --git a/addons/main/CfgVehicles.hpp b/addons/main/CfgVehicles.hpp index 3547307..ca62753 100644 --- a/addons/main/CfgVehicles.hpp +++ b/addons/main/CfgVehicles.hpp @@ -141,6 +141,12 @@ class CfgVehicles { condition = QUOTE([_player] call FUNC(canCutLoweringLine)); statement = QUOTE([_player] call FUNC(actionCutLoweringLine)); }; + class GVAR(discardParachute) : GVAR(onChest) { + displayName = CSTRING(DiscardParachute); + exceptions[] = {"isNotSwimming"}; + condition = QUOTE([_player] call FUNC(canDiscardParachute)); + statement = QUOTE([_player] call FUNC(actionDiscardParachute)); + }; }; }; }; diff --git a/addons/main/Stringtable.xml b/addons/main/Stringtable.xml index 82777f6..4bf4073 100644 --- a/addons/main/Stringtable.xml +++ b/addons/main/Stringtable.xml @@ -112,5 +112,9 @@ Cut Lowering Line Cut Lowering Line + + Discard Parachute + Discard Parachute + diff --git a/addons/main/XEH_PREP.hpp b/addons/main/XEH_PREP.hpp index 1510180..807e070 100644 --- a/addons/main/XEH_PREP.hpp +++ b/addons/main/XEH_PREP.hpp @@ -2,9 +2,11 @@ PREP(ace_arsenal_onButtonClick); PREP(ace_arsenal_opened); PREP(ace_arsenal_updateUI); PREP(actionCutLoweringLine); +PREP(actionDiscardParachute); PREP(actionLower); PREP(actionOnBack); PREP(actionOnChest); +PREP(actionOnChest); PREP(actionSwap); PREP(addChestpack); PREP(addItemToChestpack); @@ -15,6 +17,7 @@ PREP(arsenal_postInit); PREP(arsenal_updateUI); PREP(canAddItemToChestpack); PREP(canCutLoweringLine); +PREP(canDiscardParachute); PREP(canMovePack); PREP(canLower); PREP(checkLandedPFH); @@ -31,6 +34,7 @@ PREP(EHGetIn); PREP(EHGetOut); PREP(EHHandleDisconnect); PREP(EHKilled); +PREP(floatPack); PREP(itemMass); PREP(moduleAdd); PREP(moduleOnChest); diff --git a/addons/main/functions/fnc_actionDiscardParachute.sqf b/addons/main/functions/fnc_actionDiscardParachute.sqf new file mode 100644 index 0000000..b42c21a --- /dev/null +++ b/addons/main/functions/fnc_actionDiscardParachute.sqf @@ -0,0 +1,31 @@ +#include "script_component.hpp" +/* + * Author: Ampersand + * Triggered by the discard-reserve-action. + * Puts the reserve parachute into WeaponHolderSimulated to sink and + * moves the chestpack to back if present. + * + * Arguments: + * 0: Unit + * + * Return Value: + * Nothing + * + * Example: + * [player] call bocr_main_fnc_actionDiscardParachute; + * + * Public: No + */ +params ["_unit"]; + +private _holder = createVehicle ["WeaponHolderSimulated", [0, 0, 0], [], 0, "CAN_COLLIDE"]; +_holder addBackpackCargoGlobal [backpack _unit, 1]; +removeBackpack _unit; +_holder setPosASL (getPosASL _unit vectorAdd vectorDir _unit); + +[QGVAR(floatPack), [_holder]] call CBA_fnc_globalEvent; + +private _chestpack = [_unit] call FUNC(chestpack); +if (_chestpack != "") then { + [_unit] call FUNC(actionOnBack); +}; diff --git a/addons/main/functions/fnc_canDiscardParachute.sqf b/addons/main/functions/fnc_canDiscardParachute.sqf new file mode 100644 index 0000000..915783f --- /dev/null +++ b/addons/main/functions/fnc_canDiscardParachute.sqf @@ -0,0 +1,23 @@ +#include "script_component.hpp" +/* + * Author: Ampersand + * Checks if given unit can discard its reserve parachute + * + * Arguments: + * 0: Unit + * + * Return Value: + * Success + * + * Example: + * [_unit] call bocr_main_fnc_canDiscardParachute; + * + * Public: No + */ + +params ["_unit"]; + +if (GVAR(disabled)) exitWith {false}; + +[_unit] call ace_common_fnc_isSwimming && // Can't move pack while in a parachute +{backpackContainer _unit isKindOf "B_Parachute"} From 3e3b779d37f3ce1956991ce00f07714b26bd1447 Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Fri, 19 Nov 2021 14:39:17 -0500 Subject: [PATCH 11/25] add depth check --- addons/main/functions/fnc_floatPack.sqf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/main/functions/fnc_floatPack.sqf b/addons/main/functions/fnc_floatPack.sqf index 1e97f2d..07a1d7c 100644 --- a/addons/main/functions/fnc_floatPack.sqf +++ b/addons/main/functions/fnc_floatPack.sqf @@ -17,6 +17,12 @@ params ["_holder"]; +// Float model is too big =/ Can't get it to be stable with a smaller model +_pos = getPosASL _holder; +_pos set [2, 0]; +private _depth = ASLToATL _pos # 2; +if (_depth < 5) exitWith {}; + // Make pack float if (isServer) then { private _float = QGVAR(float) createVehicle [0, 0, 0]; From d2f6dd2de5828938219da073545569ad05ef8479 Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Fri, 19 Nov 2021 15:03:32 -0500 Subject: [PATCH 12/25] tabs to spaces --- addons/main/XEH_postInit.sqf | 2 +- addons/main/functions/fnc_floatPack.sqf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/main/XEH_postInit.sqf b/addons/main/XEH_postInit.sqf index d78f4ef..11a3566 100644 --- a/addons/main/XEH_postInit.sqf +++ b/addons/main/XEH_postInit.sqf @@ -32,7 +32,7 @@ if (isServer) then { [QGVAR(checkLandedPFH), { params ["_ropeTop", "_holder"]; _ropeTop addEventHandler ["RopeBreak", { - //params ["_ropeTop", "_rope", "_holder"]; + //params ["_ropeTop", "_rope", "_holder"]; deleteVehicle _this # 0; }]; [{call FUNC(checkLandedPFH)}, 1, _this] call CBA_fnc_addPerFrameHandler; diff --git a/addons/main/functions/fnc_floatPack.sqf b/addons/main/functions/fnc_floatPack.sqf index 07a1d7c..9e14a25 100644 --- a/addons/main/functions/fnc_floatPack.sqf +++ b/addons/main/functions/fnc_floatPack.sqf @@ -35,7 +35,7 @@ if (isServer) then { deleteVehicle (_holder getVariable QGVAR(float)); }]; _float addEventHandler ["EpeContact", { - //params ["_object1", "_object2", "_selection1", "_selection2", "_force"]; + //params ["_object1", "_object2", "_selection1", "_selection2", "_force"]; params ["_float", "_object2"]; if (isNull _object2) then { { From 01cd7701dbceaa10e77f3e29c4dbced1793183e3 Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Tue, 11 Jan 2022 20:52:25 -0500 Subject: [PATCH 13/25] Update addons/main/functions/fnc_actionCutLoweringLine.sqf Co-authored-by: mjc4wilton --- addons/main/functions/fnc_actionCutLoweringLine.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/main/functions/fnc_actionCutLoweringLine.sqf b/addons/main/functions/fnc_actionCutLoweringLine.sqf index e21ab0b..abed8c8 100644 --- a/addons/main/functions/fnc_actionCutLoweringLine.sqf +++ b/addons/main/functions/fnc_actionCutLoweringLine.sqf @@ -16,7 +16,7 @@ */ params ["_unit"]; -private _chute = vehicle _unit; +private _vehicle = vehicle _unit; private _ropeTop = _chute getVariable [QGVAR(loweringLine), objNull]; _chute setVariable [QGVAR(loweringLine), objNull, true]; From 1d3ab9228a8218d39a3c86ecf2ac1254ab03b219 Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Tue, 11 Jan 2022 20:52:29 -0500 Subject: [PATCH 14/25] Update addons/main/functions/fnc_actionCutLoweringLine.sqf Co-authored-by: mjc4wilton --- addons/main/functions/fnc_actionCutLoweringLine.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/main/functions/fnc_actionCutLoweringLine.sqf b/addons/main/functions/fnc_actionCutLoweringLine.sqf index abed8c8..d246f48 100644 --- a/addons/main/functions/fnc_actionCutLoweringLine.sqf +++ b/addons/main/functions/fnc_actionCutLoweringLine.sqf @@ -17,8 +17,8 @@ params ["_unit"]; private _vehicle = vehicle _unit; -private _ropeTop = _chute getVariable [QGVAR(loweringLine), objNull]; -_chute setVariable [QGVAR(loweringLine), objNull, true]; +private _ropeTop = _vehicle getVariable [QGVAR(loweringLine), objNull]; +_vehicle setVariable [QGVAR(loweringLine), objNull, true]; if (!isNull _ropeTop) then { private _rope = ropes _ropeTop # 0; From 2709bf7da605e8224b856d9fbb5d4135151273f0 Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Tue, 11 Jan 2022 20:52:33 -0500 Subject: [PATCH 15/25] Update addons/main/functions/fnc_actionLower.sqf Co-authored-by: mjc4wilton --- addons/main/functions/fnc_actionLower.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/main/functions/fnc_actionLower.sqf b/addons/main/functions/fnc_actionLower.sqf index 035d75f..3f96270 100644 --- a/addons/main/functions/fnc_actionLower.sqf +++ b/addons/main/functions/fnc_actionLower.sqf @@ -17,8 +17,8 @@ params ["_unit"]; -private _chute = vehicle _unit; -private _pos = getPosASL _chute; +private _vehicle = vehicle _unit; +private _pos = getPosASL _vehicle; // Rope top helper, workaround parachute rope visual bug, allow cut private _ropeTop = createVehicle ["ace_fastroping_helper", [0, 0, 100], [], 0, "CAN_COLLIDE"]; From d617be8f6bf44e48ecfe9ee2b2ce42e8bddf4a02 Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Tue, 11 Jan 2022 20:52:40 -0500 Subject: [PATCH 16/25] Update addons/main/functions/fnc_actionLower.sqf Co-authored-by: mjc4wilton --- addons/main/functions/fnc_actionLower.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/main/functions/fnc_actionLower.sqf b/addons/main/functions/fnc_actionLower.sqf index 3f96270..c2df37e 100644 --- a/addons/main/functions/fnc_actionLower.sqf +++ b/addons/main/functions/fnc_actionLower.sqf @@ -22,9 +22,9 @@ private _pos = getPosASL _vehicle; // Rope top helper, workaround parachute rope visual bug, allow cut private _ropeTop = createVehicle ["ace_fastroping_helper", [0, 0, 100], [], 0, "CAN_COLLIDE"]; -_chute setVariable [QGVAR(loweringLine), _ropeTop, true]; +_vehicle setVariable [QGVAR(loweringLine), _ropeTop, true]; _ropeTop allowDamage false; -_ropeTop disableCollisionWith _chute; +_ropeTop disableCollisionWith _vehicle; _ropeTop setPosASL _pos; // Weapon holder with backpack From 44913cbb42307111a94b0b4cf0d723bd792bcc6a Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Tue, 11 Jan 2022 20:52:44 -0500 Subject: [PATCH 17/25] Update addons/main/functions/fnc_actionLower.sqf Co-authored-by: mjc4wilton --- addons/main/functions/fnc_actionLower.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/main/functions/fnc_actionLower.sqf b/addons/main/functions/fnc_actionLower.sqf index c2df37e..1265c1e 100644 --- a/addons/main/functions/fnc_actionLower.sqf +++ b/addons/main/functions/fnc_actionLower.sqf @@ -29,7 +29,7 @@ _ropeTop setPosASL _pos; // Weapon holder with backpack private _holder = [_unit] call FUNC(chestpackToHolder); // Chestpack to holder -_holder disableCollisionWith _chute; +_holder disableCollisionWith _vehicle; _holder attachTo [_chute, [0, 1, -1]]; detach _holder; _holder setVelocity velocity _chute; From 222c86ad1cd7a6899917a7219de1c075e2629077 Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Tue, 11 Jan 2022 20:52:53 -0500 Subject: [PATCH 18/25] Update addons/main/functions/fnc_actionLower.sqf Co-authored-by: mjc4wilton --- addons/main/functions/fnc_actionLower.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/main/functions/fnc_actionLower.sqf b/addons/main/functions/fnc_actionLower.sqf index 1265c1e..e5a53f1 100644 --- a/addons/main/functions/fnc_actionLower.sqf +++ b/addons/main/functions/fnc_actionLower.sqf @@ -30,7 +30,7 @@ _ropeTop setPosASL _pos; // Weapon holder with backpack private _holder = [_unit] call FUNC(chestpackToHolder); // Chestpack to holder _holder disableCollisionWith _vehicle; -_holder attachTo [_chute, [0, 1, -1]]; +_holder attachTo [_vehicle, [0, 1, -1]]; detach _holder; _holder setVelocity velocity _chute; From c5c8e4f356be927c0542ce43f6677737f70495f5 Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Tue, 11 Jan 2022 20:52:58 -0500 Subject: [PATCH 19/25] Update addons/main/XEH_postInit.sqf Co-authored-by: mjc4wilton --- addons/main/XEH_postInit.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/main/XEH_postInit.sqf b/addons/main/XEH_postInit.sqf index 11a3566..77b3c6a 100644 --- a/addons/main/XEH_postInit.sqf +++ b/addons/main/XEH_postInit.sqf @@ -33,7 +33,7 @@ if (isServer) then { params ["_ropeTop", "_holder"]; _ropeTop addEventHandler ["RopeBreak", { //params ["_ropeTop", "_rope", "_holder"]; - deleteVehicle _this # 0; + deleteVehicle (_this select 0); }]; [{call FUNC(checkLandedPFH)}, 1, _this] call CBA_fnc_addPerFrameHandler; }] call CBA_fnc_addEventHandler; From df76699c14d238a5f55aa6f4d378ac289975b318 Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Tue, 11 Jan 2022 20:55:57 -0500 Subject: [PATCH 20/25] Update addons/main/XEH_postInit.sqf Co-authored-by: mjc4wilton --- addons/main/XEH_postInit.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/main/XEH_postInit.sqf b/addons/main/XEH_postInit.sqf index 77b3c6a..25ac834 100644 --- a/addons/main/XEH_postInit.sqf +++ b/addons/main/XEH_postInit.sqf @@ -19,8 +19,8 @@ if (isServer) then { [QGVAR(hideObjectGlobal), { - params ["_object", "_hide"]; - _object hideObjectGlobal _hide; + params ["_object", "_isHidden"]; + _object hideObjectGlobal _isHidden; }] call CBA_fnc_addEventHandler; [QGVAR(handleDisconnect), { From 8d4469bf692b900a6e22f4b8fadc39fe84ac5b0d Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Tue, 11 Jan 2022 20:56:03 -0500 Subject: [PATCH 21/25] Update addons/main/functions/fnc_floatPack.sqf Co-authored-by: mjc4wilton --- addons/main/functions/fnc_floatPack.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/main/functions/fnc_floatPack.sqf b/addons/main/functions/fnc_floatPack.sqf index 9e14a25..cc5ac4f 100644 --- a/addons/main/functions/fnc_floatPack.sqf +++ b/addons/main/functions/fnc_floatPack.sqf @@ -20,7 +20,7 @@ params ["_holder"]; // Float model is too big =/ Can't get it to be stable with a smaller model _pos = getPosASL _holder; _pos set [2, 0]; -private _depth = ASLToATL _pos # 2; +private _depth = ASLToATL (_pos select 2); if (_depth < 5) exitWith {}; // Make pack float From 2f3fc7879ca49da90a6df10865407d7925ff7435 Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Tue, 11 Jan 2022 21:10:51 -0500 Subject: [PATCH 22/25] Update addons/main/functions/fnc_actionLower.sqf Co-authored-by: mjc4wilton --- addons/main/functions/fnc_actionLower.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/main/functions/fnc_actionLower.sqf b/addons/main/functions/fnc_actionLower.sqf index e5a53f1..d2b5e6d 100644 --- a/addons/main/functions/fnc_actionLower.sqf +++ b/addons/main/functions/fnc_actionLower.sqf @@ -32,7 +32,7 @@ private _holder = [_unit] call FUNC(chestpackToHolder); // Chestpack to holder _holder disableCollisionWith _vehicle; _holder attachTo [_vehicle, [0, 1, -1]]; detach _holder; -_holder setVelocity velocity _chute; +_holder setVelocity velocity _vehicle; private _rope = ropeCreate [ _ropeTop, [0,0,0], From e970180f9b6bc920a98e4e9eba4df2e82551171d Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Tue, 11 Jan 2022 21:11:01 -0500 Subject: [PATCH 23/25] Update addons/main/functions/fnc_actionLower.sqf Co-authored-by: mjc4wilton --- addons/main/functions/fnc_actionLower.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/main/functions/fnc_actionLower.sqf b/addons/main/functions/fnc_actionLower.sqf index d2b5e6d..65d1d36 100644 --- a/addons/main/functions/fnc_actionLower.sqf +++ b/addons/main/functions/fnc_actionLower.sqf @@ -42,7 +42,7 @@ private _rope = ropeCreate [ [{ params ["_chute", "_ropeTop"]; - _ropeTop attachTo [_chute, [0, 0, 0]]; -}, [_chute, _ropeTop]] call CBA_fnc_execNextFrame; + _ropeTop attachTo [_vehicle, [0, 0, 0]]; +}, [_vehicle, _ropeTop]] call CBA_fnc_execNextFrame; [QGVAR(checkLandedPFH), [_ropeTop, _holder]] call CBA_fnc_serverEvent; From d91291740fd0eee1d0f20d6191ad9dbe365fec16 Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Tue, 11 Jan 2022 21:11:08 -0500 Subject: [PATCH 24/25] Update addons/main/functions/fnc_actionLower.sqf Co-authored-by: mjc4wilton --- addons/main/functions/fnc_actionLower.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/main/functions/fnc_actionLower.sqf b/addons/main/functions/fnc_actionLower.sqf index 65d1d36..ce3675a 100644 --- a/addons/main/functions/fnc_actionLower.sqf +++ b/addons/main/functions/fnc_actionLower.sqf @@ -41,7 +41,7 @@ private _rope = ropeCreate [ ]; [{ - params ["_chute", "_ropeTop"]; + params ["_vehicle", "_ropeTop"]; _ropeTop attachTo [_vehicle, [0, 0, 0]]; }, [_vehicle, _ropeTop]] call CBA_fnc_execNextFrame; From 9265092d3c6d356585d6f0a7bbf704ca9bdd5afd Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Tue, 11 Jan 2022 21:11:35 -0500 Subject: [PATCH 25/25] Update addons/main/functions/fnc_canDiscardParachute.sqf Co-authored-by: mjc4wilton --- addons/main/functions/fnc_canDiscardParachute.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/main/functions/fnc_canDiscardParachute.sqf b/addons/main/functions/fnc_canDiscardParachute.sqf index 915783f..31854a0 100644 --- a/addons/main/functions/fnc_canDiscardParachute.sqf +++ b/addons/main/functions/fnc_canDiscardParachute.sqf @@ -19,5 +19,5 @@ params ["_unit"]; if (GVAR(disabled)) exitWith {false}; -[_unit] call ace_common_fnc_isSwimming && // Can't move pack while in a parachute -{backpackContainer _unit isKindOf "B_Parachute"} +// Can't move pack while in a parachute +[_unit] call ace_common_fnc_isSwimming && {backpackContainer _unit isKindOf "B_Parachute"}