Configure DZE_SafeZonePosArray by default

Zeds and loot should not spawn in trader cities by default, regardless
of whether the server uses safe zones.

For servers that do not use safezones, the only other things affected
are salvage and instant kill for vehicle explosions in trader cities.
Neither is a significant issue. Most servers use safezones anyway.

Following d750f57, changed to exitWith so the check is only called once
instead of multiple times. Also no need to call again in
zombie_generate, since that function is only called by
building_spawnZombies which already checks it.
This commit is contained in:
ebayShopper
2017-11-09 13:52:32 -05:00
parent 89d10fc973
commit ac32a8b2cd
30 changed files with 72 additions and 48 deletions

View File

@@ -34,28 +34,30 @@ if (!isClass _config) exitWith {};
_lootChance = getNumber (_config >> "lootChance");
if (_lootChance <= 0) exitWith {};
if (_lootChance <= 0 or ([_this] call DZE_SafeZonePosCheck)) exitWith {};
_lootPos = getArray (_config >> "lootPos");
_lootGroup = Loot_GetGroup(getText(_config >> "lootGroup"));
if (!([_this] call DZE_SafeZonePosCheck)) then {
{
//Get the world position of the spawn position
_worldPos = _this modelToWorld _x;
_worldPos set [2, 0 max (_worldPos select 2)];
//Delete existing lootpiles within 1m of spawn location
{
//Get the world position of the spawn position
_worldPos = _this modelToWorld _x;
_worldPos set [2, 0 max (_worldPos select 2)];
//Delete existing lootpiles within 1m of spawn location
{
deleteVehicle _x;
dayz_currentWeaponHolders = dayz_currentWeaponHolders - 1;
} foreach (_worldPos nearObjects ["ReammoBox", 1]);
deleteVehicle _x;
dayz_currentWeaponHolders = dayz_currentWeaponHolders - 1;
}
foreach (_worldPos nearObjects ["ReammoBox", 1]);
if (_lootChance > random 1 && {dayz_currentWeaponHolders < dayz_maxMaxWeaponHolders}) then
{
Loot_SpawnGroup(_lootGroup, _worldPos);
};
}
foreach _lootPos;
if (_lootChance > random 1 && {dayz_currentWeaponHolders < dayz_maxMaxWeaponHolders}) then
{
Loot_SpawnGroup(_lootGroup, _worldPos);
};
} foreach _lootPos;
};
// EPOCH ADDITION
// lootPosSmall are additional positions in lockers, on shelves, etc. for small objects only.
// Example: soda cans, small ammo, pistols, bandage, etc.
@@ -64,24 +66,22 @@ if (isArray (_config >> "lootPosSmall")) then {
_lootPos = getArray (_config >> "lootPosSmall");
_lootGroup = Loot_GetGroup((getText(_config >> "lootGroup")) + "Small");
if (_lootGroup >= 1) then {
if (!([_this] call DZE_SafeZonePosCheck)) then {
{
//Get the world position of the spawn position
_worldPos = _this modelToWorld _x;
_worldPos set [2, 0 max (_worldPos select 2)];
//Delete existing lootpiles within 1m of spawn location
{
//Get the world position of the spawn position
_worldPos = _this modelToWorld _x;
_worldPos set [2, 0 max (_worldPos select 2)];
//Delete existing lootpiles within 1m of spawn location
{
deleteVehicle _x;
dayz_currentWeaponHolders = dayz_currentWeaponHolders - 1;
} foreach (_worldPos nearObjects ["ReammoBox", 1]);
deleteVehicle _x;
dayz_currentWeaponHolders = dayz_currentWeaponHolders - 1;
} foreach (_worldPos nearObjects ["ReammoBox", 1]);
if (_lootChance > random 1 && {dayz_currentWeaponHolders < dayz_maxMaxWeaponHolders}) then
{
Loot_SpawnGroup(_lootGroup, _worldPos);
};
} foreach _lootPos;
};
if (_lootChance > random 1 && {dayz_currentWeaponHolders < dayz_maxMaxWeaponHolders}) then
{
Loot_SpawnGroup(_lootGroup, _worldPos);
};
} foreach _lootPos;
} else {
diag_log format["Loot group small: %1 does not exist", ((getText(_config >> "lootGroup")) + "Small")];
};
};
};