-
Notifications
You must be signed in to change notification settings - Fork 8
Add Ability to Land in Water Safely #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
73bb125
512705b
a3e881b
c8608a6
1b2125d
3cedf09
9ffddb6
93c7c45
b85c658
10a4772
3e3b779
d2f6dd2
01cd770
1d3ab92
2709bf7
d617be8
44913cb
222c86a
c5c8e4f
df76699
8d4469b
2f3fc78
e970180
d912917
9265092
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 <OBJECT> | ||
| * | ||
| * 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); | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #include "script_component.hpp" | ||
| /* | ||
| * Author: Ampersand | ||
| * Checks if given unit can discard its reserve parachute | ||
| * | ||
| * Arguments: | ||
| * 0: Unit <OBJECT> | ||
| * | ||
| * Return Value: | ||
| * Success <BOOL> | ||
| * | ||
| * Example: | ||
| * [_unit] call bocr_main_fnc_canDiscardParachute; | ||
| * | ||
| * Public: No | ||
| */ | ||
|
|
||
| params ["_unit"]; | ||
|
|
||
| if (GVAR(disabled)) exitWith {false}; | ||
|
|
||
| // Can't move pack while in a parachute | ||
| [_unit] call ace_common_fnc_isSwimming && {backpackContainer _unit isKindOf "B_Parachute"} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| #include "script_component.hpp" | ||
| /* | ||
| * Author: Ampersand | ||
| * Called on server when chestpack is lowered. | ||
| * | ||
| * Arguments: | ||
| * 0: Unit <OBJECT> | ||
| * | ||
| * 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 { | ||
| [_holder] call bocr_main_fnc_floatPack; | ||
| } else { | ||
| _holder setVectorUp [0,0,1]; | ||
| _holder setPosASL (_pos vectorAdd [0,0,0.1]); | ||
| }; | ||
| [_pfhID] call CBA_fnc_removePerFrameHandler; | ||
| }; |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,54 @@ | ||||||||||||||
| #include "script_component.hpp" | ||||||||||||||
| /* | ||||||||||||||
| * Author: Ampersand | ||||||||||||||
| * Attaches a backpack's weaponholder to a floating helper | ||||||||||||||
| * | ||||||||||||||
| * Arguments: | ||||||||||||||
| * 0: Weapon Holder <OBJECT> | ||||||||||||||
| * | ||||||||||||||
| * Return Value: | ||||||||||||||
| * Float <OBJECT> | ||||||||||||||
| * | ||||||||||||||
| * Example: | ||||||||||||||
| * [_holder] call bocr_main_fnc_floatPack; | ||||||||||||||
| * | ||||||||||||||
| * Public: No | ||||||||||||||
| */ | ||||||||||||||
|
|
||||||||||||||
| 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 select 2); | ||||||||||||||
| if (_depth < 5) exitWith {}; | ||||||||||||||
|
|
||||||||||||||
| // Make pack float | ||||||||||||||
| if (isServer) then { | ||||||||||||||
| private _float = QGVAR(float) createVehicle [0, 0, 0]; | ||||||||||||||
| _float setPosASL (getPosASL _holder vectorAdd [0, 0, -2]); | ||||||||||||||
|
mjc4wilton marked this conversation as resolved.
|
||||||||||||||
| _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'"]; | ||||||||||||||
| }; | ||||||||||||||
|
Comment on lines
+49
to
+54
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
This addaction is broken it seems since it add an action to discard whatever backpack you have if you are swimming. Additionally, I'd much rather muddle around and shove actions into ace than an infinite scroll menu since that just gets annoying.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This action should actually get added to the weaponHolder that is holding the used parachute that has just been discarded, and would make it sink and get deleted once it's no longer relevant to the player. I felt it was on the same sort of level as the Release vanilla action you get when escorting a prisoner. Should this be done in an ace action?
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leave it as an ACE action as to not clutter up the scroll menu since I personally hate it (the menu not your feature). As for the feature itself, decouple it from the action so a function can call it to sink a pack which would probably be more useful for those making automated cleanup scripts and the like. |
||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.