Skip to content

Commit

Permalink
Add setting for hook attach script (#296)
Browse files Browse the repository at this point in the history
  • Loading branch information
ampersand38 committed Jan 23, 2022
1 parent da63fa0 commit 7bea240
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions addons/uh60_hoist/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
ADDON = false;

#include "XEH_PREP.hpp"
#include "initSettings.sqf";

ADDON = true;
1 change: 1 addition & 0 deletions addons/uh60_hoist/functions/fnc_attachHook.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ params ["_hook", "_unit"];

if (!local _unit) exitWith {[QGVAR(attachHook), _this, _unit] call CBA_fnc_targetEvent;};

if (!vtx_uh60_hoist_setting_useAttachScript) exitWith {false};
if (_unit getVariable [QGVAR(pfhID), -1] != -1) exitWith {false};
if (!isNull (_unit getVariable ["vtx_attachedHook", objNull])) exitWith {false};
if (!isNull (_unit getVariable ["vtx_attachedHelper", objNull])) exitWith {false};
Expand Down
3 changes: 2 additions & 1 deletion addons/uh60_hoist/functions/fnc_canAttachHook.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@

params ["_hook", "_unit"];

isNull (_unit getVariable ["vtx_attachedHook", objNull])
vtx_uh60_hoist_setting_useAttachScript
&& {isNull (_unit getVariable ["vtx_attachedHook", objNull])}
&& {isNull (_hook getVariable ["vtx_attachedUnit", objNull])}
&& {vehicle _unit == _unit}
&& {_hook emptyPositions "cargo" > 0}
8 changes: 8 additions & 0 deletions addons/uh60_hoist/initSettings.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
"vtx_uh60_hoist_setting_useAttachScript", // Internal setting name, should always contain a tag! This will be the global variable which takes the value of the setting.
"CHECKBOX", // setting type
["Use Attach Script", "When in the hoist hook, automatically switch between walking with hook attached and sitting in the hook seat based on height and cable stretch."], // Pretty name shown inside the ingame settings menu. Can be stringtable entry.
["UH-60M", "Hoist"], // Pretty name of the category where the setting can be found. Can be stringtable entry.
true, // data for this setting: [min, max, default, number of shown trailing decimals]
nil // "_isGlobal" flag. Set this to true to always have this setting synchronized between all clients in multiplayer
] call CBA_fnc_addSetting;

0 comments on commit 7bea240

Please sign in to comment.