mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Medical & Captive Load Menu Overhaul (#5519)
* Add load in child actions to medical & captive * Add actions with proper structure * Move vehicles actions code to common function * Simplify code in config, Fix docs * Remove unused vars * Fix header example * Add _distance param to fnc_nearestVehiclesFreeSeat * Change docs * Fix spacing
This commit is contained in:
parent
0644ad9ca2
commit
45a66ccfa1
@ -51,6 +51,7 @@ class CfgVehicles {
|
|||||||
showDisabled = 0;
|
showDisabled = 0;
|
||||||
icon = QPATHTOF(UI\captive_ca.paa);
|
icon = QPATHTOF(UI\captive_ca.paa);
|
||||||
priority = 2.2;
|
priority = 2.2;
|
||||||
|
insertChildren = QUOTE(call DFUNC(addLoadCaptiveActions));
|
||||||
};
|
};
|
||||||
class GVAR(UnloadCaptive) {
|
class GVAR(UnloadCaptive) {
|
||||||
displayName = CSTRING(UnloadCaptive);
|
displayName = CSTRING(UnloadCaptive);
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
PREP(addLoadCaptiveActions);
|
||||||
PREP(canApplyHandcuffs);
|
PREP(canApplyHandcuffs);
|
||||||
PREP(canEscortCaptive);
|
PREP(canEscortCaptive);
|
||||||
PREP(canFriskPerson);
|
PREP(canFriskPerson);
|
||||||
|
25
addons/captives/functions/fnc_addLoadCaptiveActions.sqf
Normal file
25
addons/captives/functions/fnc_addLoadCaptiveActions.sqf
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Author: 654wak654
|
||||||
|
* Adds child actions to the "load captive" action for near vehicles.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Captive <OBJECT>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Child actions <ARRAY>
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [kevin] call ace_medical_fnc_addLoadCaptiveActions
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
params ["_target"];
|
||||||
|
|
||||||
|
private _statement = {
|
||||||
|
params ["_target", "_player", "_vehicle"];
|
||||||
|
[_player, _target, _vehicle] call FUNC(doLoadCaptive);
|
||||||
|
};
|
||||||
|
|
||||||
|
[_target call EFUNC(common,nearestVehiclesFreeSeat), _statement, _target] call EFUNC(interact_menu,createVehiclesActions)
|
@ -4,20 +4,20 @@
|
|||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit that wants to load a captive <OBJECT>
|
* 0: Unit that wants to load a captive <OBJECT>
|
||||||
* 1: A captive. ObjNull for the first escorted captive (may be null) <OBJECT>
|
* 1: A captive. objNull for the first escorted captive <OBJECT>
|
||||||
* 2: Vehicle to load the captive into. ObjNull for the nearest vehicle (may be null) <OBJECT>
|
* 2: Vehicle to load the captive into. objNull for the nearest vehicle <OBJECT>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* The return value <BOOL>
|
* Can load captive <BOOL>
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [player, bob, car] call ACE_captives_fnc_canLoadCaptive
|
* [bob, tom, car] call ace_captives_fnc_canLoadCaptive
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
params ["_unit", "_target","_vehicle"];
|
params ["_unit", "_target", "_vehicle"];
|
||||||
|
|
||||||
// Don't show "Load Captive" if unit is unconscious (already has "Load Patient")
|
// Don't show "Load Captive" if unit is unconscious (already has "Load Patient")
|
||||||
if (_target getVariable ["ACE_isUnconscious", false]) exitWith {false};
|
if (_target getVariable ["ACE_isUnconscious", false]) exitWith {false};
|
||||||
@ -30,20 +30,16 @@ if ((isNull _target) && {_unit getVariable [QGVAR(isEscorting), false]}) then {
|
|||||||
};
|
};
|
||||||
} forEach (attachedObjects _unit);
|
} forEach (attachedObjects _unit);
|
||||||
};
|
};
|
||||||
if ((isNull _target) || {(vehicle _target) != _target} || {!(_target getVariable [QGVAR(isHandcuffed), false])}) exitWith {false};
|
if (isNull _target || {(vehicle _target) != _target} || {!(_target getVariable [QGVAR(isHandcuffed), false])}) exitWith {false};
|
||||||
|
|
||||||
if (isNull _vehicle) then {
|
if (isNull _vehicle) then {
|
||||||
//Looking at a captive unit, search for nearby vehicles with valid seats:
|
// Looking at a captive unit, get nearest vehicle with valid seat:
|
||||||
{
|
_vehicle = (_target call EFUNC(common,nearestVehiclesFreeSeat)) param [0, objNull];
|
||||||
if ((_x emptyPositions "cargo") > 0) exitWith {
|
|
||||||
_vehicle = _x;
|
|
||||||
};
|
|
||||||
} forEach (nearestObjects [_unit, ["Car", "Tank", "Helicopter", "Plane", "Ship"], 10]);
|
|
||||||
} else {
|
} else {
|
||||||
//We have a vehicle picked, make sure it has empty seats:
|
// We have a vehicle picked, make sure it has empty seats:
|
||||||
if ((_vehicle emptyPositions "cargo") == 0) then {
|
if (_vehicle emptyPositions "cargo" == 0 && {_vehicle emptyPositions "gunner" == 0}) then {
|
||||||
_vehicle = objNull;
|
_vehicle = objNull;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
(!isNull _vehicle)
|
!isNull _vehicle
|
||||||
|
@ -4,42 +4,37 @@
|
|||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit that wants to load a captive <OBJECT>
|
* 0: Unit that wants to load a captive <OBJECT>
|
||||||
* 1: A captive. ObjNull for the first escorted captive <OBJECT>
|
* 1: A captive. objNull for the first escorted captive <OBJECT>
|
||||||
* 2: Vehicle to load the captive into. ObjNull for the nearest vehicle <OBJECT>
|
* 2: Vehicle to load the captive into. objNull for the nearest vehicle <OBJECT>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [bob, tom, car] call ACE_captives_fnc_doLoadCaptive
|
* [bob, tom, car] call ace_captives_fnc_doLoadCaptive
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
params ["_unit", "_target","_vehicle"];
|
params ["_unit", "_target", "_vehicle"];
|
||||||
|
|
||||||
if ((isNull _target) && {_unit getVariable [QGVAR(isEscorting), false]}) then {
|
if (isNull _target && {_unit getVariable [QGVAR(isEscorting), false]}) then {
|
||||||
//Looking at a vehicle while escorting, get target from attached objects:
|
// Looking at a vehicle while escorting, get target from attached objects:
|
||||||
{
|
{
|
||||||
if (_x getVariable [QGVAR(isHandcuffed), false]) exitWith {
|
if (_x getVariable [QGVAR(isHandcuffed), false]) exitWith {
|
||||||
_target = _x;
|
_target = _x;
|
||||||
};
|
};
|
||||||
} forEach (attachedObjects _unit);
|
} forEach (attachedObjects _unit);
|
||||||
};
|
};
|
||||||
if ((isNull _target) || {(vehicle _target) != _target} || {!(_target getVariable [QGVAR(isHandcuffed), false])}) exitWith {WARNING("");};
|
if (isNull _target || {(vehicle _target) != _target} || {!(_target getVariable [QGVAR(isHandcuffed), false])}) exitWith {WARNING("");};
|
||||||
|
|
||||||
if (isNull _vehicle) then {
|
if (isNull _vehicle) then {
|
||||||
//Looking at a captive unit, search for nearby vehicles with valid seats:
|
// Looking at a captive unit, get nearest vehicle with valid seat:
|
||||||
{
|
_vehicle = (_target call EFUNC(common,nearestVehiclesFreeSeat)) param [0, objNull];
|
||||||
// if (([_x] call FUNC(findEmptyNonFFVCargoSeat)) != -1) exitWith {
|
|
||||||
if ((_x emptyPositions "cargo") > 0) exitWith {
|
|
||||||
_vehicle = _x;
|
|
||||||
};
|
|
||||||
} forEach (nearestObjects [_unit, ["Car", "Tank", "Helicopter", "Plane", "Ship"], 10]);
|
|
||||||
} else {
|
} else {
|
||||||
// if (([_vehicle] call FUNC(findEmptyNonFFVCargoSeat)) == -1) then {
|
// We have a vehicle picked, make sure it has empty seats:
|
||||||
if ((_vehicle emptyPositions "cargo") == 0) then {
|
if (_vehicle emptyPositions "cargo" == 0 && {_vehicle emptyPositions "gunner" == 0}) then {
|
||||||
_vehicle = objNull;
|
_vehicle = objNull;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -18,20 +18,18 @@
|
|||||||
params ["_vehicle"];
|
params ["_vehicle"];
|
||||||
TRACE_1("params", _vehicle);
|
TRACE_1("params", _vehicle);
|
||||||
|
|
||||||
private _vehicleConfig = configFile >> "CfgVehicles" >> (typeOf _vehicle);
|
|
||||||
|
|
||||||
scopeName "main";
|
scopeName "main";
|
||||||
|
|
||||||
{
|
{
|
||||||
_x params ["_unit", "_role", "_cargoIndex", "_turretPath", "_isPersonTurret"];
|
_x params ["_unit", "_role", "_cargoIndex", "_turretPath", "_isPersonTurret"];
|
||||||
if ((isNull _unit) && {_role == "cargo"} && {_cargoIndex > -1} && {!_isPersonTurret}) then {
|
if (isNull _unit && {_role == "cargo"} && {_cargoIndex > -1} && {!_isPersonTurret}) then {
|
||||||
[_cargoIndex, false] breakOut "main";
|
[_cargoIndex, false] breakOut "main";
|
||||||
};
|
};
|
||||||
} forEach (fullCrew [_vehicle, "", true]);
|
} forEach (fullCrew [_vehicle, "", true]);
|
||||||
|
|
||||||
{
|
{
|
||||||
_x params ["_unit", "_role", "_cargoIndex", "_turretPath", "_isPersonTurret"];
|
_x params ["_unit", "_role", "_cargoIndex", "_turretPath", "_isPersonTurret"];
|
||||||
if ((isNull _unit) && {_cargoIndex > -1}) then {
|
if (isNull _unit && {_cargoIndex > -1}) then {
|
||||||
[_cargoIndex, true] breakOut "main";
|
[_cargoIndex, true] breakOut "main";
|
||||||
};
|
};
|
||||||
} forEach (fullCrew [_vehicle, "", true]);
|
} forEach (fullCrew [_vehicle, "", true]);
|
||||||
|
@ -4,42 +4,28 @@
|
|||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Target <OBJECT>
|
* 0: Target <OBJECT>
|
||||||
* 1: Player <OBJECT>
|
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Children actions <ARRAY>
|
* Child actions <ARRAY>
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [target, player] call ace_cargo_fnc_addCargoVehiclesActions
|
* [cursorObject] call ace_cargo_fnc_addCargoVehiclesActions
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
params ["_target", "_player"];
|
params ["_target"];
|
||||||
|
|
||||||
private _statement = {
|
private _statement = {
|
||||||
params ["_target", "_player", "_params"];
|
params ["_target", "_player", "_vehicle"];
|
||||||
_params params ["_vehicle"];
|
|
||||||
[_player, _target, _vehicle] call FUNC(startLoadIn);
|
[_player, _target, _vehicle] call FUNC(startLoadIn);
|
||||||
};
|
};
|
||||||
|
|
||||||
private _actions = [];
|
private _vehicles = (nearestObjects [_target, GVAR(cargoHolderTypes), MAX_LOAD_DISTANCE]) select {
|
||||||
|
private _hasCargoConfig = 1 == getNumber (configFile >> "CfgVehicles" >> typeOf _x >> QGVAR(hasCargo));
|
||||||
{
|
|
||||||
private _config = configFile >> "CfgVehicles" >> typeOf _x;
|
|
||||||
private _hasCargoPublic = _x getVariable [QGVAR(hasCargo), false];
|
private _hasCargoPublic = _x getVariable [QGVAR(hasCargo), false];
|
||||||
private _hasCargoConfig = getNumber (_config >> QGVAR(hasCargo)) == 1;
|
(_hasCargoConfig || {_hasCargoPublic}) && {_x != _target}
|
||||||
if ((_hasCargoPublic || _hasCargoConfig) && {_x != _target}) then {
|
};
|
||||||
private _name = getText (_config >> "displayName");
|
|
||||||
private _ownerName = [_x, true] call EFUNC(common,getName);
|
|
||||||
if ("" != _ownerName) then {
|
|
||||||
_name = format ["%1 (%2)", _name, _ownerName];
|
|
||||||
};
|
|
||||||
private _icon = (getText (_config >> "icon")) call BIS_fnc_textureVehicleIcon;
|
|
||||||
private _action = [format ["%1", _x], _name, _icon, _statement, {true}, {}, [_x]] call EFUNC(interact_menu,createAction);
|
|
||||||
_actions pushBack [_action, [], _target];
|
|
||||||
};
|
|
||||||
} forEach (nearestObjects [_player, GVAR(cargoHolderTypes), MAX_LOAD_DISTANCE]);
|
|
||||||
|
|
||||||
_actions
|
[_vehicles, _statement, _target] call EFUNC(interact_menu,createVehiclesActions)
|
||||||
|
@ -116,6 +116,7 @@ PREP(moduleLSDVehicles);
|
|||||||
PREP(muteUnit);
|
PREP(muteUnit);
|
||||||
PREP(muteUnitHandleInitPost);
|
PREP(muteUnitHandleInitPost);
|
||||||
PREP(muteUnitHandleRespawn);
|
PREP(muteUnitHandleRespawn);
|
||||||
|
PREP(nearestVehiclesFreeSeat);
|
||||||
PREP(numberToDigits);
|
PREP(numberToDigits);
|
||||||
PREP(numberToDigitsString);
|
PREP(numberToDigitsString);
|
||||||
PREP(numberToString);
|
PREP(numberToString);
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
* Author: Glowbal
|
* Author: Glowbal
|
||||||
* Loads a specified unit into any nearby vehicle
|
* Loads a specified unit into any nearby vehicle, or _vehicle parameter.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit that will load <OBJECT>
|
* 0: Unit that will load <OBJECT>
|
||||||
* 1: Unit to be loaded <OBJECT>
|
* 1: Unit to be loaded <OBJECT>
|
||||||
|
* 2: Vehicle that the unit will be loaded in <OBJECT> (default: objNull)
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* the vehicle that the unitToBeloaded has been loaded in. Returns ObjNull if function failed <OBJECT>
|
* Vehicle that the unitToBeloaded has been loaded in. Returns objNull if function failed <OBJECT>
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [bob, kevin] call ace_common_fnc_loadPerson
|
* [bob, kevin] call ace_common_fnc_loadPerson
|
||||||
@ -18,20 +19,14 @@
|
|||||||
|
|
||||||
#define GROUP_SWITCH_ID QFUNC(loadPerson)
|
#define GROUP_SWITCH_ID QFUNC(loadPerson)
|
||||||
|
|
||||||
params ["_caller", "_unit"];
|
params ["_caller", "_unit", ["_vehicle", objNull]];
|
||||||
|
|
||||||
private _vehicle = objNull;
|
|
||||||
|
|
||||||
if (!([_caller, _unit, ["isNotDragging", "isNotCarrying"]] call FUNC(canInteractWith)) || {_caller == _unit}) exitWith {_vehicle};
|
if (!([_caller, _unit, ["isNotDragging", "isNotCarrying"]] call FUNC(canInteractWith)) || {_caller == _unit}) exitWith {_vehicle};
|
||||||
|
|
||||||
private _nearVehicles = nearestObjects [_unit, ["Car", "Air", "Tank", "Ship_F","Pod_Heli_Transport_04_crewed_base_F"], 10];
|
// Try to use nearest vehicle if a vehicle hasn't been supplied
|
||||||
|
if (isNull _vehicle) then {
|
||||||
{
|
_vehicle = ([_unit] call FUNC(nearestVehiclesFreeSeat)) param [0, objNull];
|
||||||
TRACE_1("",_x);
|
};
|
||||||
if ((_x emptyPositions "cargo" > 0) || {_x emptyPositions "gunner" > 0}) exitWith {
|
|
||||||
_vehicle = _x;
|
|
||||||
};
|
|
||||||
} forEach _nearVehicles;
|
|
||||||
|
|
||||||
if (!isNull _vehicle) then {
|
if (!isNull _vehicle) then {
|
||||||
[_unit, true, GROUP_SWITCH_ID, side group _caller] call FUNC(switchToGroupSide);
|
[_unit, true, GROUP_SWITCH_ID, side group _caller] call FUNC(switchToGroupSide);
|
||||||
|
22
addons/common/functions/fnc_nearestVehiclesFreeSeat.sqf
Normal file
22
addons/common/functions/fnc_nearestVehiclesFreeSeat.sqf
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Author: 654wak654
|
||||||
|
* Returns a list of vehicles near given unit that the unit can be a passenger in.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Unit <OBJECT>
|
||||||
|
* 1: Distance <NUMBER>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Nearest vehicles with a free seat <ARRAY>
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [bob] call ace_common_fnc_nearestVehiclesFreeSeat
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
params ["_unit", ["_distance", 10]];
|
||||||
|
|
||||||
|
private _nearVehicles = nearestObjects [_unit, ["Car", "Air", "Tank", "Ship_F", "Pod_Heli_Transport_04_crewed_base_F"], _distance];
|
||||||
|
_nearVehicles select {(_x emptyPositions "cargo" > 0) || {_x emptyPositions "gunner" > 0}}
|
@ -7,6 +7,7 @@ PREP(compileMenuSelfAction);
|
|||||||
PREP(compileMenuZeus);
|
PREP(compileMenuZeus);
|
||||||
PREP(collectActiveActionTree);
|
PREP(collectActiveActionTree);
|
||||||
PREP(createAction);
|
PREP(createAction);
|
||||||
|
PREP(createVehiclesActions);
|
||||||
PREP(ctrlSetParsedTextCached);
|
PREP(ctrlSetParsedTextCached);
|
||||||
PREP(findActionNode);
|
PREP(findActionNode);
|
||||||
PREP(handleEscapeMenu);
|
PREP(handleEscapeMenu);
|
||||||
|
33
addons/interact_menu/functions/fnc_createVehiclesActions.sqf
Normal file
33
addons/interact_menu/functions/fnc_createVehiclesActions.sqf
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Author: Dystopian
|
||||||
|
* Creates child actions for vehicle list.
|
||||||
|
* Statement gets vehicle as action parameter.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Vehicle list <ARRAY>
|
||||||
|
* 1: Statement <CODE>
|
||||||
|
* 2: Target <OBJECT>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Array of actions <ARRAY>
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [nearestObjects [player, ["AllVehicles"], 10], {}, cursorObject] call ace_interact_menu_fnc_createVehiclesActions
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
params ["_vehicles", "_statement", "_target"];
|
||||||
|
|
||||||
|
_vehicles apply {
|
||||||
|
private _config = configFile >> "CfgVehicles" >> typeOf _x;
|
||||||
|
private _name = getText (_config >> "displayName");
|
||||||
|
private _ownerName = [_x, true] call EFUNC(common,getName);
|
||||||
|
if ("" != _ownerName) then {
|
||||||
|
_name = format ["%1 (%2)", _name, _ownerName];
|
||||||
|
};
|
||||||
|
private _icon = (getText (_config >> "icon")) call BIS_fnc_textureVehicleIcon;
|
||||||
|
private _action = [format ["%1", _x], _name, _icon, _statement, {true}, {}, _x] call EFUNC(interact_menu,createAction);
|
||||||
|
[_action, [], _target]
|
||||||
|
}
|
@ -551,6 +551,7 @@ class CfgVehicles {
|
|||||||
priority = 2;
|
priority = 2;
|
||||||
icon = QPATHTOF(UI\icons\medical_cross.paa);
|
icon = QPATHTOF(UI\icons\medical_cross.paa);
|
||||||
exceptions[] = {"isNotDragging", "isNotCarrying", "isNotSwimming"};
|
exceptions[] = {"isNotDragging", "isNotCarrying", "isNotSwimming"};
|
||||||
|
insertChildren = QUOTE(call DFUNC(addLoadPatientActions));
|
||||||
};
|
};
|
||||||
class GVAR(UnLoadPatient) {
|
class GVAR(UnLoadPatient) {
|
||||||
displayName = CSTRING(UnloadPatient);
|
displayName = CSTRING(UnloadPatient);
|
||||||
|
@ -11,6 +11,7 @@ PREP(actionLoadUnit);
|
|||||||
PREP(actionUnloadUnit);
|
PREP(actionUnloadUnit);
|
||||||
PREP(addDamageToUnit);
|
PREP(addDamageToUnit);
|
||||||
PREP(addHeartRateAdjustment);
|
PREP(addHeartRateAdjustment);
|
||||||
|
PREP(addLoadPatientActions);
|
||||||
PREP(addToLog);
|
PREP(addToLog);
|
||||||
PREP(addToTriageCard);
|
PREP(addToTriageCard);
|
||||||
PREP(addUnconsciousCondition);
|
PREP(addUnconsciousCondition);
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Author: Glowbal
|
* Author: Glowbal
|
||||||
* Action for loading an unconscious or dead unit in the nearest vechile
|
* Action for loading an unconscious or dead unit in the nearest vehicle, or _vehicle if given.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: The medic <OBJECT>
|
* 0: The medic <OBJECT>
|
||||||
* 1: The patient <OBJECT>
|
* 1: The patient <OBJECT>
|
||||||
|
* 2: The vehicle <OBJECT> (default: objNull)
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -17,7 +18,7 @@
|
|||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
params ["_caller", "_target"];
|
params ["_caller", "_target", ["_vehicle", objNull]];
|
||||||
|
|
||||||
if ([_target] call EFUNC(common,isAwake)) exitWith {
|
if ([_target] call EFUNC(common,isAwake)) exitWith {
|
||||||
[QEGVAR(common,displayTextStructured), [[LSTRING(CanNotLoaded), [_target] call EFUNC(common,getName)], 1.5, _caller], [_caller]] call CBA_fnc_targetEvent;
|
[QEGVAR(common,displayTextStructured), [[LSTRING(CanNotLoaded), [_target] call EFUNC(common,getName)], 1.5, _caller], [_caller]] call CBA_fnc_targetEvent;
|
||||||
@ -29,4 +30,4 @@ if ([_target] call FUNC(isBeingDragged)) then {
|
|||||||
[_caller, _target] call EFUNC(dragging,dropObject);
|
[_caller, _target] call EFUNC(dragging,dropObject);
|
||||||
};
|
};
|
||||||
|
|
||||||
private _vehicle = [_caller, _target] call EFUNC(common,loadPerson);
|
[_caller, _target, _vehicle] call EFUNC(common,loadPerson);
|
||||||
|
25
addons/medical/functions/fnc_addLoadPatientActions.sqf
Normal file
25
addons/medical/functions/fnc_addLoadPatientActions.sqf
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Author: 654wak654
|
||||||
|
* Adds child actions to the "load patient" action for near vehicles.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Patient <OBJECT>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Child actions <ARRAY>
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [kevin] call ace_medical_fnc_addLoadPatientActions
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
params ["_target"];
|
||||||
|
|
||||||
|
private _statement = {
|
||||||
|
params ["_target", "_player", "_vehicle"];
|
||||||
|
[_player, _target, _vehicle] call FUNC(actionLoadUnit);
|
||||||
|
};
|
||||||
|
|
||||||
|
[_target call EFUNC(common,nearestVehiclesFreeSeat), _statement, _target] call EFUNC(interact_menu,createVehiclesActions)
|
Loading…
Reference in New Issue
Block a user