Dragging - Allow run when carrying light-weight objects (#8338)

* Allow run when carrying light-weight objects

* Use global var instead of macro

* Update addons/common/XEH_postInit.sqf

---------

Co-authored-by: jonpas <jonpas33@gmail.com>
This commit is contained in:
Dystopian 2023-06-28 14:43:10 +03:00 committed by GitHub
parent f812daa095
commit 8b94d765aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 3 deletions

View File

@ -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);
["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);

View File

@ -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;
};
["isNotDragging", {!((_this select 0) getVariable [QGVAR(isDragging), false])}] call EFUNC(common,addCanInteractWithCondition);
["isNotCarrying", {!((_this select 0) getVariable [QGVAR(isCarrying), false])}] call EFUNC(common,addCanInteractWithCondition);

View File

@ -56,6 +56,7 @@ if (_previousWeaponIndex != -1) then {
};
[_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

View File

@ -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
@ -57,7 +58,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;
};
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);
};
};
[_unit, "blockThrow", "ACE_dragging", true] call EFUNC(common,statusEffect_set);