From d4edea2be483887bd3768e312d2e11baee6b8b28 Mon Sep 17 00:00:00 2001 From: "[VB]AWOL" Date: Wed, 22 Jan 2014 14:48:57 -0600 Subject: [PATCH] revised heli lift disallow if crew != 0 or detach if crew > 0 DZE_HeliLift = false; disables heli lift --- SQF/dayz_code/actions/player_heliLift.sqf | 5 ++ SQF/dayz_code/compile/fn_selfActions.sqf | 84 +++++++++++++---------- SQF/dayz_code/init/variables.sqf | 20 +++++- 3 files changed, 70 insertions(+), 39 deletions(-) diff --git a/SQF/dayz_code/actions/player_heliLift.sqf b/SQF/dayz_code/actions/player_heliLift.sqf index 91aa9701c..a0a75f395 100644 --- a/SQF/dayz_code/actions/player_heliLift.sqf +++ b/SQF/dayz_code/actions/player_heliLift.sqf @@ -73,6 +73,11 @@ if(_finished) then { if(((getPos _liftHeli) select 2) < 5) then { r_doLoop = false; }; + + if ((count (crew _vehicle)) > 0) then { + r_doLoop = false; + }; + if(typeName _attached == typeName false) then { r_doLoop = false; }; diff --git a/SQF/dayz_code/compile/fn_selfActions.sqf b/SQF/dayz_code/compile/fn_selfActions.sqf index 751f690c9..e9f78bcad 100644 --- a/SQF/dayz_code/compile/fn_selfActions.sqf +++ b/SQF/dayz_code/compile/fn_selfActions.sqf @@ -37,15 +37,17 @@ if (_canPickLight and !dayz_hasLight and !_isPZombie) then { s_player_removeflare = -1; }; -_hasAttached = _vehicle getVariable["hasAttached",false]; -if(_inVehicle and (_vehicle isKindOf "Air") and ((getPos _vehicle select 2) < 30) and (speed _vehicle < 5) and (typeName _hasAttached == "OBJECT")) then { - if (s_player_heli_detach < 0) then { - dayz_myLiftVehicle = _vehicle; - s_player_heli_detach = dayz_myLiftVehicle addAction ["Detach Vehicle","\z\addons\dayz_code\actions\player_heliDetach.sqf",[dayz_myLiftVehicle,_hasAttached],2,false,true,"",""]; +if (DZE_HeliLift) then { + _hasAttached = _vehicle getVariable["hasAttached",false]; + if(_inVehicle and (_vehicle isKindOf "Air") and ((getPos _vehicle select 2) < 30) and (speed _vehicle < 5) and (typeName _hasAttached == "OBJECT")) then { + if (s_player_heli_detach < 0) then { + dayz_myLiftVehicle = _vehicle; + s_player_heli_detach = dayz_myLiftVehicle addAction ["Detach Vehicle","\z\addons\dayz_code\actions\player_heliDetach.sqf",[dayz_myLiftVehicle,_hasAttached],2,false,true,"",""]; + }; + } else { + dayz_myLiftVehicle removeAction s_player_heli_detach; + s_player_heli_detach = -1; }; -} else { - dayz_myLiftVehicle removeAction s_player_heli_detach; - s_player_heli_detach = -1; }; if(DZE_HaloJump) then { @@ -258,39 +260,45 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu s_player_deleteBuild = -1; }; - _liftHelis = nearestObjects [player, DZE_HeliAllowTowFrom, 30]; - _liftHeli = objNull; - _found = false; - { - if(!_found) then { - _posL = getPos _x; - _posC = getPos _cursorTarget; - _height = (_posL select 2) - (_posC select 2); - _hasAttached = _x getVariable["hasAttached",false]; - if(_height < 30 and _height > 5 and (typeName _hasAttached != "OBJECT")) then { - if(((abs((_posL select 0) - (_posC select 0))) < 10) and ((abs((_posL select 1) - (_posC select 1))) < 10)) then { - _liftHeli = _x; - _found = true; + if (DZE_HeliLift) then { + _liftHeli = objNull; + _found = false; + + _allowTow = false; + if ((count (crew _cursorTarget)) == 0) then { + { + if(!_allowTow) then { + _allowTow = _cursorTarget isKindOf _x; }; + } forEach DZE_HeliAllowToTow; + }; + + if (_allowTow) then { + _liftHelis = nearestObjects [player, DZE_HeliAllowTowFrom, 15]; + { + if(!_found) then { + _posL = getPos _x; + _posC = getPos _cursorTarget; + _height = (_posL select 2) - (_posC select 2); + _hasAttached = _x getVariable["hasAttached",false]; + if(_height < 15 and _height > 5 and (typeName _hasAttached != "OBJECT")) then { + if(((abs((_posL select 0) - (_posC select 0))) < 10) and ((abs((_posL select 1) - (_posC select 1))) < 10)) then { + _liftHeli = _x; + _found = true; + }; + }; + }; + } forEach _liftHelis; + }; + _attached = _cursorTarget getVariable["attached",false]; + if(_found and _allowTow and _canDo and !locked _cursorTarget and !_isPZombie and (typeName _attached != "OBJECT")) then { + if (s_player_heli_lift < 0) then { + s_player_heli_lift = player addAction ["Attach to Heli", "\z\addons\dayz_code\actions\player_heliLift.sqf",[_liftHeli,_cursorTarget], -10, false, true, "",""]; }; + } else { + player removeAction s_player_heli_lift; + s_player_heli_lift = -1; }; - } forEach _liftHelis; - - _allowTow = false; - { - if(!_allowTow) then { - _allowTow = _cursorTarget isKindOf _x; - }; - } forEach DZE_HeliAllowToTow; - - _attached = _cursorTarget getVariable["attached",false]; - if(_found and _allowTow and _canDo and !locked _cursorTarget and !_isPZombie and (typeName _attached != "OBJECT")) then { - if (s_player_heli_lift < 0) then { - s_player_heli_lift = player addAction ["Attach to Heli", "\z\addons\dayz_code\actions\player_heliLift.sqf",[_liftHeli,_cursorTarget], -10, false, true, "",""]; - }; - } else { - player removeAction s_player_heli_lift; - s_player_heli_lift = -1; }; // Allow Owner to lock and unlock vehicle diff --git a/SQF/dayz_code/init/variables.sqf b/SQF/dayz_code/init/variables.sqf index dd60cf1e8..8fbaf68e8 100644 --- a/SQF/dayz_code/init/variables.sqf +++ b/SQF/dayz_code/init/variables.sqf @@ -386,7 +386,21 @@ DZE_HeliAllowTowFrom = [ ]; DZE_HeliAllowToTow = [ - "Car" + "hilux1_civil_1_open", + "HMMWV_Base", + "Lada_base", + "Offroad_DSHKM_base", + "Pickup_PK_base", + "SkodaBase", + "tractor", + "VWGolf", + "Volha_TK_CIV_Base_EP1", + "S1203_TK_CIV_EP1", + "SUV_Base_EP1", + "ArmoredSUV_Base_PMC", + "UAZ_Base", + "LandRover_Base", + "Ship" ]; //Initialize Zombie Variables @@ -564,6 +578,10 @@ if(isServer) then { if(isNil "DZE_CleanNull") then { DZE_CleanNull = false; }; + + if(isNil "DZE_HeliLift") then { + DZE_HeliLift = true; + }; //dayz_flyMonitor = []; //used for monitor flies