Added load and unload actions

This commit is contained in:
Glowbal 2015-03-01 10:44:08 +01:00
parent 769b855255
commit fb763a9d57
3 changed files with 72 additions and 0 deletions

View File

@ -9,6 +9,8 @@ PREP(actionCheckPulseLocal);
PREP(actionCheckResponse);
PREP(actionPlaceInBodyBag);
PREP(actionRemoveTourniquet);
PREP(actionLoadUnit);
PREP(actionUnloadUnit);
PREP(addHeartRateAdjustment);
PREP(addToInjuredCollection);
PREP(addToLog);

View File

@ -0,0 +1,37 @@
/*
* Author: Glowbal
* Action for loading an unconscious or dead unit in the nearest vechile
*
* Arguments:
* 0: The medic <OBJECT>
* 1: The patient <OBJECT>
*
* Return Value:
* NONE
*
* Public: No
*/
#include "script_component.hpp"
private ["_caller", "_target","_vehicle", "_loaded"];
_caller = _this select 0;
_target = _this select 1;
if ([_target] call EFUNC(common,isAwake)) exitwith {
// TODO localization
["displayTextStructured", [_caller], [["This person (%1) is awake and cannot be loaded", [_target] call EFUNC(common,getName)], 1.5, _caller]] call EFUNC(common,targetEvent);
};
[_caller, objNull] call cse_fnc_carryObj;
[_target, objNull] call cse_fnc_carryObj;
_vehicle = [_caller, _target] call EFUNC(common,loadPerson);
if (!isNull _vehicle) then {
if (!isnil QGVAR(DROP_ADDACTION)) then {
_caller removeAction GVAR(DROP_ADDACTION);
GVAR(DROP_ADDACTION) = nil;
};
};

View File

@ -0,0 +1,33 @@
/*
* Author: Glowbal
* Action for unloading an unconscious or dead unit from a vechile
*
* Arguments:
* 0: The medic <OBJECT>
* 1: The patient <OBJECT>
* 2: Drag after unload <BOOL> <OPTIONAL>
*
* Return Value:
* NONE
*
* Public: No
*/
#include "script_component.hpp"
private ["_caller", "_target","_vehicle", "_drag", "_handle"];
_caller = _this select 0;
_target = _this select 1;
_drag = if (count _this > 2) then {_this select 2} else {false};
// cannot unload a unit not in a vehicle.
if (vehicle _target == _target) exitwith {};
if (([_target] call cse_fnc_isAwake)) exitwith {};
if ([_caller, _target] call EFUNC(common,unloadPerson)) then {
if (_drag) then {
if ((vehicle _caller) == _caller) then {
[[_caller, _target], QUOTE(DFUNC(actionDragUnit)), _caller, false] call BIS_fnc_MP;
};
};
};