This commit is contained in:
@@ -1,14 +1,72 @@
|
||||
// Declaração de variáveis:
|
||||
params ["_heli"];
|
||||
|
||||
// Criação e posicionamento do EFS:
|
||||
private _currentEfs = _heli getVariable ["efs", objNull];
|
||||
if (!isNull _currentEfs) exitWith {
|
||||
_heli vehicleChat "Emergency Floating System already deployed.";
|
||||
};
|
||||
|
||||
sleep 1;
|
||||
_heli vehicleChat "Deploying Emergency Floating System!";
|
||||
_heli say3D "EFS";
|
||||
_heli animate ["EFS_Cover_Hide", 1];
|
||||
_heli animate ["EFS_Hide", 1];
|
||||
|
||||
private _efs = "BRAF_Esquilo_EFS" createVehicle [0, 0, 0];
|
||||
_efs setDir (getDir _heli);
|
||||
_efs setPosASL (_heli modelToWorld [0, 0, 0]);
|
||||
_efs attachTo [_heli, [0, 0, 0], "efs_spawn"];
|
||||
|
||||
_heli setVariable ["efs", _efs];
|
||||
_heli setVariable ["efs", _efs, true];
|
||||
_heli setVariable ["braf_efs_deployed", true, true];
|
||||
|
||||
_heli;
|
||||
if ((_heli getVariable ["braf_efs_engine_lock_eh", -1]) < 0) then {
|
||||
private _engineLockEh = _heli addEventHandler ["Engine", {
|
||||
params ["_vehicle", "_engineState"];
|
||||
|
||||
if (_engineState && {_vehicle getVariable ["braf_efs_water_landed", false]}) then {
|
||||
_vehicle engineOn false;
|
||||
_vehicle vehicleChat "Engine restart disabled after EFS water landing.";
|
||||
};
|
||||
}];
|
||||
|
||||
_heli setVariable ["braf_efs_engine_lock_eh", _engineLockEh];
|
||||
};
|
||||
|
||||
if (!(_heli getVariable ["braf_efs_water_monitor", false])) then {
|
||||
_heli setVariable ["braf_efs_water_monitor", true, true];
|
||||
|
||||
[_heli] spawn {
|
||||
params ["_heli"];
|
||||
|
||||
private _waterContact = false;
|
||||
while {
|
||||
!isNull _heli
|
||||
&& {_heli getVariable ["braf_efs_deployed", false]}
|
||||
&& {!(_heli getVariable ["braf_efs_water_landed", false])}
|
||||
&& {!_waterContact}
|
||||
} do {
|
||||
private _efsProbe = _heli getVariable ["efs", objNull];
|
||||
private _waterProbeASL = if (isNull _efsProbe) then {getPosASL _heli} else {getPosASL _efsProbe};
|
||||
_waterContact = (surfaceIsWater (getPosWorld _heli))
|
||||
&& {(isTouchingGround _heli) || {(_waterProbeASL select 2) < 0.75}};
|
||||
|
||||
sleep 0.25;
|
||||
};
|
||||
|
||||
_heli setVariable ["braf_efs_water_monitor", false, true];
|
||||
|
||||
if (isNull _heli || {!_waterContact}) exitWith {};
|
||||
|
||||
_heli setVariable ["braf_efs_water_landed", true, true];
|
||||
_heli engineOn false;
|
||||
_heli vehicleChat "EFS water landing complete. Engine restart disabled.";
|
||||
|
||||
while {!isNull _heli && {_heli getVariable ["braf_efs_water_landed", false]}} do {
|
||||
if (isEngineOn _heli) then {
|
||||
_heli engineOn false;
|
||||
};
|
||||
|
||||
sleep 0.5;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user