mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-13 19:52:38 +03:00
12
SQF/dayz_code/actions/player_heliDetach.sqf
Normal file
12
SQF/dayz_code/actions/player_heliDetach.sqf
Normal file
@@ -0,0 +1,12 @@
|
||||
private["_action","_liftHeli","_vehicle","_onLadder","_liftUseTime","_dis","_sfx","_liftUsageTime","_animState","_started","_finished","_moved","_attached","_hasAttached","_animState","_isMedic","_posL","_posC","_height"];
|
||||
|
||||
_action = _this select 3;
|
||||
_liftHeli = _action select 0;
|
||||
_vehicle = _action select 1;
|
||||
|
||||
dayz_myLiftVehicle removeAction s_player_heli_detach;
|
||||
s_player_heli_detach = -1;
|
||||
|
||||
detach _vehicle;
|
||||
_vehicle setVariable["attached",false,true];
|
||||
_liftHeli setVariable["hasAttached",false,true];
|
||||
101
SQF/dayz_code/actions/player_heliLift.sqf
Normal file
101
SQF/dayz_code/actions/player_heliLift.sqf
Normal file
@@ -0,0 +1,101 @@
|
||||
private["_action","_liftHeli","_vehicle","_onLadder","_liftUseTime","_dis","_sfx","_liftUsageTime","_animState","_started","_finished","_moved","_attached","_hasAttached","_animState","_isMedic","_posL","_posC","_height"];
|
||||
|
||||
_action = _this select 3;
|
||||
_liftHeli = _action select 0;
|
||||
_vehicle = _action select 1;
|
||||
|
||||
player removeAction s_player_heli_lift;
|
||||
s_player_heli_lift = -1;
|
||||
|
||||
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
|
||||
if (_onLadder) exitWith {cutText ["You can't perform this action while on a ladder!" , "PLAIN DOWN"]};
|
||||
|
||||
if (vehicle player != player) exitWith {cutText ["You can't perform this action while in a vehicle", "PLAIN DOWN"]};
|
||||
|
||||
_liftUseTime = 6;
|
||||
_dis=10;
|
||||
_sfx = "repair";
|
||||
|
||||
r_interrupt = false;
|
||||
r_doLoop = true;
|
||||
_liftUsageTime = time;
|
||||
_animState = animationState player;
|
||||
_started = false;
|
||||
_finished = false;
|
||||
|
||||
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
|
||||
[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
|
||||
|
||||
_moved = false;
|
||||
while {r_doLoop} do {
|
||||
_attached = _vehicle getVariable["attached",false];
|
||||
_hasAttached = _liftHeli getVariable["hasAttached",false];
|
||||
_animState = animationState player;
|
||||
_isMedic = ["medic",_animState] call fnc_inString;
|
||||
|
||||
_posL = getPos _x;
|
||||
_posC = getPos _cursorTarget;
|
||||
_height = (_posL select 2) - (_posC select 2);
|
||||
if(_height < 20) then {
|
||||
if(((abs((_posL select 0) - (_posC select 0))) < 10) and ((abs((_posL select 1) - (_posC select 1))) < 10)) then {
|
||||
_moved = true;
|
||||
};
|
||||
} else {
|
||||
_moved = true;
|
||||
};
|
||||
|
||||
if (_isMedic) then {
|
||||
_started = true;
|
||||
};
|
||||
if(!_isMedic && !r_interrupt && (time - _liftUsageTime) < _liftUseTime) then {
|
||||
player playActionNow "Medic";
|
||||
_isMedic = true;
|
||||
};
|
||||
if (_started && !_isMedic && (time - _liftUsageTime) > _liftUseTime) then {
|
||||
r_doLoop = false;
|
||||
_finished = true;
|
||||
};
|
||||
if (r_interrupt or _moved or (typeName _attached == "OBJECT") or (typeName _hasAttached == "OBJECT")) then {
|
||||
r_doLoop = false;
|
||||
};
|
||||
sleep 0.1;
|
||||
};
|
||||
r_doLoop = false;
|
||||
|
||||
if(_finished) then {
|
||||
_vehicle attachTo [_liftHeli,[0,0,-7]];
|
||||
_vehicle setVariable["attached",_liftHeli,true];
|
||||
_liftHeli setVariable["hasAttached",_vehicle,true];
|
||||
r_doLoop = true;
|
||||
while {r_doLoop} do {
|
||||
_attached = _vehicle getVariable["attached",false];
|
||||
|
||||
if(((getPos _liftHeli) select 2) < 5) then {
|
||||
r_doLoop = false;
|
||||
};
|
||||
if(typeName _attached == typeName false) then {
|
||||
r_doLoop = false;
|
||||
};
|
||||
};
|
||||
r_doLoop = false;
|
||||
detach _vehicle;
|
||||
_vehicle setVariable["attached",false,true];
|
||||
_liftHeli setVariable["hasAttached",false,true];
|
||||
} else {
|
||||
if(_moved) then {
|
||||
player switchMove "";
|
||||
player playActionNow "stop";
|
||||
cutText [format["the lift heli moved to much from the vehicle that was being lifted!"], "PLAIN DOWN"]; //display text at bottom center of screen on interrupt
|
||||
} else {
|
||||
if((typeName _attached == "OBJECT") or (typeName _hasAttached == "OBJECT")) then {
|
||||
player switchMove "";
|
||||
player playActionNow "stop";
|
||||
cutText [format["Another vehicle was attached or the vehicle was attached to another heli!"], "PLAIN DOWN"]; //display text at bottom center of screen on interrupt
|
||||
} else {
|
||||
r_interrupt = false;
|
||||
player switchMove "";
|
||||
player playActionNow "stop";
|
||||
cutText [format["You have interrupted lifting a vehicle!"], "PLAIN DOWN"]; //display text at bottom center of screen on interrupt
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -37,6 +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,"",""];
|
||||
};
|
||||
} else {
|
||||
dayz_myLiftVehicle removeAction s_player_heli_detach;
|
||||
s_player_heli_detach = -1;
|
||||
};
|
||||
|
||||
if(DZE_HaloJump) then {
|
||||
if(_inVehicle and (_vehicle isKindOf "Air") and ((getPos _vehicle select 2) > 400)) then {
|
||||
if (s_halo_action < 0) then {
|
||||
@@ -246,7 +257,41 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
|
||||
player removeAction s_player_deleteBuild;
|
||||
s_player_deleteBuild = -1;
|
||||
};
|
||||
|
||||
|
||||
_liftHelis = nearestObjects [player, DZE_HeliAllowTow, 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;
|
||||
};
|
||||
};
|
||||
};
|
||||
} 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
|
||||
if(_player_lockUnlock_crtl) then {
|
||||
|
||||
@@ -246,7 +246,9 @@ dayz_resetSelfActions = {
|
||||
s_halo_action = -1;
|
||||
s_player_SurrenderedGear = -1;
|
||||
s_player_maintain_area = -1;
|
||||
s_player_maintain_area_preview = -1;
|
||||
s_player_maintain_area_preview = -1;
|
||||
s_player_heli_lift = -1;
|
||||
s_player_heli_detach = -1;
|
||||
};
|
||||
call dayz_resetSelfActions;
|
||||
|
||||
@@ -376,6 +378,17 @@ DZE_vehicleZwounds = [
|
||||
"Glass6"
|
||||
];
|
||||
|
||||
DZE_HeliAllowTowFrom = [
|
||||
"CH_47F_EP1_DZE",
|
||||
"CH_47F_EP1_DZ",
|
||||
"CH_47F_BAF",
|
||||
"CH_47F_EP1"
|
||||
];
|
||||
|
||||
DZE_HeliAllowToTow = [
|
||||
"Car"
|
||||
];
|
||||
|
||||
//Initialize Zombie Variables
|
||||
dayz_zombieTargetList = [
|
||||
["SoldierWB",50],
|
||||
|
||||
Reference in New Issue
Block a user