-
Notifications
You must be signed in to change notification settings - Fork 740
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Interaction - Add crew status check for some vehicle interactions (#9637
) * Added check for crew status If a one or more passenger in a vehicle are conscious, not captive and hostile to the interacting unit, the interactions (passenger, cargo) will not appear. * Update fnc_canInteractWithVehicleCrew.sqf * Update fnc_canInteractWithVehicleCrew.sqf
- Loading branch information
Showing
6 changed files
with
84 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
addons/interaction/functions/fnc_canInteractWithVehicleCrew.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include "..\script_component.hpp" | ||
/* | ||
* Author: johnb43 | ||
* Checks if a unit can interact with the vehicle crew inside. | ||
* | ||
* Arguments: | ||
* 0: Player <OBJECT> | ||
* 1: Vehicle <OBJECT> | ||
* | ||
* Return Value: | ||
* Unit can interact with vehicle crew <BOOL> | ||
* | ||
* Example: | ||
* [cursorObject, player] call ace_interaction_fnc_canInteractWithVehicleCrew | ||
* | ||
* Public: No | ||
*/ | ||
|
||
params ["_player", "_vehicle"]; | ||
|
||
private _crew = crew _vehicle; | ||
|
||
// If vehicle is empty, quit | ||
if (_crew isEqualTo []) exitWith {true}; | ||
|
||
private _sidePlayer = side group _player; | ||
|
||
(_crew select {_x != _player && {!unitIsUAV _x}}) findIf { // ignore player and UAV units | ||
// Units must all be unconscious, captive or friendly (side group is used in case unit is captive/unconscious) for actions to show up | ||
!captive _x && {lifeState _x in ["HEALTHY", "INJURED"]} && {[_sidePlayer, side group _x] call BIS_fnc_sideIsEnemy} | ||
} == -1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters