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 - Allow run when carrying light-weight objects #8338

Merged
merged 4 commits into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion addons/common/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
//Status Effect EHs:
[QGVAR(setStatusEffect), {_this call FUNC(statusEffect_set)}] call CBA_fnc_addEventHandler;
["forceWalk", false, ["ace_advanced_fatigue", "ACE_SwitchUnits", "ACE_Attach", "ACE_dragging", "ACE_Explosives", "ACE_Ladder", "ACE_Sandbag", "ACE_refuel", "ACE_rearm", "ACE_Trenches", "ace_medical_fracture"]] call FUNC(statusEffect_addType);
["blockSprint", false, ["ace_advanced_fatigue", "ace_medical_fracture"]] call FUNC(statusEffect_addType);
["blockSprint", false, ["ace_advanced_fatigue", "ACE_dragging", "ace_medical_fracture"]] call FUNC(statusEffect_addType);
jonpas marked this conversation as resolved.
Show resolved Hide resolved
["setCaptive", true, [QEGVAR(captives,Handcuffed), QEGVAR(captives,Surrendered)]] call FUNC(statusEffect_addType);
["blockDamage", false, ["fixCollision", "ACE_cargo"]] call FUNC(statusEffect_addType);
["blockEngine", false, ["ACE_Refuel"]] call FUNC(statusEffect_addType);
Expand Down
3 changes: 3 additions & 0 deletions addons/dragging/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ if (isNil "ACE_maxWeightDrag") then {
if (isNil "ACE_maxWeightCarry") then {
ACE_maxWeightCarry = 600;
};
if (isNil QGVAR(maxWeightCarryRun)) then {
GVAR(maxWeightCarryRun) = 50;
jonpas marked this conversation as resolved.
Show resolved Hide resolved
};

["isNotDragging", {!((_this select 0) getVariable [QGVAR(isDragging), false])}] call EFUNC(common,addCanInteractWithCondition);
["isNotCarrying", {!((_this select 0) getVariable [QGVAR(isCarrying), false])}] call EFUNC(common,addCanInteractWithCondition);
Expand Down
1 change: 1 addition & 0 deletions addons/dragging/functions/fnc_dropObject_carry.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ _unit removeWeapon "ACE_FakePrimaryWeapon";
_unit selectWeapon primaryWeapon _unit;

[_unit, "forceWalk", "ACE_dragging", false] call EFUNC(common,statusEffect_set);
[_unit, "blockSprint", "ACE_dragging", false] call EFUNC(common,statusEffect_set);
[_unit, "blockThrow", "ACE_dragging", false] call EFUNC(common,statusEffect_set);

// prevent object from flipping inside buildings
Expand Down
13 changes: 11 additions & 2 deletions addons/dragging/functions/fnc_startCarry.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
params ["_unit", "_target"];
TRACE_2("params",_unit,_target);

private _weight = [_target] call FUNC(getWeight);

// exempt from weight check if object has override variable set
if (!GETVAR(_target,GVAR(ignoreWeightCarry),false) && {
private _weight = [_target] call FUNC(getWeight);
_weight > GETMVAR(ACE_maxWeightCarry,1E11)
}) exitWith {
// exit if object weight is over global var value
Expand Down Expand Up @@ -56,7 +57,15 @@ if (_target isKindOf "CAManBase") then {
_unit action ["SwitchWeapon", _unit, _unit, 299];
[_unit, "AmovPercMstpSnonWnonDnon", 0] call EFUNC(common,doAnimation);

[_unit, "forceWalk", "ACE_dragging", true] call EFUNC(common,statusEffect_set);
// objects other than containers have calculated weight == 0 so we use getMass
if (-1 == ["ReammoBox_F", "WeaponHolder", "WeaponHolderSimulated"] findIf {_target isKindOf _x}) then {
_weight = getMass _target;
};
LinkIsGrim marked this conversation as resolved.
Show resolved Hide resolved
if (_weight > GVAR(maxWeightCarryRun)) then {
[_unit, "forceWalk", "ACE_dragging", true] call EFUNC(common,statusEffect_set);
} else {
[_unit, "blockSprint", "ACE_dragging", true] call EFUNC(common,statusEffect_set);
};

};

Expand Down