mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-13 19:52:38 +03:00
Convert DZE_SafeZoneNoBuildItems to handle nested arrays for custom d… (#1934)
* Convert DZE_SafeZoneNoBuildItems to handle nested arrays for custom distances per items. This makes the DZE_SafeZoneNoBuildItems be able to handle nested arrays, This allows you to set custom distances per item instead of having it all the default distance. E.g DZE_SafeZoneNoBuildItems = ["VaultStorageLocked","LockboxStorageLocked",["Plastic_Pole_EP1_DZ",1300]]; * Fix forgotten exitWith syntax. * Removed unneeded check.
This commit is contained in:
@@ -12,6 +12,25 @@ if (!canbuild) exitWith {dayz_actionInProgress = false; format[localize "STR_EPO
|
||||
if (isNumber (configFile >> "CfgVehicles" >> _classname >> "requireplot")) then {
|
||||
_requireplot = getNumber(configFile >> "CfgVehicles" >> _classname >> "requireplot");
|
||||
};
|
||||
|
||||
_checkClass = {
|
||||
private ["_checkOK","_distance"];
|
||||
|
||||
_checkOK = false;
|
||||
_distance = DZE_SafeZoneNoBuildDistance;
|
||||
|
||||
{
|
||||
if (typeName _x == "ARRAY") then {
|
||||
if (_x select 0 == _classname) then {_checkOK = true; _distance = _x select 1;};
|
||||
} else {
|
||||
if (_x == _className) then {_checkOK = true};
|
||||
};
|
||||
if (_checkOK) exitWith {};
|
||||
} count DZE_SafeZoneNoBuildItems;
|
||||
|
||||
[_checkOK,_distance]
|
||||
};
|
||||
|
||||
_isPole = (_classname == "Plastic_Pole_EP1_DZ");
|
||||
_isLandFireDZ = (_classname == "Land_Fire_DZ");
|
||||
|
||||
@@ -85,13 +104,15 @@ if ((count (nearestObjects [_center,_buildables,_distance])) >= DZE_BuildingLimi
|
||||
|
||||
_text = getText (configFile >> 'CfgMagazines' >> _item >> 'displayName');
|
||||
|
||||
if (((count DZE_SafeZoneNoBuildItems) > 0) && {_classname in DZE_SafeZoneNoBuildItems}) then {
|
||||
_buildCheck = call _checkClass;
|
||||
|
||||
if (_buildCheck select 0) then {
|
||||
{
|
||||
if ((player distance (_x select 0)) < DZE_SafeZoneNoBuildDistance) exitWith { _canBuild = false; };
|
||||
} forEach DZE_safeZonePosArray;
|
||||
if ((player distance (_x select 0)) < _buildCheck select 1) exitWith {_canBuild = false;};
|
||||
} count DZE_safeZonePosArray;
|
||||
};
|
||||
|
||||
if !(_canBuild) exitWith { dayz_actionInProgress = false; format [localize "STR_EPOCH_PLAYER_166",_text,DZE_SafeZoneNoBuildDistance] call dayz_rollingMessages; [false, _isPole]; };
|
||||
if !(_canBuild) exitWith {dayz_actionInProgress = false; format [localize "STR_EPOCH_PLAYER_166",_text,_buildCheck select 1] call dayz_rollingMessages; [false, _isPole];};
|
||||
|
||||
if ((count DZE_NoBuildNear) > 0) then {
|
||||
_near = (nearestObjects [_pos,DZE_NoBuildNear,DZE_NoBuildNearDistance]);
|
||||
|
||||
@@ -26,7 +26,7 @@ DZE_VanillaUICombatIcon = true; //Display or hide combat UI icon if using DZE_UI
|
||||
timezoneswitch = 0; // Changes murderMenu times with this offset in hours.
|
||||
DZE_NoVehicleExplosions = false; //Disable vehicle explosions to prevent damage to objects by ramming. Doesn't work with amphibious pook which should not be used due to FPS issues.
|
||||
DZE_SafeZonePosArray = []; //Prevent players in safeZones from being killed if their vehicle is destroyed. Format is [[[3D POS], RADIUS],[[3D POS], RADIUS]]; Ex. DZE_SafeZonePosArray = [[[6325.6772,7807.7412,0],150],[[4063.4226,11664.19,0],150]];
|
||||
DZE_SafeZoneNoBuildItems = []; // Array of object class names not allowed to build near the safe zones listed above. i.e ["VaultStorageLocked","LockboxStorageLocked","Plastic_Pole_EP1_DZ"] etc.
|
||||
DZE_SafeZoneNoBuildItems = []; // Array of object class names not allowed to be built near the safe zones listed above. Can be nested arrays for custom distances. i.e ["VaultStorageLocked","LockboxStorageLocked",["Plastic_Pole_EP1_DZ",1300]] etc.
|
||||
DZE_SafeZoneNoBuildDistance = 150; // Distance from safe zones listed above to disallow building near.
|
||||
DZE_NoBuildNear = []; //Array of object class names that are blacklisted to build near. i.e ["Land_Mil_ControlTower","Land_SS_hangar"] etc.
|
||||
DZE_NoBuildNearDistance = 150; // Distance from blacklisted objects to disallow building near.
|
||||
|
||||
Reference in New Issue
Block a user