mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
39e4f9340b
* switch to objectParent * use objectParent in unloadUnit * fix derp * allow unload patient on dead units
45 lines
1.2 KiB
Plaintext
45 lines
1.2 KiB
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: Glowbal
|
|
* Unloads an unconscious or dead patient from their vehicle.
|
|
*
|
|
* Arguments:
|
|
* 0: Medic <OBJECT>
|
|
* 1: Patient <OBJECT>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [player, bob] call ace_medical_treatment_fnc_unloadUnit
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
params ["_medic", "_patient"];
|
|
TRACE_2("unloadUnit",_medic,_patient);
|
|
|
|
if (isNull objectParent _patient) exitWith {
|
|
ERROR_1("Unit %1 is not in a vehicle",_patient);
|
|
};
|
|
|
|
if (_patient call EFUNC(common,isAwake)) exitWith {
|
|
ERROR_1("Unit %1 is awake",_patient);
|
|
};
|
|
|
|
["ace_unloadPersonEvent", [_patient, objectParent _patient, _medic], _patient] call CBA_fnc_targetEvent;
|
|
|
|
[{
|
|
params ["_unit"];
|
|
isNull objectParent _unit
|
|
}, {
|
|
params ["_unit", "_vehicle"];
|
|
TRACE_2("success",_unit,_vehicle);
|
|
private _patientName = [_unit, false, true] call EFUNC(common,getName);
|
|
private _vehicleName = getText (configOf _vehicle >> "displayName");
|
|
[[LSTRING(UnloadedFrom), _patientName, _vehicleName], 3] call EFUNC(common,displayTextStructured);
|
|
}, [_patient, objectParent _patient], 3, {
|
|
params ["_unit", "_vehicle"];
|
|
WARNING_3("unloadPerson failed to unload %1[local %2] -> %3 ",_unit,local _unit,_vehicle);
|
|
}] call CBA_fnc_waitUntilAndExecute;
|