mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 12:12:34 +03:00
Remove redundant operations
The isClass and config checks are done in player_spawnCheck. There is no reason to do that here. Those variables are being passed in an array during the function call. Global variables dayz_spawnZombies and dayz_maxControlledZombies used in spawn checks are adjusted in player_spawnCheck and zombie_generate. There is no reason to save to local variables.
This commit is contained in:
@@ -2,28 +2,17 @@
|
||||
Created exclusively for ArmA2:OA - DayZMod.
|
||||
Please request permission to use/alter/distribute from project leader (R4Z0R49)
|
||||
*/
|
||||
private ["_wreck","_maxlocalspawned","_maxControlledZombies","_iPos","_nearByZed","_nearByPlayer","_rnd","_positions","_zombieChance","_unitTypes","_min","_max","_num","_clean","_obj","_type","_config","_canLoot","_originalPos","_fastRun","_enabled","_i","_Pos"];
|
||||
_obj = _this select 0;
|
||||
private ["_wreck","_iPos","_nearByZed","_nearByPlayer","_rnd","_positions","_zombieChance","_unitTypes","_min","_max","_num","_clean","_obj","_type","_config","_canLoot","_originalPos","_fastRun","_enabled","_i","_Pos"];
|
||||
_obj = _this select 0;
|
||||
_type = _this select 1;
|
||||
_config = _this select 2;
|
||||
_wreck = false;
|
||||
if (count _this > 1) then {
|
||||
_wreck = _this select 1;
|
||||
if (count _this > 3) then {
|
||||
_wreck = _this select 3;
|
||||
};
|
||||
|
||||
_type = typeOf _obj;
|
||||
_config = missionConfigFile >> "CfgLoot" >> "Buildings" >> _type;
|
||||
_canLoot = isClass (_config);
|
||||
_originalPos = getPosATL _obj;
|
||||
|
||||
_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);
|
||||
_enabled = false;
|
||||
|
||||
if (_canLoot && !([_originalPos] call DZE_SafeZonePosCheck)) then {
|
||||
if (!([_originalPos] call DZE_SafeZonePosCheck)) then {
|
||||
//Get zombie class
|
||||
_unitTypes = getArray (_config >> "zombieClass");
|
||||
_min = getNumber (_config >> "minRoaming");
|
||||
@@ -37,7 +26,7 @@ if (_canLoot && !([_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 {
|
||||
if ((dayz_spawnZombies < dayz_maxControlledZombies) && {dayz_CurrentNearByZombies < dayz_maxNearByZombies} && {dayz_currentGlobalZombies < dayz_maxGlobalZeds}) then {
|
||||
[_originalPos,true,_unitTypes,_wreck] call zombie_generate;
|
||||
};
|
||||
};
|
||||
@@ -56,8 +45,8 @@ if (_canLoot && !([_originalPos] call DZE_SafeZonePosCheck)) then {
|
||||
_nearByZed = {alive _x} count (_iPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 10)]) > 0;
|
||||
_nearByPlayer = ({isPlayer _x} count (_iPos nearEntities ["CAManBase",30])) > 0;
|
||||
//diag_log ("BUILDING: " + _type + " / " + str(_nearByZed) + " / " + str(_nearByPlayer));
|
||||
if ((_maxlocalspawned < _maxControlledZombies) and (dayz_CurrentNearByZombies < dayz_maxNearByZombies) and (dayz_currentGlobalZombies < dayz_maxGlobalZeds)) then {
|
||||
if (!_nearByPlayer and !_nearByZed) then {
|
||||
if ((dayz_spawnZombies < dayz_maxControlledZombies) && {dayz_CurrentNearByZombies < dayz_maxNearByZombies} && {dayz_currentGlobalZombies < dayz_maxGlobalZeds}) then {
|
||||
if (!_nearByPlayer and {!_nearByZed}) then {
|
||||
[_iPos,false,_unitTypes,false] call zombie_generate;
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user