Skip to content
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

Add setting for hook attach script #296

Merged
merged 1 commit into from
Jan 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;