mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 04:02:37 +03:00
Remove redundant checks already being performed elsewhere
The checks are already being performed in player_spawnCheck and building_spawnZombies. There is no reason to perform them here.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
#include "\z\addons\dayz_code\loot\Loot.hpp"
|
#include "\z\addons\dayz_code\loot\Loot.hpp"
|
||||||
|
|
||||||
private ["_bypass","_position","_unitTypes","_radius","_method","_agent","_maxlocalspawned","_doLoiter","_wildspawns","_maxControlledZombies",
|
private ["_bypass","_position","_unitTypes","_radius","_method","_agent","_maxlocalspawned","_doLoiter","_wildspawns","_maxControlledZombies",
|
||||||
"_cantSee","_isOk","_zPos","__FILE__","_fov","_safeDistance","_farDistance","_xasl","_eye","_ed","_deg","_skipFOV","_wildSpawns","_tooClose",
|
"_cantSee","_isOk","_zPos","__FILE__","_fov","_safeDistance","_farDistance","_xasl","_eye","_ed","_deg","_skipFOV","_tooClose",
|
||||||
"_type","_loot","_array","_rnd","_lootType","_index","_weights","_loot_count","_favStance","_lootGroup"];
|
"_type","_loot","_array","_rnd","_lootType","_index","_weights","_loot_count","_favStance","_lootGroup"];
|
||||||
|
|
||||||
_position = _this select 0;
|
_position = _this select 0;
|
||||||
@@ -10,14 +10,6 @@ _unitTypes = _this select 2; // class of wanted models
|
|||||||
//_wildspawns = _this select 3;
|
//_wildspawns = _this select 3;
|
||||||
_bypass = _this select 3;
|
_bypass = _this select 3;
|
||||||
|
|
||||||
_maxlocalspawned = round(dayz_spawnZombies);
|
|
||||||
//Lets check if we need to divide the amount of zeds
|
|
||||||
if (r_player_divideinvehicle > 0) then {
|
|
||||||
_maxlocalspawned = round(dayz_spawnZombies / r_player_divideinvehicle);
|
|
||||||
};
|
|
||||||
|
|
||||||
_maxControlledZombies = round(dayz_maxLocalZombies);
|
|
||||||
|
|
||||||
_cantSee = {
|
_cantSee = {
|
||||||
private "_isOk";
|
private "_isOk";
|
||||||
|
|
||||||
@@ -61,63 +53,61 @@ _cantSee = {
|
|||||||
|
|
||||||
_skipFOV = false;
|
_skipFOV = false;
|
||||||
|
|
||||||
if ((_maxlocalspawned < _maxControlledZombies) && (dayz_CurrentNearByZombies < dayz_maxNearByZombies) && (dayz_currentGlobalZombies < dayz_maxGlobalZeds)) then {
|
if (_bypass) then {
|
||||||
if (_bypass) then {
|
_skipFOV = true;
|
||||||
_skipFOV = true;
|
_position = [_position,3,20,1] call fn_selectRandomLocation;
|
||||||
_position = [_position,3,20,1] call fn_selectRandomLocation;
|
};
|
||||||
|
|
||||||
|
if (surfaceIsWater _position) exitWith { diag_log "Location is in Water Abort"; };
|
||||||
|
|
||||||
|
if ((_skipFOV) or {([_position, 15, 10, 70] call _cantSee)}) then {
|
||||||
|
_tooClose = {isPlayer _x} count (_position nearEntities ["CAManBase",30]) > 0;
|
||||||
|
if (_tooClose) exitwith { diag_log "Zombie_Generate: was too close to player."; };
|
||||||
|
|
||||||
|
if (count _unitTypes == 0) then {
|
||||||
|
_unitTypes = getArray (missionConfigFile >> "CfgLoot" >> "Buildings" >> "Default" >> "zombieClass");
|
||||||
};
|
};
|
||||||
|
|
||||||
if (surfaceIsWater _position) exitWith { diag_log "Location is in Water Abort"; };
|
|
||||||
|
|
||||||
if ((_skipFOV) or {([_position, 15, 10, 70] call _cantSee)}) then {
|
|
||||||
_tooClose = {isPlayer _x} count (_position nearEntities ["CAManBase",30]) > 0;
|
|
||||||
if (_tooClose) exitwith { diag_log "Zombie_Generate: was too close to player."; };
|
|
||||||
|
|
||||||
if (count _unitTypes == 0) then {
|
// lets create an agent
|
||||||
_unitTypes = getArray (missionConfigFile >> "CfgLoot" >> "Buildings" >> "Default" >> "zombieClass");
|
_type = _unitTypes call BIS_fnc_selectRandom;
|
||||||
|
_radius = 5;
|
||||||
|
//_method = if (_doLoiter) then {"CAN_COLLIDE"} else {"NONE"};
|
||||||
|
_agent = createAgent [_type, _position, [], _radius, "CAN_COLLIDE"];
|
||||||
|
uiSleep 0.03;
|
||||||
|
|
||||||
|
//add to global counter
|
||||||
|
dayz_spawnZombies = dayz_spawnZombies + 1;
|
||||||
|
dayz_CurrentNearByZombies = dayz_CurrentNearByZombies + 1;
|
||||||
|
dayz_currentGlobalZombies = dayz_currentGlobalZombies + 1;
|
||||||
|
|
||||||
|
//Add some loot
|
||||||
|
if (0.3 > random 1) then {
|
||||||
|
_lootGroup = configFile >> "CfgVehicles" >> _type >> "zombieLoot";
|
||||||
|
if (isText _lootGroup) then {
|
||||||
|
//_lootGroup = dayz_lootGroups find getText (_lootGroup);
|
||||||
|
_lootGroup = Loot_GetGroup(getText _lootGroup);
|
||||||
|
//[_agent, _lootGroup, 1] call loot_insert;
|
||||||
|
Loot_Insert(_agent, _lootGroup, 1);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
// lets create an agent
|
_agent setVariable["agentObject",_agent];
|
||||||
_type = _unitTypes call BIS_fnc_selectRandom;
|
|
||||||
_radius = 5;
|
if (!isNull _agent) then {
|
||||||
//_method = if (_doLoiter) then {"CAN_COLLIDE"} else {"NONE"};
|
_agent setDir random 360;
|
||||||
_agent = createAgent [_type, _position, [], _radius, "CAN_COLLIDE"];
|
|
||||||
uiSleep 0.03;
|
uiSleep 0.03;
|
||||||
|
_position = getPosATL _agent;
|
||||||
//add to global counter
|
|
||||||
dayz_spawnZombies = dayz_spawnZombies + 1;
|
|
||||||
dayz_CurrentNearByZombies = dayz_CurrentNearByZombies + 1;
|
|
||||||
dayz_currentGlobalZombies = dayz_currentGlobalZombies + 1;
|
|
||||||
|
|
||||||
//Add some loot
|
|
||||||
if (0.3 > random 1) then {
|
|
||||||
_lootGroup = configFile >> "CfgVehicles" >> _type >> "zombieLoot";
|
|
||||||
if (isText _lootGroup) then {
|
|
||||||
//_lootGroup = dayz_lootGroups find getText (_lootGroup);
|
|
||||||
_lootGroup = Loot_GetGroup(getText _lootGroup);
|
|
||||||
//[_agent, _lootGroup, 1] call loot_insert;
|
|
||||||
Loot_Insert(_agent, _lootGroup, 1);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
_agent setVariable["agentObject",_agent];
|
|
||||||
|
|
||||||
if (!isNull _agent) then {
|
_favStance = (
|
||||||
_agent setDir random 360;
|
switch ceil(random(3^0.5)^2) do {
|
||||||
uiSleep 0.03;
|
//case 3: {"DOWN"}; // prone
|
||||||
_position = getPosATL _agent;
|
case 2: {"middle"}; // Kneel "middle"
|
||||||
|
default {"Up"}; // stand-up
|
||||||
_favStance = (
|
}
|
||||||
switch ceil(random(3^0.5)^2) do {
|
);
|
||||||
//case 3: {"DOWN"}; // prone
|
_agent setUnitPos _favStance;
|
||||||
case 2: {"middle"}; // Kneel "middle"
|
_agent setVariable ["stance", _favStance];
|
||||||
default {"Up"}; // stand-up
|
_agent setVariable ["BaseLocation", _position];
|
||||||
}
|
_agent setVariable ["doLoiter", _doLoiter]; // true: Z will be wandering, false: stay still
|
||||||
);
|
|
||||||
_agent setUnitPos _favStance;
|
|
||||||
_agent setVariable ["stance", _favStance];
|
|
||||||
_agent setVariable ["BaseLocation", _position];
|
|
||||||
_agent setVariable ["doLoiter", _doLoiter]; // true: Z will be wandering, false: stay still
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user