mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #1911 from acemod/fixLoadUnloadUnconscious
Fix load unload unconscious
This commit is contained in:
commit
951afef495
@ -10,21 +10,39 @@
|
|||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
//#define DEBUG_MODE_FULL
|
#define DEBUG_MODE_FULL
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
#define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson))
|
#define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson))
|
||||||
|
|
||||||
private ["_loaded", "_emptyPos"];
|
private ["_loaded", "_emptyPos","_validVehiclestate"];
|
||||||
PARAMS_2(_unit,_vehicle);
|
PARAMS_2(_unit,_vehicle);
|
||||||
|
_validVehiclestate = true;
|
||||||
|
|
||||||
if (driver _vehicle == _unit) exitwith {TRACE_1("Exiting on Failed Driver Check", driver _vehicle == _unit); false;};
|
if (_vehicle isKindOf "Ship" ) then {
|
||||||
TRACE_1("Vehicle Check", driver _vehicle == _unit);
|
if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false};
|
||||||
if !(speed _vehicle <1 && (((getPos _vehicle) select 2) < 2)) exitwith {TRACE_1("Exiting on Failed speed check", getPosASL _vehicle == _unit); false;};
|
TRACE_1("SHIP Ground Check", getPosATL _vehicle );
|
||||||
TRACE_1("getPosASL Vehicle Check", getPos _vehicle);
|
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 13, typeof _unit]); // TODO: if spot is underwater pick another spot.
|
||||||
|
} else {
|
||||||
|
if (_vehicle isKindOf "Air" ) then {
|
||||||
|
if !(speed _vehicle <1 && {isTouchingGround _vehicle}) then {_validVehiclestate = false};
|
||||||
|
TRACE_1("Vehicle Ground Check", isTouchingGround _vehicle);
|
||||||
|
_emptyPos = (getPosASL _vehicle) call EFUNC(common,ASLtoPosition);
|
||||||
|
_emptyPos = [(_emptyPos select 0) + random(5), (_emptyPos select 1) + random(5), _emptyPos select 2 ];
|
||||||
|
} else {
|
||||||
|
if !(speed _vehicle <1 && {isTouchingGround _vehicle}) then {_validVehiclestate = false};
|
||||||
|
TRACE_1("Vehicle Ground Check", isTouchingGround _vehicle);
|
||||||
|
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 13, typeof _unit]);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
TRACE_1("getPosASL Vehicle Check", getPosASL _vehicle);
|
||||||
|
if (!_validVehiclestate) exitwith { diag_log format["Unable to unload patient because invalid vehicle state. Either moving or Not close enough on the ground. %1", getPos _vehicle]; false };
|
||||||
|
|
||||||
|
diag_log str _emptyPos;
|
||||||
|
|
||||||
|
if (count _emptyPos == 0) exitwith {diag_log format["No safe empty spots to unload patient. %1", _emptyPos]; false}; //consider displaying text saying there are no safe places to exit the vehicle
|
||||||
|
|
||||||
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 13, typeof _unit]);
|
|
||||||
if (count _emptyPos == 0) exitwith {false}; //consider displaying text saying there are no safe places to exit the vehicle
|
|
||||||
|
|
||||||
unassignVehicle _unit;
|
unassignVehicle _unit;
|
||||||
[_unit] orderGetIn false;
|
[_unit] orderGetIn false;
|
||||||
|
Loading…
Reference in New Issue
Block a user