General - Remove "SwitchWeapon" spam (#10113)

* Remove "switchWeapon" spam

* Update fnc_startDragLocal.sqf

* Don't add invalid fire modes

* Tweaks & fix
This commit is contained in:
johnb432
2024-07-20 08:13:42 +02:00
committed by GitHub
parent 68738316c2
commit 5cada7d397
14 changed files with 145 additions and 166 deletions

View File

@ -59,11 +59,12 @@ if (_target isKindOf "CAManBase" || {animationState _unit in CARRY_ANIMATIONS})
_unit removeWeapon "ACE_FakePrimaryWeapon";
// Reselect weapon and re-enable sprint
private _previousWeaponIndex = _unit getVariable [QGVAR(previousWeapon), -1];
_unit setVariable [QGVAR(previousWeapon), nil, true];
private _previousWeaponState = _unit getVariable QGVAR(previousWeapon);
if (_previousWeaponIndex != -1) then {
_unit action ["SwitchWeapon", _unit, _unit, _previousWeaponIndex];
if (!isNil "_previousWeaponState") then {
_unit selectWeapon _previousWeaponState;
_unit setVariable [QGVAR(previousWeapon), nil, true];
};
[_unit, "forceWalk", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set);

View File

@ -50,7 +50,7 @@ if (_target isKindOf "CAManBase") then {
};
// Select primary, otherwise the carry animation actions don't work
_unit selectWeapon _primaryWeapon;
_unit selectWeapon _primaryWeapon; // This turns off lasers/lights
// Move a bit closer and adjust direction when trying to pick up a person
[QEGVAR(common,setDir), [_target, getDir _unit + 180], _target] call CBA_fnc_targetEvent;
@ -62,10 +62,11 @@ if (_target isKindOf "CAManBase") then {
_timer = CBA_missionTime + 10;
} else {
// Select no weapon and stop sprinting
private _previousWeaponIndex = [_unit] call EFUNC(common,getFiremodeIndex);
_unit setVariable [QGVAR(previousWeapon), _previousWeaponIndex, true];
if (currentWeapon _unit != "") then {
_unit setVariable [QGVAR(previousWeapon), (weaponState _unit) select [0, 3], true];
_unit action ["SwitchWeapon", _unit, _unit, 299];
_unit action ["SwitchWeapon", _unit, _unit, 299];
};
[_unit, "AmovPercMstpSnonWnonDnon", 0] call EFUNC(common,doAnimation);

View File

@ -46,7 +46,10 @@ if (!GVAR(dragAndFire)) then {
_primaryWeapon = "ACE_FakePrimaryWeapon";
};
_unit selectWeapon _primaryWeapon;
// Keep the laser/light on if the weapon is already selected
if (currentWeapon _unit != _primaryWeapon) then {
_unit selectWeapon _primaryWeapon;
};
} else { // Making sure the unit is holding a primary weapon or handgun
private _handgunWeapon = handgunWeapon _unit;