revised heli lift

disallow if crew != 0 or detach if crew > 0
DZE_HeliLift = false; disables heli lift
This commit is contained in:
[VB]AWOL
2014-01-22 14:48:57 -06:00
parent 4549a5189f
commit d4edea2be4
3 changed files with 70 additions and 39 deletions

View File

@@ -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;
};

View File

@@ -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

View File

@@ -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