mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Improve disableWeaponAssembly status effect usage in CSW
This commit is contained in:
parent
d56a3a6a95
commit
0baf22e285
@ -58,9 +58,8 @@
|
|||||||
_cswTripod setVariable [QGVAR(secondaryWeaponMagazines), _secondaryWeaponMagazines, true];
|
_cswTripod setVariable [QGVAR(secondaryWeaponMagazines), _secondaryWeaponMagazines, true];
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!GVAR(defaultAssemblyMode)) then {
|
// Disable vanilla assembly until FUNC(initVehicle) runs and sets the definite value
|
||||||
[_cswTripod, "disableWeaponAssembly", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
|
[_cswTripod, "disableWeaponAssembly", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
|
||||||
};
|
|
||||||
|
|
||||||
private _posATL = _player getRelPos [2, 0];
|
private _posATL = _player getRelPos [2, 0];
|
||||||
_posATL set [2, ((getPosATL _player) select 2) + 0.5];
|
_posATL set [2, ((getPosATL _player) select 2) + 0.5];
|
||||||
|
@ -76,9 +76,9 @@
|
|||||||
_csw setVariable [QGVAR(secondaryWeaponMagazines), _secondaryWeaponMagazines, true];
|
_csw setVariable [QGVAR(secondaryWeaponMagazines), _secondaryWeaponMagazines, true];
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!GVAR(defaultAssemblyMode)) then {
|
// Disable vanilla assembly until FUNC(initVehicle) runs and sets the definite value
|
||||||
[_csw, "disableWeaponAssembly", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
|
[_csw, "disableWeaponAssembly", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
|
||||||
};
|
|
||||||
_csw setDir _tripodDir;
|
_csw setDir _tripodDir;
|
||||||
_csw setPosATL _tripodPos;
|
_csw setPosATL _tripodPos;
|
||||||
if ((_tripodPos select 2) < 0.5) then {
|
if ((_tripodPos select 2) < 0.5) then {
|
||||||
|
@ -34,30 +34,33 @@ if (_configEnabled && {GVAR(ammoHandling) == 2}) then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
TRACE_2("",local _vehicle,_vehicle turretLocal [0]);
|
TRACE_2("",local _vehicle,_vehicle turretLocal [0]);
|
||||||
if (_configEnabled && {_vehicle turretLocal [0]}) then { // if turret is local to us, then handle mags/weapon
|
|
||||||
[{
|
|
||||||
params ["_vehicle"];
|
|
||||||
if (!alive _vehicle) exitWith { TRACE_1("dead/deleted",_vehicle); };
|
|
||||||
// Assembly mode: [0=disabled, 1=enabled, 2=enabled&unload, 3=default]
|
|
||||||
private _assemblyModeIndex = _vehicle getVariable [QGVAR(assemblyMode), 3];
|
|
||||||
private _emptyWeapon = _assemblyModeIndex isEqualTo 2;
|
|
||||||
private _assemblyMode = [false, true, true, GVAR(defaultAssemblyMode)] select _assemblyModeIndex;
|
|
||||||
TRACE_2("turretLocal",_vehicle,_assemblyMode);
|
|
||||||
[_vehicle, [0], _assemblyMode, _emptyWeapon] call FUNC(proxyWeapon);
|
|
||||||
[_vehicle, _assemblyMode, _emptyWeapon] call FUNC(staticWeaponInit_unloadExtraMags);
|
|
||||||
}, [_vehicle]] call CBA_fnc_execNextFrame; // need to wait a frame to allow setting object vars during assembly
|
|
||||||
};
|
|
||||||
|
|
||||||
if (_assemblyConfig) then {
|
if (_vehicle turretLocal [0]) then {
|
||||||
[{
|
// Assembly mode: [0=disabled, 1=enabled, 2=enabled&unload, 3=default]
|
||||||
params ["_vehicle"];
|
private _assemblyModeIndex = _vehicle getVariable [QGVAR(assemblyMode), 3];
|
||||||
if (!alive _vehicle) exitWith { TRACE_1("dead/deleted",_vehicle); };
|
private _assemblyMode = [false, true, true, GVAR(defaultAssemblyMode)] select _assemblyModeIndex;
|
||||||
private _assemblyMode = [false, true, true, GVAR(defaultAssemblyMode)] select (_vehicle getVariable [QGVAR(assemblyMode), 3]);
|
|
||||||
|
TRACE_2("turretLocal",_vehicle,_assemblyMode);
|
||||||
|
|
||||||
|
// If turret is local, handle unloading mags and proxy weapons
|
||||||
|
if (_configEnabled) then {
|
||||||
|
TRACE_2("config enabled",_vehicle,_assemblyMode);
|
||||||
|
|
||||||
|
private _emptyWeapon = _assemblyModeIndex isEqualTo 2;
|
||||||
|
|
||||||
|
[_vehicle, [0], _assemblyMode, _emptyWeapon] call FUNC(proxyWeapon);
|
||||||
|
|
||||||
|
if (!_assemblyMode) exitWith {};
|
||||||
|
|
||||||
|
[_vehicle, _emptyWeapon] call FUNC(staticWeaponInit_unloadExtraMags);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_assemblyConfig) then {
|
||||||
TRACE_2("assemblyConfig present",_vehicle,_assemblyMode);
|
TRACE_2("assemblyConfig present",_vehicle,_assemblyMode);
|
||||||
if (_assemblyMode) then { // Disable vanilla assembly if assemblyMode enabled
|
// Disable vanilla assembly if assemblyMode enabled
|
||||||
[_vehicle, "disableWeaponAssembly", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
|
// Need to wait to allow setting object vars during assembly, but since this function runs 1 second after vehicle init, it can run immediately
|
||||||
};
|
[_vehicle, "disableWeaponAssembly", QUOTE(ADDON), _assemblyMode] call EFUNC(common,statusEffect_set);
|
||||||
}, [_vehicle]] call CBA_fnc_execNextFrame; // need to wait a frame to allow setting object vars during assembly
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// Add interactions for players
|
// Add interactions for players
|
||||||
|
@ -5,8 +5,7 @@
|
|||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: CSW <OBJECT>
|
* 0: CSW <OBJECT>
|
||||||
* 1: Using advanced assembly <BOOL>
|
* 1: Empty weapon <BOOL>
|
||||||
* 2: Empty weapon <BOOL>
|
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -17,9 +16,8 @@
|
|||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params ["_vehicle", "_assemblyMode", "_emptyWeapon"];
|
params ["_vehicle", "_emptyWeapon"];
|
||||||
TRACE_3("staticWeaponInit_unloadExtraMags",_vehicle,_assemblyMode,_emptyWeapon);
|
TRACE_2("staticWeaponInit_unloadExtraMags",_vehicle,_emptyWeapon);
|
||||||
if (!_assemblyMode) exitWith {};
|
|
||||||
|
|
||||||
private _desiredAmmo = getNumber (configOf _vehicle >> QUOTE(ADDON) >> "desiredAmmo");
|
private _desiredAmmo = getNumber (configOf _vehicle >> QUOTE(ADDON) >> "desiredAmmo");
|
||||||
private _storeExtraMagazines = GVAR(handleExtraMagazines);
|
private _storeExtraMagazines = GVAR(handleExtraMagazines);
|
||||||
|
Loading…
Reference in New Issue
Block a user