From 4953f33fdbe87e0077f404b20246e43de08f67e2 Mon Sep 17 00:00:00 2001 From: ebayShopper Date: Fri, 17 Nov 2017 17:47:28 -0500 Subject: [PATCH] Add configurable loot refresh timer Vanilla commits: https://github.com/DayZMod/DayZ/commit/2eb963dc3f381ece6496c129fa42b4b0b1baa90c https://github.com/DayZMod/DayZ/commit/657aaba83a60c6c8c69563e8e949a58861aab57c --- CHANGE LOG 1.0.6.2.txt | 1 + .../Configs/CfgLoot/Buildings/Military.hpp | 62 +++++++++---------- .../Configs/CfgLoot/Buildings/Residential.hpp | 2 +- SQF/dayz_code/Configs/CfgLoot/CfgLoot.hpp | 3 +- SQF/dayz_code/compile/player_spawnCheck.sqf | 11 ++-- 5 files changed, 41 insertions(+), 38 deletions(-) diff --git a/CHANGE LOG 1.0.6.2.txt b/CHANGE LOG 1.0.6.2.txt index 3a407a35a..46d6f5d12 100644 --- a/CHANGE LOG 1.0.6.2.txt +++ b/CHANGE LOG 1.0.6.2.txt @@ -11,6 +11,7 @@ [NEW] Added basic server-side authentication to hive object creation/deletion for improved security. Affects Server_(DeleteObj|PublishObj|PublishVeh|SwapObj|UpdateObject), admins and script makers should review the changes if using PVDZ_obj_(Destroy|Publish), PVDZ_veh_Save, PVDZE_obj_Swap, PVDZE_veh_(Publish|Upgrade) or server_deleteObj and verify custom code is compliant with these changes (github.com/EpochModTeam/DayZ-Epoch/commit/42e0047) [NEW] BAF_L85A2_RIS_TWS_DZ to emulate the old behavior of the now NV only BAF_L85A2_RIS_CWS. Server owners must add the weapon on their own #1983 [NEW] Admins can now define a maximum build height, see configVariables.sqf/DZE_BuildHeightLimit. @BigEgg17 +[NEW] Admins can now change the lootRefreshTimer for each building type from the default 15 minutes. CfgLoot.hpp must be updated if using custom loot tables. [UPDATED] Loot and zed spawn is now disabled in trader cities by default. This is configurable in mission\init.sqf via DZE_SafeZonePosArray. Added function to check positions against DZE_SafeZonePosArray "_PosInSafeZone = _positionToCheck call DZE_SafeZonePosCheck;" [UPDATED] Zombie pathing. Zeds should now run more direct to players. diff --git a/SQF/dayz_code/Configs/CfgLoot/Buildings/Military.hpp b/SQF/dayz_code/Configs/CfgLoot/Buildings/Military.hpp index 99ef7982c..3ba4b4ca4 100644 --- a/SQF/dayz_code/Configs/CfgLoot/Buildings/Military.hpp +++ b/SQF/dayz_code/Configs/CfgLoot/Buildings/Military.hpp @@ -407,6 +407,37 @@ class Land_AII_upper_part: Military lootPos[] = {{-0.616211, -3.80762, -2.31434}, {-2.62158, -1.05127, -2.32196}, {-2.30322, 2.0415, -2.32196}}; }; +class Land_Mil_Guardhouse_EP1: Military //Not enterable, Takistan version +{ + zombieClass[] = + { + "z_soldier", + "z_soldier", + "z_policeman" + }; + lootPos[] = {{-3.05859,1.76514,-1.59003},{-3.16895,3.45361,-1.59003},{-3.19922,-0.323242,-1.59003}}; +}; + +class Land_Mil_Guardhouse: Military //Enterable zero_building +{ + zombieClass[] = + { + "z_soldier", + "z_soldier", + "z_policeman" + }; + lootChance = 0.5; + maxRoaming = 3; + zedPos[] = {{-2.44727,0.250977,-1.70563},{-2.44873,3.00293,-1.70285}}; + lootPos[] = { + //{-2.44727,0.250977,-1.70563},{-2.44873,3.00293,-1.70285} + {4.65381,-3.61914,-1.46277},{2.99756,3.54102,-0.712769} + }; + lootPosSmall[] = { + {-0.798828,-3.51758,-1.46277},{3.73047,-3.95996,-1.32278},{-0.283203,-3.15723,-1.32278},{-0.996582,3.81445,-1.14279},{-1.33008,2.26563,-0.762787},{0.289063,3.66211,-0.0827942},{-1.17383,-0.112305,-1.48279} + }; +}; + //DZE ADDED BELOW class land_vstup: Military { lootPos[] = {{-11.51,-2.64844,-1.53312},{-6.24463,-2.85059,-1.53312},{-1.16992,-2.84961,-1.53312},{2.70898,-2.85059,-1.53312}}; @@ -483,16 +514,6 @@ class Land_vez: Military lootPos[] = {{-0.0585938,1.51367,1.36331}}; zedPos[] = {{-0.116699,-0.801758,-2.81857}}; }; -class Land_Mil_Guardhouse_EP1: Military -{ - zombieClass[] = - { - "z_soldier", - "z_soldier", - "z_policeman" - }; - lootPos[] = {{-3.05859,1.76514,-1.59003},{-3.16895,3.45361,-1.59003},{-3.19922,-0.323242,-1.59003}}; -}; class Land_fortified_nest_big_EP1: Military { lootPos[] = { @@ -519,27 +540,6 @@ class HMMWVWreck: Military maxRoaming = 2; lootPos[] = {}; }; - -class Land_Mil_Guardhouse: Military //MOVED FROM RESIDENTIAL -{ - zombieClass[] = - { - "z_soldier", - "z_soldier", - "z_policeman" - }; - lootChance = 0.5; - maxRoaming = 3; - zedPos[] = {{-2.44727,0.250977,-1.70563},{-2.44873,3.00293,-1.70285}}; - lootPos[] = { - //{-2.44727,0.250977,-1.70563},{-2.44873,3.00293,-1.70285} - {4.65381,-3.61914,-1.46277},{2.99756,3.54102,-0.712769} - }; - lootPosSmall[] = { - {-0.798828,-3.51758,-1.46277},{3.73047,-3.95996,-1.32278},{-0.283203,-3.15723,-1.32278},{-0.996582,3.81445,-1.14279},{-1.33008,2.26563,-0.762787},{0.289063,3.66211,-0.0827942},{-1.17383,-0.112305,-1.48279} - }; -}; - class UH60_NAVY_Wreck_DZ: Military { zombieClass[] = {"z_soldier_pilot","z_soldier_heavy"}; zombieChance = 0.3; diff --git a/SQF/dayz_code/Configs/CfgLoot/Buildings/Residential.hpp b/SQF/dayz_code/Configs/CfgLoot/Buildings/Residential.hpp index 1bb5ab230..0d94301a9 100644 --- a/SQF/dayz_code/Configs/CfgLoot/Buildings/Residential.hpp +++ b/SQF/dayz_code/Configs/CfgLoot/Buildings/Residential.hpp @@ -706,7 +706,7 @@ class Land_House_K_6_EP1: Residential // tak 3 story cement open door red blanke { lootPos[] = {{2.36108,1.41309,-1.60797},{-2.57178,1.42285,-1.59425},{-4.81445,2.98193,1.48639},{-0.123047,3.83203,1.47144},{2.7063,0.193359,4.42145},{-4.3584,-2.99609,4.33153},{-0.0888672,3.0293,4.42143},{2.10864,0.180664,1.47076},{-4.10083,-2.09082,1.55551}}; }; -//Land_Mil_Guardhouse_EP1 in Military.hpp + //land_seb_bouda3 in Industrial.hpp class land_seb_mine_maringotka: Residential { // Nm lootPos[] = {{0.423828,0.721191,-0.612675},{-0.976563,-1.32764,-0.612675}}; diff --git a/SQF/dayz_code/Configs/CfgLoot/CfgLoot.hpp b/SQF/dayz_code/Configs/CfgLoot/CfgLoot.hpp index 928e2ef6d..c4cfb2209 100644 --- a/SQF/dayz_code/Configs/CfgLoot/CfgLoot.hpp +++ b/SQF/dayz_code/Configs/CfgLoot/CfgLoot.hpp @@ -108,6 +108,7 @@ class CfgLoot }; lootChance = 0; + lootRefreshTimer = 900; lootGroup = ""; lootPos[] = {}; }; @@ -115,4 +116,4 @@ class CfgLoot // Buildings #include "CfgBuildingPos.hpp" }; -}; +}; \ No newline at end of file diff --git a/SQF/dayz_code/compile/player_spawnCheck.sqf b/SQF/dayz_code/compile/player_spawnCheck.sqf index 2944e4c59..7dd986a97 100644 --- a/SQF/dayz_code/compile/player_spawnCheck.sqf +++ b/SQF/dayz_code/compile/player_spawnCheck.sqf @@ -1,7 +1,7 @@ private ["_isWreck","_maxControlledZombies","_looted","_zombied","_doNothing","_spawnZedRadius","_serverTime","_age","_nearbyBuildings","_position","_speed","_radius","_maxlocalspawned","_maxWeaponHolders","_currentWeaponHolders","_maxtoCreate","_inVehicle","_isAir","_isLand","_isSea","_Controlledzeddivided","_totalcrew","_nearby","_type","_config","_canSpawn","_dis","_checkLoot","_islocal","_bPos","_zombiesNum"]; _age = -1; //_nearbyBuildings = []; -_position = [player] call FNC_GetPos; +_position = [player] call fnc_getPos; _speed = speed (vehicle player); _radius = 200; //150*0.707; Pointless Processing (106.5) _spawnZedRadius = 20; @@ -122,12 +122,13 @@ if (_maxlocalspawned > 0) then { _spawnZedRadius = _spawnZedRadius * 3; }; //Loot if (getNumber(_config >> "lootChance") > 0) then { if (_currentWeaponHolders < _maxWeaponHolders) then { - //Baisc loot check + //Basic loot check if ((_dis < 125) and (_dis > 30) and !_inVehicle and _checkLoot) then { _serverTime = serverTime; _looted = (_x getVariable ["looted",_serverTime]); _age = _serverTime - _looted; - if ((_age == 0) or (_age > 900)) then { + //Building refresh rate + if (_age == 0 or (_age > getNumber(_config >> "lootRefreshTimer"))) then { _x setVariable ["looted",_serverTime,!_islocal]; _x call building_spawnLoot; if (!(_x in dayz_buildingBubbleMonitor)) then { @@ -152,7 +153,7 @@ if (_maxlocalspawned > 0) then { _spawnZedRadius = _spawnZedRadius * 3; }; if (!_isWreck) then { if ((dayz_spawnZombies < _maxControlledZombies) and (dayz_CurrentNearByZombies < dayz_maxNearByZombies) and (dayz_currentGlobalZombies < dayz_maxGlobalZeds)) then { _bPos = getPosATL _x; - _zombiesNum = {alive _x} count (_bPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 10)]); + _zombiesNum = count (_bPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 10)]); if (_zombiesNum == 0) then { _x setVariable ["zombieSpawn",_serverTime,!_islocal]; @@ -169,7 +170,7 @@ if (_maxlocalspawned > 0) then { _spawnZedRadius = _spawnZedRadius * 3; }; }; } else { _bPos = getPosATL _x; - _zombiesNum = {alive _x} count (_bPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 30)]); + _zombiesNum = count (_bPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 30)]); //Should be a wreck if (_zombiesNum == 0) then { [_x,_isWreck] call building_spawnZombies; }; };