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 - Additional weight override parameter for setCarryable/setDraggable #6780

Merged
merged 8 commits into from
Jan 20, 2019
Merged

Conversation

PiZZAD0X
Copy link
Contributor

@PiZZAD0X PiZZAD0X commented Jan 20, 2019

When merged this pull request will:

  • Add an additional optional parameter to the ace_dragging_fnc_setCarryable and ace_dragging_fnc_setDraggable functions that sets a object variable that can skip the weight check in ace_dragging_fnc_startCarry and ace_dragging_fnc_startCarry respectively.

  • Existing function parameter format is [object, true, [0,1,1], 0] call ace_dragging_fnc_setCarryable; which is compatible with this PR.

eg. [object, true, [0,1,1], 0, true] call ace_dragging_fnc_setCarryable;
would override the carry weight check on the object.

  • This would be useful if mission makers want the ability to carry/drag a specific heavy object without disabling/nullifying the weight checks globally, similar to how mission makers could use setMass in the past.

  • Addresses setMass 1, still can't lift #4141

Test mission with objects below and over weight limit, with and without function.
ACE_carryWeightExceptionTest.VR.zip

PiZZAD0X added 3 commits January 19, 2019 22:08
…raggable

- Additional optional parameter that ignores the `startCarry`/`startDrag` weight checks.
- Minor `==` to `isEqualto` replacements
- remove \t
Copy link
Contributor

@commy2 commy2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a fan of scopeName/breakTo/Out.

Should be written it like this imo:

if (!GETVAR(_target,GVAR(ignoreWeightCarry),false) && {
    private _weight = [_target] call FUNC(getWeight);
    _weight > (GETMVAR(ACE_maxWeightCarry,1E11))
}) exitWith {
    [localize LSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured);
};

addons/dragging/functions/fnc_canDrag.sqf Outdated Show resolved Hide resolved
addons/dragging/functions/fnc_canCarry.sqf Outdated Show resolved Hide resolved
addons/dragging/functions/fnc_setCarryable.sqf Outdated Show resolved Hide resolved
addons/dragging/functions/fnc_setDraggable.sqf Outdated Show resolved Hide resolved
@PiZZAD0X
Copy link
Contributor Author

for if (!GETVAR(_target,GVAR(ignoreWeightCarry),false) && { private _weight = [_target] call FUNC(getWeight); _weight > (GETMVAR(ACE_maxWeightCarry,1E11)) })

Should I skip the variable and do (!GETVAR(_target,GVAR(ignoreWeightCarry),false) && { ([_target] call FUNC(getWeight)) > (GETMVAR(ACE_maxWeightCarry,1E11)) }) or keep the var?

@commy2
Copy link
Contributor

commy2 commented Jan 20, 2019

Either is fine I think, but I prefer more locals (with descriptive names) instead of long lines that are hard to read.

@commy2 commy2 added the kind/feature Release Notes: **ADDED:** label Jan 20, 2019
@commy2 commy2 added this to the 3.13.0 milestone Jan 20, 2019
Co-Authored-By: PiZZAD0X <509thparachuteinfantry@gmail.com>
@PabstMirror PabstMirror changed the title Additional weight override parameter for setCarryable/setDraggable Dragging - Additional weight override parameter for setCarryable/setDraggable Jan 20, 2019
@PabstMirror PabstMirror merged commit 13193d3 into acemod:master Jan 20, 2019
@@ -27,4 +27,4 @@ if ((_unit getHitPointDamage "HitLegs") >= 0.5) exitWith {false};
// a static weapon has to be empty for dragging (ignore UAV AI)
if (((typeOf _target) isKindOf "StaticWeapon") && {{(getText (configFile >> "CfgVehicles" >> (typeOf _x) >> "simulation")) != "UAVPilot"} count crew _target > 0}) exitWith {false};

alive _target && {vehicle _target == _target} && {_target getVariable [QGVAR(canCarry), false]} && {animationState _target in ["", "unconscious"] || (_target getVariable ["ACE_isUnconscious", false]) || (_target isKindOf "CAManBase" && {(_target getHitPointDamage "HitLegs") > 0.4})}
alive _target && {vehicle _target isEqualto _target} && {_target getVariable [QGVAR(canCarry), false]} && {animationState _target in ["", "unconscious"] || (_target getVariable ["ACE_isUnconscious", false]) || (_target isKindOf "CAManBase" && {(_target getHitPointDamage "HitLegs") > 0.4})}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isEqualTo uppercase To.

@PabstMirror PabstMirror modified the milestones: 3.13.0, 3.12.6 Feb 23, 2019
BaerMitUmlaut pushed a commit that referenced this pull request Aug 5, 2019
…raggable (#6780)

* Added weight override parameter to ace_dragging_fnc_setCarryable/setDraggable

- Additional optional parameter that ignores the `startCarry`/`startDrag` weight checks.
- Minor `==` to `isEqualto` replacements

* `count crew _target isEqualto -1` to `count crew _target isEqualto 0`

* Tab Replacement

- remove \t

* Reverted UAV check, Params formatting, Lazy Eval

* Update addons/dragging/functions/fnc_startCarry.sqf

Co-Authored-By: PiZZAD0X <509thparachuteinfantry@gmail.com>

* Update fnc_startDrag.sqf

* Remove beta suggestion extra line additions

* Update addons/dragging/functions/fnc_startDrag.sqf

Co-Authored-By: PiZZAD0X <509thparachuteinfantry@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Release Notes: **ADDED:**
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants