From 23b1710d7c62beb68d5f2b595157a8b450051ac5 Mon Sep 17 00:00:00 2001 From: vbawol Date: Thu, 24 Aug 2017 10:22:13 -0500 Subject: [PATCH] test out of bounds checks added _isOnFoot var to init that refreshes with event1 every second and is reused in any events --- .../epoch_code/compile/setup/masterLoop/Event1.sqf | 3 ++- .../epoch_code/compile/setup/masterLoop/Event5.sqf | 13 ++++++++++++- .../epoch_code/compile/setup/masterLoop/init.sqf | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Sources/epoch_code/compile/setup/masterLoop/Event1.sqf b/Sources/epoch_code/compile/setup/masterLoop/Event1.sqf index e1afb736..ae40d2ee 100644 --- a/Sources/epoch_code/compile/setup/masterLoop/Event1.sqf +++ b/Sources/epoch_code/compile/setup/masterLoop/Event1.sqf @@ -131,7 +131,8 @@ if (_forceBloodRise) then { }; // check if player On Foot -if (isNull objectParent player) then { +_isOnFoot = isNull objectParent player; +if (_isOnFoot) then { _val = log(abs(speed player)); _staminaThreshold = [0.7,0.3] select EPOCH_playerIsSwimming; if (_val > _staminaThreshold) then { diff --git a/Sources/epoch_code/compile/setup/masterLoop/Event5.sqf b/Sources/epoch_code/compile/setup/masterLoop/Event5.sqf index ad4fb75a..726580a3 100644 --- a/Sources/epoch_code/compile/setup/masterLoop/Event5.sqf +++ b/Sources/epoch_code/compile/setup/masterLoop/Event5.sqf @@ -1,5 +1,16 @@ _position = getPosATL player; +// check if player is out of map bounds. +_worldSize = worldSize/2; +_outOfBounds = !(player inArea [[_worldSize,_worldSize,0], _worldSize, _worldSize, 0, true ]); +if (_outOfBounds) then { + ["You are out of the play area!", 5] call Epoch_message; + +} else { + // do in bounds radiation checks here. + +}; + EPOCH_nearestLocations = nearestLocations[player, ["NameCityCapital", "NameCity", "Airport"], 300]; EPOCH_playerIsSwimming = false; @@ -12,7 +23,7 @@ if !(surfaceIsWater _position) then { }; } else { // spawn shark if player is deep water and not in vehicle - if (vehicle player == player) then{ + if !(_isOnFoot) then{ _offsetZ = ((_position vectorDiff getPosASL player) select 2); EPOCH_playerIsSwimming = (_offsetZ > 1.7); if (_offsetZ > 50) then { diff --git a/Sources/epoch_code/compile/setup/masterLoop/init.sqf b/Sources/epoch_code/compile/setup/masterLoop/init.sqf index 1b4f26aa..5d9fad49 100644 --- a/Sources/epoch_code/compile/setup/masterLoop/init.sqf +++ b/Sources/epoch_code/compile/setup/masterLoop/init.sqf @@ -18,6 +18,7 @@ if (isNil "EPOCH_display_setup_complete") then { _prevEquippedItem = []; _damagePlayer = damage player; +_isOnFoot = isNull objectParent player; _panic = false; _prevEnergy = EPOCH_playerEnergy;