CSW/Reload - Don't allow interactions with hostile CSWs (#10152)

Don't allow interactions with hostile CSWs

Co-authored-by: PabstMirror <pabstmirror@gmail.com>
This commit is contained in:
johnb432 2024-08-23 12:22:19 +02:00 committed by GitHub
parent 7cdafe1d10
commit 87333a1218
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 11 additions and 7 deletions

View File

@ -32,7 +32,8 @@ private _condition = {
params ["_target", "_player", "_args"]; params ["_target", "_player", "_args"];
_args params ["_carryMag", "_turretPath", "", "_magSource"]; _args params ["_carryMag", "_turretPath", "", "_magSource"];
([_target, _turretPath, _carryMag, _magSource] call FUNC(reload_canLoadMagazine)) select 0 [_player, _target] call EFUNC(interaction,canInteractWithVehicleCrew) &&
{([_target, _turretPath, _carryMag, _magSource] call FUNC(reload_canLoadMagazine)) select 0}
}; };
private _cfgMagazines = configFile >> "CfgMagazines"; // Micro-optimization private _cfgMagazines = configFile >> "CfgMagazines"; // Micro-optimization

View File

@ -46,7 +46,9 @@ private _statement = {
private _condition = { private _condition = {
params ["_target", "_player", "_args"]; params ["_target", "_player", "_args"];
_args params ["_vehMag", "_turretPath", "_carryMag"]; _args params ["_vehMag", "_turretPath", "_carryMag"];
[_target, _turretPath, _player, _carryMag, _vehMag] call FUNC(reload_canUnloadMagazine)
[_player, _target] call EFUNC(interaction,canInteractWithVehicleCrew) &&
{[_target, _turretPath, _player, _carryMag, _vehMag] call FUNC(reload_canUnloadMagazine)}
}; };
private _actions = []; private _actions = [];

View File

@ -11,7 +11,7 @@
* Unit can interact with vehicle crew <BOOL> * Unit can interact with vehicle crew <BOOL>
* *
* Example: * Example:
* [cursorObject, player] call ace_interaction_fnc_canInteractWithVehicleCrew * [player, cursorObject] call ace_interaction_fnc_canInteractWithVehicleCrew
* *
* Public: No * Public: No
*/ */

View File

@ -4,23 +4,24 @@
* Check if a unit can check the ammo of the target. * Check if a unit can check the ammo of the target.
* *
* Arguments: * Arguments:
* 0: Unit equipped with the weapon <OBJECT> * 0: Unit equipped with the weapon/CSW to check <OBJECT>
* 1: Unit checking ammo <OBJECT>
* *
* Return Value: * Return Value:
* Can check ammo <BOOL> * Can check ammo <BOOL>
* *
* Example: * Example:
* [cursorObject] call ace_reload_fnc_canCheckAmmo * [cursorObject, player] call ace_reload_fnc_canCheckAmmo
* *
* Public: No * Public: No
*/ */
params ["_target"]; params ["_target", "_player"];
// Static weapons // Static weapons
if (_target isKindOf "StaticWeapon") exitWith { if (_target isKindOf "StaticWeapon") exitWith {
// No check ammo action on destroyed static weapons // No check ammo action on destroyed static weapons
if (!alive _target) exitWith {false}; if (!alive _target || {!([_player, _target] call EFUNC(interaction,canInteractWithVehicleCrew))}) exitWith {false};
if (currentMagazine _target != "") exitWith {true}; if (currentMagazine _target != "") exitWith {true};