Merge pull request #1987 from oiad/patch-1

Alter DZE_SafeZonePosCheck to allow custom radii
This commit is contained in:
icomrade
2017-10-05 09:58:03 -04:00
committed by GitHub
6 changed files with 13 additions and 12 deletions

View File

@@ -20,7 +20,7 @@ s_player_repairActions = [];
s_player_repair_crtl = 1; s_player_repair_crtl = 1;
if (_hasToolbox) then { if (_hasToolbox) then {
if (_vehicle call DZE_SafeZonePosCheck) 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,"repair",0,false] call dayz_zombieSpeak;
[player,50,true,(getPosATL player)] call player_alertZombies; [player,50,true,(getPosATL player)] call player_alertZombies;
@@ -83,4 +83,4 @@ _wpn = primaryWeapon player;
_ismelee = (getNumber (configFile >> "CfgWeapons" >> _wpn >> "melee") == 1); _ismelee = (getNumber (configFile >> "CfgWeapons" >> _wpn >> "melee") == 1);
if (_ismelee) then { if (_ismelee) then {
call dayz_meleeMagazineCheck; call dayz_meleeMagazineCheck;
}; };

View File

@@ -39,7 +39,7 @@ if (_lootChance <= 0) exitWith {};
_lootPos = getArray (_config >> "lootPos"); _lootPos = getArray (_config >> "lootPos");
_lootGroup = Loot_GetGroup(getText(_config >> "lootGroup")); _lootGroup = Loot_GetGroup(getText(_config >> "lootGroup"));
if (!(_this call DZE_SafeZonePosCheck)) then { if (!([_this] call DZE_SafeZonePosCheck)) then {
{ {
//Get the world position of the spawn position //Get the world position of the spawn position
_worldPos = _this modelToWorld _x; _worldPos = _this modelToWorld _x;
@@ -64,7 +64,7 @@ if (isArray (_config >> "lootPosSmall")) then {
_lootPos = getArray (_config >> "lootPosSmall"); _lootPos = getArray (_config >> "lootPosSmall");
_lootGroup = Loot_GetGroup((getText(_config >> "lootGroup")) + "Small"); _lootGroup = Loot_GetGroup((getText(_config >> "lootGroup")) + "Small");
if (_lootGroup >= 1) then { if (_lootGroup >= 1) then {
if (!(_this call DZE_SafeZonePosCheck)) then { if (!([_this] call DZE_SafeZonePosCheck)) then {
{ {
//Get the world position of the spawn position //Get the world position of the spawn position
_worldPos = _this modelToWorld _x; _worldPos = _this modelToWorld _x;
@@ -84,4 +84,4 @@ if (isArray (_config >> "lootPosSmall")) then {
} else { } else {
diag_log format["Loot group small: %1 does not exist", ((getText(_config >> "lootGroup")) + "Small")]; diag_log format["Loot group small: %1 does not exist", ((getText(_config >> "lootGroup")) + "Small")];
}; };
}; };

View File

@@ -33,7 +33,7 @@ if (_canLoot ) then {
//Walking Zombies //Walking Zombies
_num = (round(random _max)) max _min; // + round(_max / 3); _num = (round(random _max)) max _min; // + round(_max / 3);
//diag_log ("Class: " + _type + " / Zombies: " + str(_unitTypes) + " / Walking: " + str(_num)); //diag_log ("Class: " + _type + " / Zombies: " + str(_unitTypes) + " / Walking: " + str(_num));
if(!(_originalPos call DZE_SafeZonePosCheck)) then { if (!([_originalPos] call DZE_SafeZonePosCheck)) then {
for "_i" from 0 to _num do for "_i" from 0 to _num do
{ {
//_iPos = _obj modelToWorld _originalPos; //_iPos = _obj modelToWorld _originalPos;
@@ -52,7 +52,7 @@ if (_canLoot ) then {
{ {
_Pos = [_x select 0, _x select 1, 0]; _Pos = [_x select 0, _x select 1, 0];
_rnd = random 1; _rnd = random 1;
if (_rnd < _zombieChance && {!(_Pos call DZE_SafeZonePosCheck)}) then { if (_rnd < _zombieChance && {!([_Pos] call DZE_SafeZonePosCheck)}) then {
_iPos = _obj modelToWorld _Pos; _iPos = _obj modelToWorld _Pos;
_nearByZed = {alive _x} count (_iPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 10)]) > 0; _nearByZed = {alive _x} count (_iPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 10)]) > 0;
_nearByPlayer = ({isPlayer _x} count (_iPos nearEntities ["CAManBase",30])) > 0; _nearByPlayer = ({isPlayer _x} count (_iPos nearEntities ["CAManBase",30])) > 0;

View File

@@ -12,7 +12,7 @@ while {_counter < _amount} do {
_type = "swarm_newBase"; //"_unitTypes call BIS_fnc_selectRandom; _type = "swarm_newBase"; //"_unitTypes call BIS_fnc_selectRandom;
//_type = "Pastor"; //_type = "Pastor";
_position = [position _player,50,100,0] call fn_selectRandomLocation; _position = [position _player,50,100,0] call fn_selectRandomLocation;
if(_position call DZE_SafeZonePosCheck) exitWith {}; if ([_position] call DZE_SafeZonePosCheck) exitWith {};
_agent = createAgent [_type, _position, [], 0, "NONE"]; _agent = createAgent [_type, _position, [], 0, "NONE"];
_agent setVariable["agentObjectSwarm",_agent,true]; _agent setVariable["agentObjectSwarm",_agent,true];
@@ -39,4 +39,4 @@ while {_counter < _amount} do {
//Start behavior //Start behavior
_id = [_position,_agent,player] execFSM "\z\AddOns\dayz_code\system\fn_swarmagent.fsm"; _id = [_position,_agent,player] execFSM "\z\AddOns\dayz_code\system\fn_swarmagent.fsm";
}; };

View File

@@ -66,7 +66,7 @@ if ((_maxlocalspawned < _maxControlledZombies) && (dayz_CurrentNearByZombies < d
_skipFOV = true; _skipFOV = true;
_position = [_position,3,20,1] call fn_selectRandomLocation; _position = [_position,3,20,1] call fn_selectRandomLocation;
}; };
if(_position call DZE_SafeZonePosCheck) exitWith {}; if ([_position] call DZE_SafeZonePosCheck) exitWith {};
if (surfaceIsWater _position) exitWith { diag_log "Location is in Water Abort"; }; if (surfaceIsWater _position) exitWith { diag_log "Location is in Water Abort"; };
if ((_skipFOV) or {([_position, 15, 10, 70] call _cantSee)}) then { if ((_skipFOV) or {([_position, 15, 10, 70] call _cantSee)}) then {

View File

@@ -848,10 +848,11 @@ dayz_engineSwitch = {
DZE_SafeZonePosCheck = { DZE_SafeZonePosCheck = {
private ["_position","_skipPos"]; private ["_position","_skipPos"];
_position = _this; _position = _this select 0;
_skipPos = false; _skipPos = false;
{ {
if ((_position distance (_x select 0)) < (_x select 1)) exitWith {_skipPos = true;}; if ((_position distance (_x select 0)) < (if (count _this > 1) then {_this select 1} else {_x select 1})) exitWith {_skipPos = true;};
} forEach DZE_SafeZonePosArray; } forEach DZE_SafeZonePosArray;
_skipPos; _skipPos;
}; };