Stop autoRun and remove drink from hands at ponds #1827

Fixes #1827
This commit is contained in:
ebaydayz
2016-12-22 21:52:22 -05:00
parent f1b991acd2
commit 4d3f707417
12 changed files with 74 additions and 34 deletions

View File

@@ -0,0 +1,19 @@
class Land_pumpa: House
{
class UserActions
{
class Drink
{
displayName = $STR_ACTIONS_DRINK2;
displayNameDefault = $STR_ACTIONS_DRINK2;
priority = 3;
radius = 3;
position = "";
showWindow = 1;
onlyForPlayer = 1;
shortcut = "";
condition = "(['Drink',this] call userActionConditions)";
statement = "'hands' spawn player_drinkWater;";
};
};
};

View File

@@ -578,6 +578,7 @@ class CfgVehicles {
#include "Buildings\Land_telek1.hpp"
#include "Buildings\Land_VASICore.hpp"
#include "Buildings\Land_Vysilac_FM.hpp"
#include "Buildings\Land_pumpa.hpp"
//Duplicates of Epoch items in DZE\Prop_Defs.hpp
//#include "CamoNetting.hpp"

View File

@@ -10,11 +10,12 @@ _action = _this select 0;
_object = _this select 1;
_show = switch _action do {
case "StudyBody": {!IS_ALIVE};
case "Butcher": {!IS_ALIVE && !IN_VEHICLE && CAN_DO && !(_object getVariable["meatHarvested",false]) && !IS_PZOMBIE};
case "Drink": {!IN_VEHICLE && CAN_DO && !dayz_isSwimming};
case "PushPlane": {IS_ALIVE && !IN_VEHICLE && CAN_DO && count crew _object == 0 && !isEngineOn _object && !IS_PZOMBIE};
//case "Repair": {IS_ALIVE && !IN_VEHICLE && CAN_DO && _object != dayz_myCursorTarget && HAS_TOOLBOX};
//case "Salvage": {IS_ALIVE && !IN_VEHICLE && CAN_DO && _object != dayz_myCursorTarget && HAS_TOOLBOX && (DZE_salvageLocked or !locked _object)};
case "StudyBody": {!IS_ALIVE};
default {false};
};

View 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

View File

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

View File

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

View File

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

View File

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

View File

@@ -17,6 +17,7 @@ if (!isDedicated) then {
call compile preprocessFileLineNumbers "\z\addons\dayz_code\loot\compile.sqf";
fn_dropItem = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_dropItem.sqf"; //fnc to drop items. _item call fn_dropItem;
fn_nearWaterHole = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_nearWaterHole.sqf";
BIS_Effects_Burn = compile preprocessFile "\ca\Data\ParticleEffects\SCRIPTS\destruction\burn.sqf";
player_zombieCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieCheck.sqf"; //Run on a players computer, checks if the player is near a zombie
player_zombieAttack = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieAttack.sqf"; //Run on a players computer, causes a nearby zombie to attack them
@@ -155,7 +156,7 @@ if (!isDedicated) then {
player_checkRecipe = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_checkRecipe.sqf";
// EPOCH ADDITIONS
autoRunOff = {autoRunActive = false; terminate autoRunThread; player playActionNow "Stop";};
dayz_autoRunOff = {dayz_autoRun = false; terminate dayz_autoRunThread; player playActionNow "Stop";};
dog_findTargetAgent = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\dog_findTargetAgent.sqf";
dze_filterCheats = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_filterCheats.sqf";
dze_isnearest_player = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\dze_isNearestPlayer.sqf";

View File

@@ -693,7 +693,7 @@ if (!isDedicated) then {
if (isNil "DZE_requireplot") then {DZE_requireplot = 1;};
if (isNil "DZE_StaticConstructionCount") then {DZE_StaticConstructionCount = 0;};
if (toLower DZE_DeathMsgChat in ["global","side"]) then {enableRadio true;}; //Needed for scripted global chat to show, doesn't seem to have any adverse effects
autoRunActive = false;
dayz_autoRun = false;
DZE_AntiWallCounter = 0;
DZE_myHaloVehicle = objNull;
dayz_myLiftVehicle = objNull;