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

Dragging - Add settings for max weight #8469

Closed
Closed
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
13 changes: 7 additions & 6 deletions addons/dragging/functions/fnc_startCarry.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@
params ["_unit", "_target"];
TRACE_2("params",_unit,_target);

// exempt from weight check if object has override variable set
if (!GETVAR(_target,GVAR(ignoreWeightCarry),false) && {
if (
GETMVAR(ACE_maxWeightCarry,1E11) != -1 // skip weight check if setting is set to infinite
&& {!GETVAR(_target,GVAR(ignoreWeightCarry),false)} // or if target has override variable set
) then {
private _weight = [_target] call FUNC(getWeight);
_weight > GETMVAR(ACE_maxWeightCarry,1E11)
}) exitWith {
// exit if object weight is over global var value
[localize LSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured);
if (_weight > GETMVAR(ACE_maxWeightCarry,1E11)) exitWith {
[localize LSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured);
};
};

private _timer = CBA_missionTime + 5;
Expand Down
13 changes: 7 additions & 6 deletions addons/dragging/functions/fnc_startDrag.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@
params ["_unit", "_target"];
TRACE_2("params",_unit,_target);

// exempt from weight check if object has override variable set
if (!GETVAR(_target,GVAR(ignoreWeightDrag),false) && {
if (
GETMVAR(ACE_maxWeightDrag,1E11) != -1 // skip weight check if setting is set to infinite
&& {!GETVAR(_target,GVAR(ignoreWeightDrag),false)} // or if target has override variable set
) then {
private _weight = [_target] call FUNC(getWeight);
_weight > GETMVAR(ACE_maxWeightDrag,1E11)
}) exitWith {
// exit if object weight is over global var value
[localize LSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured);
if (_weight > GETMVAR(ACE_maxWeightDrag,1E11)) exitWith {
[localize LSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured);
};
};

// Add a primary weapon if the unit has none
Expand Down
18 changes: 18 additions & 0 deletions addons/dragging/initSettings.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,21 @@
true,
false
] call CBA_fnc_addSetting;

[
"ACE_maxWeightDrag",
"SLIDER",
[LSTRING(maxWeightDrag_DisplayName), LSTRING(maxWeightDrag_Description)],
localize LSTRING(SettingsName),
[-1, 2000, 800, -1],
1
] call CBA_fnc_addSetting;

[
"ACE_maxWeightCarry",
"SLIDER",
[LSTRING(maxWeightCarry_DisplayName), LSTRING(maxWeightCarry_Description)],
localize LSTRING(SettingsName),
[-1, 2000, 600, -1],
1
] call CBA_fnc_addSetting;
12 changes: 12 additions & 0 deletions addons/dragging/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,17 @@
<Russian>Позволяет игроку стрелять во время перетаскивания</Russian>
<Spanish>Permite al jugador disparar mientras está arrastrando.</Spanish>
</Key>
<Key ID="STR_ACE_Dragging_maxWeightDrag_DisplayName">
<English>Max dragging weight</English>
</Key>
<Key ID="STR_ACE_Dragging_maxWeightDrag_Description">
<English>Max weight for draggable objects. Value is measured in 0.1lb (0.045kg). Set to -1 for no limit.</English>
</Key>
<Key ID="STR_ACE_Dragging_maxWeightCarry_DisplayName">
<English>Max carrying weight</English>
</Key>
<Key ID="STR_ACE_Dragging_maxWeightCarry_Description">
<English>Max weight for carryable objects. Value is measured in 0.1lb (0.045kg). Set to -1 for no limit.</English>
</Key>
</Package>
</Project>