mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #1389 from acemod/possibleFixMedicalUnloadPatient
Possible fix medical unload patient
This commit is contained in:
commit
7dd01ebb69
@ -180,6 +180,7 @@ PREP(toHex);
|
||||
PREP(toNumber);
|
||||
PREP(uniqueElementsOnly);
|
||||
PREP(unloadPerson);
|
||||
PREP(unloadPersonLocal);
|
||||
PREP(unmuteUnit);
|
||||
PREP(useItem);
|
||||
PREP(useMagazine);
|
||||
|
@ -10,12 +10,12 @@
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
//#define DEBUG_MODE_FULL
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson))
|
||||
|
||||
private ["_vehicle", "_loaded", "_emptyPos"];
|
||||
private ["_vehicle","_emptyPos"];
|
||||
PARAMS_1(_unit);
|
||||
_vehicle = vehicle _unit;
|
||||
|
||||
@ -25,20 +25,8 @@ if !(speed _vehicle <1 && (((getpos _vehicle) select 2) < 2)) exitwith {false;};
|
||||
_emptyPos = ((getPos _vehicle) findEmptyPosition [0, 10, typeof _unit]);
|
||||
if (count _emptyPos == 0) exitwith {false};
|
||||
|
||||
_unit setPos _emptyPos;
|
||||
unassignVehicle _unit;
|
||||
if (!alive _unit) then {
|
||||
_unit action ["Eject", vehicle _unit];
|
||||
};
|
||||
|
||||
[_unit, false, GROUP_SWITCH_ID, side group _unit] call FUNC(switchToGroupSide);
|
||||
|
||||
_loaded = _vehicle getvariable [QGVAR(loaded_persons),[]];
|
||||
_loaded = _loaded - [_unit];
|
||||
_vehicle setvariable [QGVAR(loaded_persons),_loaded,true];
|
||||
|
||||
if (!([_unit] call FUNC(isAwake))) then {
|
||||
[_unit,([_unit] call FUNC(getDeathAnim)), 1, true] call FUNC(doAnimation);
|
||||
if (!isNull _vehicle) then {
|
||||
[[_unit], QUOTE(FUNC(unloadPersonLocal)), _unit, false] call EFUNC(common,execRemoteFnc);
|
||||
};
|
||||
|
||||
true;
|
||||
|
44
addons/common/functions/fnc_unloadPersonLocal.sqf
Normal file
44
addons/common/functions/fnc_unloadPersonLocal.sqf
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Author: ViperMaul
|
||||
* Unload a person from a vehicle, local
|
||||
*
|
||||
* Arguments:
|
||||
* 0: unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Returns true if succesfully unloaded person <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
//#define DEBUG_MODE_FULL
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson))
|
||||
|
||||
private ["_vehicle", "_loaded", "_emptyPos"];
|
||||
PARAMS_1(_unit);
|
||||
_vehicle = vehicle _unit;
|
||||
|
||||
if (_vehicle == _unit) exitwith {false;};
|
||||
if !(speed _vehicle <1 && (((getpos _vehicle) select 2) < 2)) exitwith {false;};
|
||||
|
||||
_emptyPos = ((getPos _vehicle) findEmptyPosition [0, 10, typeof _unit]);
|
||||
if (count _emptyPos == 0) exitwith {false};
|
||||
|
||||
_unit setPos _emptyPos;
|
||||
unassignVehicle _unit;
|
||||
if (!alive _unit) then {
|
||||
_unit action ["Eject", vehicle _unit];
|
||||
};
|
||||
|
||||
[_unit, false, GROUP_SWITCH_ID, side group _unit] call FUNC(switchToGroupSide);
|
||||
|
||||
_loaded = _vehicle getvariable [QGVAR(loaded_persons),[]];
|
||||
_loaded = _loaded - [_unit];
|
||||
_vehicle setvariable [QGVAR(loaded_persons),_loaded,true];
|
||||
|
||||
if (!([_unit] call FUNC(isAwake))) then {
|
||||
[_unit,([_unit] call FUNC(getDeathAnim)), 1, true] call FUNC(doAnimation);
|
||||
};
|
||||
|
||||
true;
|
@ -22,12 +22,6 @@ _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 (([_target] call EFUNC(common,isAwake))) exitwith {};
|
||||
|
||||
if ([_target] call EFUNC(common,unloadPerson)) then {
|
||||
if (_drag) then {
|
||||
if ((vehicle _caller) == _caller) then {
|
||||
[[_caller, _target, true], QUOTE(DFUNC(actionDragUnit)), _caller, false] call EFUNC(common,execRemoteFnc); // TODO replace by event
|
||||
};
|
||||
};
|
||||
};
|
||||
[_target] call EFUNC(common,unloadPerson)
|
Loading…
Reference in New Issue
Block a user