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

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

Merged
merged 2 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion addons/csw/functions/fnc_getLoadActions.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ private _condition = {
params ["_target", "_player", "_args"];
_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
Expand Down
4 changes: 3 additions & 1 deletion addons/csw/functions/fnc_getUnloadActions.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ private _statement = {
private _condition = {
params ["_target", "_player", "_args"];
_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 = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Unit can interact with vehicle crew <BOOL>
*
* Example:
* [cursorObject, player] call ace_interaction_fnc_canInteractWithVehicleCrew
* [player, cursorObject] call ace_interaction_fnc_canInteractWithVehicleCrew
*
* Public: No
*/
Expand Down
9 changes: 5 additions & 4 deletions addons/reload/functions/fnc_canCheckAmmo.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,24 @@
* Check if a unit can check the ammo of the target.
*
* 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:
* Can check ammo <BOOL>
*
* Example:
* [cursorObject] call ace_reload_fnc_canCheckAmmo
* [cursorObject, player] call ace_reload_fnc_canCheckAmmo
*
* Public: No
*/

params ["_target"];
params ["_target", "_player"];

// Static weapons
if (_target isKindOf "StaticWeapon") exitWith {
// 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};

Expand Down
Loading