mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
52ed0fc6be
* Lock seats of unconscious or dead units * disable pullOutBody if medical is loaded * fix undefined var and switch to objectParent --------- Co-authored-by: Salluci <salluci.lovi@gmail.com> Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
38 lines
1.0 KiB
Plaintext
38 lines
1.0 KiB
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: BaerMitUmlaut
|
|
* Locks the seat of an unconscious or dead unit to prevent automatic unloading.
|
|
*
|
|
* Arguments:
|
|
* 0: Unit <OBJECT>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Public: No
|
|
*/
|
|
params ["_unit"];
|
|
|
|
private _vehicle = objectParent _unit;
|
|
|
|
if (alive _unit && {lifeState _unit != "INCAPACITATED"}) exitWith {};
|
|
|
|
switch (true) do {
|
|
case (_unit isEqualTo (driver _vehicle)): {
|
|
_vehicle lockDriver true;
|
|
_unit setVariable [QGVAR(lockedSeat), [_vehicle, "driver"], true];
|
|
};
|
|
|
|
case (_vehicle getCargoIndex _unit != -1): {
|
|
private _cargoIndex = _vehicle getCargoIndex _unit;
|
|
_vehicle lockCargo [_cargoIndex, true];
|
|
_unit setVariable [QGVAR(lockedSeat), [_vehicle, "cargo", _cargoIndex], true];
|
|
};
|
|
|
|
case ((_vehicle unitTurret _unit) isNotEqualTo []): {
|
|
private _turretPath = _vehicle unitTurret _unit;
|
|
_vehicle lockTurret [_turretPath, true];
|
|
_unit setVariable [QGVAR(lockedSeat), [_vehicle, "turret", _turretPath], true];
|
|
};
|
|
};
|