mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-02-16 13:12:56 +03:00
24
SQF/dayz_code/compile/fn_nearWaterHole.sqf
Normal file
24
SQF/dayz_code/compile/fn_nearWaterHole.sqf
Normal file
@@ -0,0 +1,24 @@
|
||||
private ["_bb","_dir","_nearWaterHole","_w2m"];
|
||||
|
||||
_nearWaterHole = false;
|
||||
|
||||
{
|
||||
{
|
||||
_w2m = _x worldToModel (getPosATL player);
|
||||
_bb = (boundingbox _x) select 1;
|
||||
_dir = [player, _x] call BIS_fnc_relativeDirTo;
|
||||
|
||||
if (_dir > 180) then {
|
||||
_dir = _dir - 360;
|
||||
};
|
||||
|
||||
if ((abs _dir < 45 && {_x distance player < 2.22}) // wells, kasna, pumpa
|
||||
or {("" == typeOf _x && (_w2m select 2 < 0.05)) && {(abs(_w2m select 0) < (_bb select 0)) && (abs(_w2m select 1) < (_bb select 1))}}) exitWith { // ponds
|
||||
_nearWaterHole = true;
|
||||
};
|
||||
} count (nearestObjects [_x, [], 1]);
|
||||
|
||||
if (_nearWaterHole) exitWith {};
|
||||
} forEach (nearestObjects [player, ["waterHoleProxy"], 50]);
|
||||
|
||||
_nearWaterHole
|
||||
@@ -5,7 +5,7 @@ scriptName "Functions\misc\fn_selfActions.sqf";
|
||||
- [] call fnc_usec_selfActions;
|
||||
************************************************************/
|
||||
if (dayz_actionInProgress) exitWith {};
|
||||
private ["_canPickLight","_text","_dir","_canDoThis","_w2m","_bb","_waterHoles","_unlock","_lock","_totalKeys","_temp_keys","_temp_keys_names",
|
||||
private ["_canPickLight","_text","_unlock","_lock","_totalKeys","_temp_keys","_temp_keys_names","_nearWaterHole",
|
||||
"_hasKey","_oldOwner","_hasAttached","_isZombie","_isHarvested","_isMan","_isFuel","_hasRawMeat","_hastinitem","_player_deleteBuild",
|
||||
"_player_lockUnlock_crtl","_displayName","_hasIgnators","_menu","_menu1","_allowTow","_liftHeli","_found","_posL","_posC","_height","_attached",
|
||||
"_combi","_findNearestGen","_humanity_logic","_low_high","_cancel","_buy","_buyV","_humanity","_traderMenu","_warn","_typeOfCursorTarget",
|
||||
@@ -97,30 +97,19 @@ if ((_primaryWeapon in Dayz_fishingItems) && {!dayz_fishingInprogress} && {_inVe
|
||||
s_player_fishing_veh = -1;
|
||||
};
|
||||
|
||||
_canDoThis=false;
|
||||
if (_canDo && !_inVehicle && !dayz_isSwimming) then {
|
||||
{
|
||||
_waterHoles = if (typeOf _x == "waterHoleProxy") then {nearestObjects [_x, [], 1];} else {[_x];};
|
||||
{
|
||||
_w2m = _x worldToModel (getPosATL player);
|
||||
_bb = (boundingbox _x) select 1;
|
||||
_dir = [player, _x] call BIS_fnc_relativeDirTo; if (_dir > 180) then {_dir = _dir - 360};
|
||||
if (((abs _dir < 45) && {(_x distance player < 2.22)}) // wells, kasna, pumpa
|
||||
or {((("" == typeOf _x) && ((_w2m select 2) < 0.05)) && {((abs(_w2m select 0) < (_bb select 0)) && (abs(_w2m select 1) < (_bb select 1)))})}) exitWith { // ponds
|
||||
_canDoThis = true;
|
||||
};
|
||||
} count _waterHoles;
|
||||
if (_canDoThis) exitWith {
|
||||
if (s_player_Drinkfromhands < 0) then {
|
||||
s_player_Drinkfromhands = player addAction [localize "STR_ACTIONS_DRINK2", "\z\addons\dayz_code\actions\player_drinkWater.sqf",player, 0.5, false, true];
|
||||
};
|
||||
};
|
||||
} foreach nearestObjects [player, ["waterHoleProxy", "Land_pumpa"], 50];
|
||||
/*
|
||||
//FPS killer. Moved to CfgVehicles for Land_pumpa
|
||||
_nearWaterHole = call fn_nearWaterHole;
|
||||
if (_canDo && !_inVehicle && !dayz_isSwimming && _nearWaterHole) then {
|
||||
if (s_player_Drinkfromhands < 0) then {
|
||||
s_player_Drinkfromhands = player addAction [localize "STR_ACTIONS_DRINK2", "\z\addons\dayz_code\actions\player_drinkWater.sqf",player, 0.5, false, true];
|
||||
};
|
||||
};
|
||||
if (!_canDoThis && s_player_Drinkfromhands >= 0) then {
|
||||
if (!_nearWaterHole && s_player_Drinkfromhands >= 0) then {
|
||||
player removeAction s_player_Drinkfromhands;
|
||||
s_player_Drinkfromhands = -1;
|
||||
};
|
||||
*/
|
||||
|
||||
if (_inVehicle) then {
|
||||
DZE_myVehicle = _vehicle;
|
||||
|
||||
@@ -23,7 +23,7 @@ player setVariable ["NORRN_unconscious", r_player_unconscious, true];
|
||||
_sandLevel = ctrlPosition ((uiNamespace getVariable 'DAYZ_GUI_waiting') displayCtrl 1400);
|
||||
//diag_log [(diag_tickTime - _start) < _timeout , !r_player_unconscious , alive player ];
|
||||
|
||||
autoRunActive = false;
|
||||
dayz_autoRun = false;
|
||||
|
||||
if (player == vehicle player) then {
|
||||
player playAction "CanNotMove";
|
||||
|
||||
@@ -29,17 +29,20 @@ if (isNil "keyboard_keys") then {
|
||||
if (_ctrlState && !_altState) then {DZE_Z_ctrl = true;};
|
||||
};
|
||||
_autoRun = {
|
||||
if (!autoRunActive) then {
|
||||
autoRunActive = true;
|
||||
autoRunThread = [] spawn {
|
||||
while {autoRunActive} do {
|
||||
if ((player != vehicle player) or (surfaceIsWater (getPosASL player)) or r_fracture_legs) exitWith {call autoRunOff;};
|
||||
if (!dayz_autoRun) then {
|
||||
dayz_autoRun = true;
|
||||
dayz_autoRunThread = [] spawn {
|
||||
while {dayz_autoRun} do {
|
||||
// SurfaceIsWater does not work for ponds
|
||||
if (player != vehicle player or (surfaceIsWater getPosASL player) or (call fn_nearWaterHole) or r_fracture_legs) exitWith {
|
||||
call dayz_autoRunOff;
|
||||
};
|
||||
player playAction "FastF";
|
||||
uiSleep 0.5;
|
||||
};
|
||||
};
|
||||
} else {
|
||||
call autoRunOff;
|
||||
call dayz_autoRunOff;
|
||||
};
|
||||
_handled = true;
|
||||
};
|
||||
@@ -144,7 +147,7 @@ if (isNil "keyboard_keys") then {
|
||||
r_interrupt = true;
|
||||
};
|
||||
if (DZE_Surrender) then {call dze_surrender_off};
|
||||
if (autoRunActive) then {call autoRunOff;};
|
||||
if (dayz_autoRun) then {call dayz_autoRunOff;};
|
||||
};
|
||||
// TODO: left/right, when gear open: onKeyDown = "[_this,'onKeyDown',0,107,0,107] execVM '\z\addons\dayz_code\system\handleGear.sqf'";
|
||||
_noise = {
|
||||
|
||||
@@ -75,7 +75,7 @@ player setVariable ["inCombat", false, true];
|
||||
r_player_unconscious = false;
|
||||
r_player_cardiac = false;
|
||||
_model = typeOf player;
|
||||
autoRunActive = false;
|
||||
dayz_autoRun = false;
|
||||
|
||||
_array = _this;
|
||||
if (count _array > 0) then {
|
||||
|
||||
Reference in New Issue
Block a user