mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
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
This commit is contained in:
parent
74be4f1503
commit
cf8c847811
@ -81,7 +81,8 @@ GVAR(vehicleAction) = [
|
|||||||
{locked _target < 2} &&
|
{locked _target < 2} &&
|
||||||
{([_player, _target] call EFUNC(interaction,getInteractionDistance)) < MAX_LOAD_DISTANCE} &&
|
{([_player, _target] call EFUNC(interaction,getInteractionDistance)) < MAX_LOAD_DISTANCE} &&
|
||||||
{alive _target} &&
|
{alive _target} &&
|
||||||
{[_player, _target, ["isNotSwimming"]] call EFUNC(common,canInteractWith)}
|
{[_player, _target, ["isNotSwimming"]] call EFUNC(common,canInteractWith)} &&
|
||||||
|
{[_player, _target] call EFUNC(interaction,canInteractWithVehicleCrew)}
|
||||||
}
|
}
|
||||||
] call EFUNC(interact_menu,createAction);
|
] call EFUNC(interact_menu,createAction);
|
||||||
|
|
||||||
@ -99,6 +100,7 @@ GVAR(objectActions) = [
|
|||||||
{(_target getVariable [QGVAR(canLoad), getNumber (configOf _target >> QGVAR(canLoad))]) in [true, 1]} &&
|
{(_target getVariable [QGVAR(canLoad), getNumber (configOf _target >> QGVAR(canLoad))]) in [true, 1]} &&
|
||||||
{alive _target} &&
|
{alive _target} &&
|
||||||
{[_player, _target, ["isNotSwimming"]] call EFUNC(common,canInteractWith)} &&
|
{[_player, _target, ["isNotSwimming"]] call EFUNC(common,canInteractWith)} &&
|
||||||
|
{[_player, _target] call EFUNC(interaction,canInteractWithVehicleCrew)} &&
|
||||||
{(_target getVariable [QGVAR(noRename), getNumber (configOf _target >> QGVAR(noRename))]) in [false, 0]}
|
{(_target getVariable [QGVAR(noRename), getNumber (configOf _target >> QGVAR(noRename))]) in [false, 0]}
|
||||||
}
|
}
|
||||||
] call EFUNC(interact_menu,createAction),
|
] call EFUNC(interact_menu,createAction),
|
||||||
@ -114,6 +116,7 @@ GVAR(objectActions) = [
|
|||||||
{locked _target < 2} &&
|
{locked _target < 2} &&
|
||||||
{alive _target} &&
|
{alive _target} &&
|
||||||
{[_player, _target, ["isNotSwimming"]] call EFUNC(common,canInteractWith)} &&
|
{[_player, _target, ["isNotSwimming"]] call EFUNC(common,canInteractWith)} &&
|
||||||
|
{[_player, _target] call EFUNC(interaction,canInteractWithVehicleCrew)} &&
|
||||||
{((nearestObjects [_target, GVAR(cargoHolderTypes), (MAX_LOAD_DISTANCE + 10)]) findIf {
|
{((nearestObjects [_target, GVAR(cargoHolderTypes), (MAX_LOAD_DISTANCE + 10)]) findIf {
|
||||||
private _hasCargoConfig = 1 == getNumber (configOf _x >> QGVAR(hasCargo));
|
private _hasCargoConfig = 1 == getNumber (configOf _x >> QGVAR(hasCargo));
|
||||||
private _hasCargoPublic = _x getVariable [QGVAR(hasCargo), false];
|
private _hasCargoPublic = _x getVariable [QGVAR(hasCargo), false];
|
||||||
|
@ -14,6 +14,7 @@ PREP(hideMouseHint);
|
|||||||
|
|
||||||
// interaction with units
|
// interaction with units
|
||||||
PREP(canInteractWithCivilian);
|
PREP(canInteractWithCivilian);
|
||||||
|
PREP(canInteractWithVehicleCrew);
|
||||||
PREP(getDown);
|
PREP(getDown);
|
||||||
PREP(sendAway);
|
PREP(sendAway);
|
||||||
PREP(canJoinGroup);
|
PREP(canJoinGroup);
|
||||||
|
@ -6,31 +6,36 @@
|
|||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Vehicle <OBJECT>
|
* 0: Vehicle <OBJECT>
|
||||||
* 1: Player <OBJECT>
|
* 1: Player <OBJECT>
|
||||||
* 3: Parameters <ARRAY>
|
* 2: Parameters <ARRAY>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Children actions <ARRAY>
|
* Children actions <ARRAY>
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [target, player, [params]] call ace_interaction_fnc_addPassengersActions
|
* [cursorObject, player, [params]] call ace_interaction_fnc_addPassengersActions
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params ["_vehicle", "_player"];
|
params ["_vehicle", "_player"];
|
||||||
|
|
||||||
|
// If player is not in vehicle and the crew is hostile, do not show any actions
|
||||||
|
if !(_player in _vehicle || {[_player, _vehicle] call FUNC(canInteractWithVehicleCrew)}) exitWith {
|
||||||
|
[] // return
|
||||||
|
};
|
||||||
|
|
||||||
private _actions = [];
|
private _actions = [];
|
||||||
|
private _icon = "";
|
||||||
|
|
||||||
{
|
{
|
||||||
private _unit = _x;
|
_x params ["_unit", "_role"];
|
||||||
|
|
||||||
if (_unit != _player && {getText (configOf _unit >> "simulation") != "UAVPilot"}) then {
|
_icon = [
|
||||||
private _icon = [
|
|
||||||
"",
|
|
||||||
"A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_driver_ca.paa",
|
"A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_driver_ca.paa",
|
||||||
"A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_gunner_ca.paa",
|
"A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_gunner_ca.paa",
|
||||||
"A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_commander_ca.paa"
|
"A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_commander_ca.paa",
|
||||||
] select (([driver _vehicle, gunner _vehicle, commander _vehicle] find _unit) + 1);
|
""
|
||||||
|
] select (["driver", "gunner", "commander"] find _role);
|
||||||
|
|
||||||
if (_unit getVariable [QEGVAR(captives,isHandcuffed), false]) then {
|
if (_unit getVariable [QEGVAR(captives,isHandcuffed), false]) then {
|
||||||
_icon = QPATHTOEF(captives,UI\handcuff_ca.paa);
|
_icon = QPATHTOEF(captives,UI\handcuff_ca.paa);
|
||||||
@ -42,29 +47,27 @@ private _actions = [];
|
|||||||
[_unit, true] call EFUNC(common,getName),
|
[_unit, true] call EFUNC(common,getName),
|
||||||
[_icon, "#FFFFFF"],
|
[_icon, "#FFFFFF"],
|
||||||
{
|
{
|
||||||
//statement (Run on hover) - reset the cache so we will insert actions immedietly when hovering over new unit
|
// statement (Run on hover) - reset the cache so we will insert actions immediately when hovering over new unit
|
||||||
TRACE_2("Cleaning Cache",_target,vehicle _target);
|
TRACE_2("Cleaning Cache",_target,objectParent _target);
|
||||||
[vehicle _target, QEGVAR(interact_menu,ATCache_ACE_SelfActions)] call EFUNC(common,eraseCache);
|
[objectParent _target, QEGVAR(interact_menu,ATCache_ACE_SelfActions)] call EFUNC(common,eraseCache);
|
||||||
},
|
},
|
||||||
{true},
|
{true},
|
||||||
{
|
{
|
||||||
if (EGVAR(interact_menu,selectedTarget) isEqualTo _target) then {
|
if (EGVAR(interact_menu,selectedTarget) isEqualTo _target) then {
|
||||||
_this call FUNC(addPassengerActions)
|
_this call FUNC(addPassengerActions)
|
||||||
} else {
|
} else {
|
||||||
[] //not selected, don't waste time on actions
|
[] // not selected, don't waste time on actions
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
[_unit],
|
[_unit],
|
||||||
{[0, 0, 0]},
|
{[0, 0, 0]},
|
||||||
2,
|
2,
|
||||||
[false,false,false,true,false], //add run on hover (4th bit true)
|
[false, false, false, true, false], // add run on hover (4th bit true)
|
||||||
{if (["ace_medical_gui"] call EFUNC(common,isModLoaded)) then {call EFUNC(medical_gui,modifyActionTriageLevel)}}
|
{if (["ace_medical_gui"] call EFUNC(common,isModLoaded)) then {call EFUNC(medical_gui,modifyActionTriageLevel)}}
|
||||||
] call EFUNC(interact_menu,createAction),
|
] call EFUNC(interact_menu,createAction),
|
||||||
[],
|
[],
|
||||||
_unit
|
_unit
|
||||||
];
|
];
|
||||||
};
|
} forEach ((fullCrew _vehicle) select {_x select 0 != _player && {!unitIsUAV (_x select 0)}});
|
||||||
false
|
|
||||||
} count crew _vehicle;
|
|
||||||
|
|
||||||
_actions
|
_actions
|
||||||
|
@ -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
|
@ -5,7 +5,7 @@ class CfgPatches {
|
|||||||
units[] = {};
|
units[] = {};
|
||||||
weapons[] = {};
|
weapons[] = {};
|
||||||
requiredVersion = REQUIRED_VERSION;
|
requiredVersion = REQUIRED_VERSION;
|
||||||
requiredAddons[] = {"ace_common"};
|
requiredAddons[] = {"ace_interaction"};
|
||||||
author = ECSTRING(common,ACETeam);
|
author = ECSTRING(common,ACETeam);
|
||||||
authors[] = {"Kingsley"};
|
authors[] = {"Kingsley"};
|
||||||
url = ECSTRING(main,URL);
|
url = ECSTRING(main,URL);
|
||||||
|
@ -32,8 +32,7 @@ GVAR(enabled)
|
|||||||
&& {isNull getConnectedUAVUnit _unit}
|
&& {isNull getConnectedUAVUnit _unit}
|
||||||
&& {simulationEnabled _vehicle}
|
&& {simulationEnabled _vehicle}
|
||||||
&& {
|
&& {
|
||||||
-1 == crew _vehicle findIf {alive _x}
|
[_unit, _vehicle] call EFUNC(interaction,canInteractWithVehicleCrew)
|
||||||
|| {0.6 <= side group _unit getFriend side group _vehicle}
|
|
||||||
}
|
}
|
||||||
&& {
|
&& {
|
||||||
0.3 < vectorUp _vehicle select 2 // moveIn* and GetIn* don't work for flipped vehicles
|
0.3 < vectorUp _vehicle select 2 // moveIn* and GetIn* don't work for flipped vehicles
|
||||||
|
Loading…
Reference in New Issue
Block a user