Add the shelter state to the player

Bases count as a secure area now. This means it will not rain through a base any longer. Also the temperature will not drop when you are inside of your base. This also affects snow, blizzards and evr storms.

Made by @Victor-the-Cleaner
This commit is contained in:
A Man
2022-05-18 18:25:25 +02:00
parent 2ebe0d6552
commit 8071602dd7
6 changed files with 284 additions and 144 deletions

View File

@@ -3,35 +3,39 @@
Credit to Sentinel for NIM Weather Effects.
*/
private [ "_i","_pos","_dpos","_windX","_windY","_windZ","_fogOriginal","_windspd","_winddir","_vel","_t"];
local _fogOriginal = _this;
local _windspd = 15;
local _winddir = random 360;
local _windX = _windspd * (sin _winddir);
local _windY = _windspd * (cos _winddir);
local _windZ = 5 - (random 10);
local _t = diag_tickTime;
_fogOriginal = _this;
_windspd = 15;
_winddir = random 360;
_windX = _windspd * (sin _winddir);
_windY = _windspd * (cos _winddir);
_windZ = 5 - (random 10);
snow = 1;
_t = diag_tickTime;
local _isInside = {
local _inside = (dayz_inside || (DZE_roofOverhead && {DZE_sheltered > 0.73}));
_inside
};
// If the player is inside a building play the low volume version of the blizzard sound effect.
playsound (["blizzard","blizzardLow"] select dayz_inside);
playSound (["blizzard","blizzardLow"] select (call _isInside));
if !(isNil "DZE_WeatherDebugTime") then {diag_log format ["Blizzard started at %1",(diag_tickTime - DZE_WeatherDebugTime)];};
while {!DZE_WeatherEndThread} do {
_pos = getPos vehicle player;
_vel = velocity vehicle player;
_i = 0;
local _pos = getPos vehicle player;
local _vel = velocity vehicle player;
local _i = 0;
if (diag_tickTime - _t >= 10) then {
playsound (["blizzard","blizzardLow"] select dayz_inside);
playSound (["blizzard","blizzardLow"] select (call _isInside));
_t = diag_tickTime;
};
if (!dayz_inside) then {
if !(call _isInside) then {
while {_i < 25} do {
_dpos = [((_pos select 0) + (25 - (random (2*25))) + ((_vel select 0)*6)) - (_windX),((_pos select 1) + (25 - (random (2*25))) + ((_vel select 1)*6)) - (_windY),((_pos select 2) + 3)];
local _dpos = [((_pos select 0) + (25 - (random (2*25))) + ((_vel select 0)*6)) - (_windX),((_pos select 1) + (25 - (random (2*25))) + ((_vel select 1)*6)) - (_windY),((_pos select 2) + 3)];
// Snow Particles
drop ["\ca\data\cl_water", "", "Billboard", 1, 6, _dpos, [_windX/2,_windY/2,-1], 1, 1.275, 1, (random .01), [0.05], [[1,1,1,1]], [0,0], 0.2, 1.2, "", "", ""];
_i = _i + 1;
@@ -39,7 +43,7 @@ while {!DZE_WeatherEndThread} do {
// Cloud particles
drop ["\ca\data\cl_basic", "", "Billboard", 0.2, 5, [(_pos select 0) + (75 - (random (2*75))) + (_vel select 0)*4 - _windX,(_pos select 1) + (75 - (random (2*75))) + (_vel select 1)*4 - _windY,(_pos select 2) + 10], [_windX,_windY,_windZ], 10, 1.275, 1, (random .01), [35,60], [[0.95,0.95,0.95,0],[0.95,0.95,0.95,0.4],[0.95,0.95,0.95,0.4],[0.95,0.95,0.95,0.4],[0.95,0.95,0.95,0]], [0,0], 0, 0, "", "",""];
};
uiSleep 0.001;
uiSleep 0.01;
};
0 setFog _fogOriginal; // Reset fog to original.

View File

@@ -4,26 +4,23 @@
Credit to Karel Moricky for particle array definitions in "modules_e/Weather/data/fsms/particle.fsm"
*/
private ["_density","_i","_d","_h","_pos","_dpos","_vel"];
_density = _this;
if (_density > 1) then {_density = 1;};
local _density = _this min 1;
_density = round (25 * _density);
_d = 35;
_h = 15;
local _d = 35;
local _h = 15;
snow = 1;
if !(isNil "DZE_WeatherDebugTime") then {diag_log format ["Snowfall started at %1",(diag_tickTime - DZE_WeatherDebugTime)];};
while {!DZE_WeatherEndThread} do {
uiSleep .01;
_pos = getPos vehicle player;
_vel = velocity vehicle player;
_i = 0;
uiSleep 0.01;
local _pos = getPos vehicle player;
local _vel = velocity vehicle player;
local _i = 0;
if !(dayz_inside) then {
if !(dayz_inside || (DZE_roofOverhead && {DZE_sheltered > 0.73})) then {
while {_i < _density} do {
_dpos = [((_pos select 0) + (_d - (random (2 * _d))) + ((_vel select 0) * 6)), ((_pos select 1) + (_d - (random (2 * _d))) + ((_vel select 1) * 6)), ((_pos select 2) + 15)];
local _dpos = [((_pos select 0) + (_d - (random (2 * _d))) + ((_vel select 0) * 6)), ((_pos select 1) + (_d - (random (2 * _d))) + ((_vel select 1) * 6)), ((_pos select 2) + 15)];
drop [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 12, 8, 1],"","Billboard",1,10,_dpos,[0,0,0],1,0.000001,0,1.1,[0.09,0.09],[[1,1,1,1]],[0,1],0.2,1.2,"","",""];
_i = _i + 1;
};