mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-13 19:52:38 +03:00
Prevent Zed + loot spawn in safezones
thanks BaroN for the idea
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
[UPDATED] Locking and unlocking safes now uses call instead of spawn on the server. This fixes the user input lock and safes appearing to disappear momentarily when server FPS is low.
|
||||
[UPDATED] Added cleanup of destroyed vehicles and CraterLong after 25 minutes in sched_corpses.sqf
|
||||
[UPDATED] Reverted group menu color scheme to A2OA default for consistency with game dialogs
|
||||
[UPDATED] Positions defined in DZE_SafeZonePosArray no longer spawn loot or zombies in their respective radius, added new compile to check positions against DZE_SafeZonePosArray "_PosInSafeZone = _positionToCheck call DZE_SafeZonePosCheck;"
|
||||
|
||||
[FIXED] Kamaz refuel trucks no longer allow automatic refueling. #1855 @coresync2k @dreamforceinc
|
||||
[FIXED] Trees at POIs can be chopped down now. Other trees spawned with createVehicle can be added to dayz_treeTypes in variables.sqf to allow chopping them down.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
private ["_array","_vehicle","_part","_hitpoint","_type","_isOK","_brokenPart","_cancel","_finished","_hasToolbox","_nameType","_namePart","_damage","_BreakableParts","_selection","_wpn","_classname","_ismelee"];
|
||||
private ["_array","_vehicle","_part","_hitpoint","_type","_isOK","_brokenPart","_finished","_hasToolbox","_nameType","_namePart","_damage","_BreakableParts","_selection","_wpn","_classname","_ismelee"];
|
||||
|
||||
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
|
||||
dayz_actionInProgress = true;
|
||||
@@ -11,7 +11,6 @@ _type = typeOf _vehicle;
|
||||
_isOK = false;
|
||||
_brokenPart = false;
|
||||
_hasToolbox = "ItemToolbox" in items player;
|
||||
_cancel = false;
|
||||
|
||||
_nameType = getText(configFile >> "cfgVehicles" >> _type >> "displayName");
|
||||
_namePart = getText(configFile >> "cfgMagazines" >> _part >> "displayName");
|
||||
@@ -21,10 +20,7 @@ s_player_repairActions = [];
|
||||
s_player_repair_crtl = 1;
|
||||
|
||||
if (_hasToolbox) then {
|
||||
{
|
||||
if ((_vehicle distance (_x select 0)) < (_x select 1)) exitWith {_cancel = true;};
|
||||
} count DZE_SafeZonePosArray;
|
||||
if (_cancel) exitWith { (localize "str_salvage_safezone") call dayz_rollingMessages;};
|
||||
if (_vehicle call DZE_SafeZonePosCheck) exitWith {(localize "str_salvage_safezone") call dayz_rollingMessages;};
|
||||
|
||||
[player,"repair",0,false] call dayz_zombieSpeak;
|
||||
[player,50,true,(getPosATL player)] call player_alertZombies;
|
||||
|
||||
@@ -39,27 +39,25 @@ if (_lootChance <= 0) exitWith {};
|
||||
_lootPos = getArray (_config >> "lootPos");
|
||||
_lootGroup = Loot_GetGroup(getText(_config >> "lootGroup"));
|
||||
|
||||
{
|
||||
//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 if no player is right next to it
|
||||
if (!(_this call DZE_SafeZonePosCheck)) then {
|
||||
{
|
||||
if ({isPlayer _x} count (_x nearEntities ["CAManBase",4]) == 0) then {
|
||||
deleteVehicle _x;
|
||||
dayz_currentWeaponHolders = dayz_currentWeaponHolders - 1;
|
||||
//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 if no player is right next to it
|
||||
{
|
||||
if ({isPlayer _x} count (_x nearEntities ["CAManBase",4]) == 0) then {
|
||||
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 (_worldPos nearObjects ["ReammoBox", 1]);
|
||||
|
||||
if (_lootChance > random 1 && {dayz_currentWeaponHolders < dayz_maxMaxWeaponHolders}) then
|
||||
{
|
||||
Loot_SpawnGroup(_lootGroup, _worldPos);
|
||||
};
|
||||
}
|
||||
foreach _lootPos;
|
||||
|
||||
} 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.
|
||||
@@ -68,24 +66,25 @@ if (isArray (_config >> "lootPosSmall")) then {
|
||||
_lootPos = getArray (_config >> "lootPosSmall");
|
||||
_lootGroup = Loot_GetGroup((getText(_config >> "lootGroup")) + "Small");
|
||||
if (_lootGroup >= 1) 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
|
||||
if (!(_this call DZE_SafeZonePosCheck)) then {
|
||||
{
|
||||
deleteVehicle _x;
|
||||
dayz_currentWeaponHolders = dayz_currentWeaponHolders - 1;
|
||||
}
|
||||
foreach (_worldPos nearObjects ["ReammoBox", 1]);
|
||||
//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 if no player is right next to it
|
||||
{
|
||||
if ({isPlayer _x} count (_x nearEntities ["CAManBase",4]) == 0) then {
|
||||
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")];
|
||||
};
|
||||
|
||||
@@ -33,12 +33,13 @@ if (_canLoot ) then {
|
||||
//Walking Zombies
|
||||
_num = (round(random _max)) max _min; // + round(_max / 3);
|
||||
//diag_log ("Class: " + _type + " / Zombies: " + str(_unitTypes) + " / Walking: " + str(_num));
|
||||
|
||||
for "_i" from 0 to _num do
|
||||
{
|
||||
//_iPos = _obj modelToWorld _originalPos;
|
||||
if ((_maxlocalspawned < _maxControlledZombies) and (dayz_CurrentNearByZombies < dayz_maxNearByZombies) and (dayz_currentGlobalZombies < dayz_maxGlobalZeds)) then {
|
||||
[_originalPos,true,_unitTypes,_wreck] call zombie_generate;
|
||||
if(!(_originalPos call DZE_SafeZonePosCheck)) then {
|
||||
for "_i" from 0 to _num do
|
||||
{
|
||||
//_iPos = _obj modelToWorld _originalPos;
|
||||
if ((_maxlocalspawned < _maxControlledZombies) and (dayz_CurrentNearByZombies < dayz_maxNearByZombies) and (dayz_currentGlobalZombies < dayz_maxGlobalZeds)) then {
|
||||
[_originalPos,true,_unitTypes,_wreck] call zombie_generate;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -51,7 +52,7 @@ if (_canLoot ) then {
|
||||
{
|
||||
_Pos = [_x select 0, _x select 1, 0];
|
||||
_rnd = random 1;
|
||||
if (_rnd < _zombieChance) then {
|
||||
if (_rnd < _zombieChance && {!(_Pos call DZE_SafeZonePosCheck)}) then {
|
||||
_iPos = _obj modelToWorld _Pos;
|
||||
_nearByZed = {alive _x} count (_iPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 10)]) > 0;
|
||||
_nearByPlayer = ({isPlayer _x} count (_iPos nearEntities ["CAManBase",30])) > 0;
|
||||
|
||||
@@ -108,9 +108,7 @@ if !(dayz_playerUID in DZE_PlotManagementAdmins) then {
|
||||
_buildCheck = call _checkClass;
|
||||
|
||||
if (_buildCheck select 0) then {
|
||||
{
|
||||
if ((player distance (_x select 0)) < _buildCheck select 1) exitWith {_canBuild = false;};
|
||||
} count DZE_safeZonePosArray;
|
||||
_canBuild = !((getPosATL player) call DZE_SafeZonePosCheck);
|
||||
};
|
||||
|
||||
if !(_canBuild) exitWith {dayz_actionInProgress = false; format [localize "STR_EPOCH_PLAYER_166",_text,_buildCheck select 1] call dayz_rollingMessages; [false, _isPole];};
|
||||
|
||||
@@ -12,7 +12,7 @@ while {_counter < _amount} do {
|
||||
_type = "swarm_newBase"; //"_unitTypes call BIS_fnc_selectRandom;
|
||||
//_type = "Pastor";
|
||||
_position = [position _player,50,100,0] call fn_selectRandomLocation;
|
||||
|
||||
if(_position call DZE_SafeZonePosCheck) exitWith {};
|
||||
_agent = createAgent [_type, _position, [], 0, "NONE"];
|
||||
|
||||
_agent setVariable["agentObjectSwarm",_agent,true];
|
||||
|
||||
@@ -62,11 +62,11 @@ _cantSee = {
|
||||
_skipFOV = false;
|
||||
|
||||
if ((_maxlocalspawned < _maxControlledZombies) && (dayz_CurrentNearByZombies < dayz_maxNearByZombies) && (dayz_currentGlobalZombies < dayz_maxGlobalZeds)) then {
|
||||
if (_bypass) then {
|
||||
if (_bypass) then {
|
||||
_skipFOV = true;
|
||||
_position = [_position,3,20,1] call fn_selectRandomLocation;
|
||||
};
|
||||
|
||||
if(_position call DZE_SafeZonePosCheck) exitWith {};
|
||||
if (surfaceIsWater _position) exitWith { diag_log "Location is in Water Abort"; };
|
||||
|
||||
if ((_skipFOV) or {([_position, 15, 10, 70] call _cantSee)}) then {
|
||||
|
||||
@@ -25,7 +25,7 @@ DZE_UI = "vanilla"; //"vanilla","epoch","dark" UI status icons style. Dark acco
|
||||
DZE_VanillaUICombatIcon = true; //Display or hide combat UI icon if using DZE_UI = "vanilla"; otherwise it has no affect.
|
||||
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_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]]; ALSO excludes positions from loot and zombie spawn, as well as salvage actions
|
||||
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.
|
||||
|
||||
@@ -845,3 +845,13 @@ dayz_engineSwitch = {
|
||||
publicVariableServer "PVDZ_send";
|
||||
};
|
||||
};
|
||||
|
||||
DZE_SafeZonePosCheck = {
|
||||
private ["_position","_skipPos"];
|
||||
_position = _this;
|
||||
_skipPos = false;
|
||||
{
|
||||
if ((_position distance (_x select 0)) < (_x select 1)) exitWith {_skipPos = true;};
|
||||
} forEach DZE_SafeZonePosArray;
|
||||
_skipPos;
|
||||
};
|
||||
|
||||
@@ -17,7 +17,7 @@ while {_counter < _amount} do {
|
||||
_method = "CAN_COLLIDE";
|
||||
|
||||
_position = [getMarkerPos "center",1,6500,1] call fn_selectRandomLocation;
|
||||
|
||||
if(_position call DZE_SafeZonePosCheck) exitWith {};
|
||||
//Create Zed
|
||||
_agent = createAgent [_type, _position, [], 1, _method];
|
||||
//Set Random Direction
|
||||
|
||||
Reference in New Issue
Block a user