1.0.1.6 Developer Build

This commit is contained in:
[VB]AWOL
2013-07-30 21:52:28 -05:00
parent e333adff4f
commit b2b79305f7
42 changed files with 791 additions and 438 deletions

View File

@@ -1,71 +1,32 @@
private ["_type","_isAir","_inVehicle","_dateNow","_maxZombies","_maxWildZombies","_age","_radius","_position","_markerstr","_markerstr1","_markerstr2","_markerstr3","_nearByObj","_handle","_looted","_cleared","_zombied","_config","_canLoot","_dis","_players","_spawnZombies","_nearby","_nearbyCount"];
private ["_t1","_type","_isAir","_inVehicle","_dateNow","_maxZombies","_maxWildZombies","_age","_radius","_position","_markerstr","_markerstr1","_markerstr2","_markerstr3","_nearByObj","_handle","_looted","_cleared","_zombied","_config","_canLoot","_dis","_players","_spawnZombies","_nearby","_nearbyCount"];
_t1 = diag_tickTime;
_type = _this select 0;
//_Keepspawning = _this select 1;
_isAir = vehicle player iskindof "Air";
//_inVehicle = (vehicle player != player);
_inVehicle = ((vehicle player != player) AND ((speed player > 10) OR _isAir));
_inVehicle = (vehicle player != player);
_onTheMove = (speed (vehicle player) > 10);
_dateNow = (DateToNumber date);
_maxZombies = dayz_maxLocalZombies;
_maxWildZombies = 3;
_age = -1;
//_nearbyBuildings = [];
_radius = 200;
_position = getPosATL player;
if (_inVehicle) then {
_maxZombies = dayz_zedSpawnVehCount;
};
if (_isAir) then {
_maxZombies = dayz_spawnAirCount;
};
//diag_log ("Type: " +str(_type));
//diag_log("SPAWN CHECKING: Starting");
//_locationstypes = ["NameCityCapital","NameCity","NameVillage"];
//_nearestCity = nearestLocations [getPos player, _locationstypes, _radius/2];
//_townname = text (_nearestCity select 0);
//_nearbytype = type (_nearestCity select 0);
/*
switch (_nearbytype) do {
case "NameVillage": {
//_radius = 250;
_maxZombies = 30;
};
case "NameCity": {
//_radius = 300;
_maxZombies = 40;
};
case "NameCityCapital": {
//_radius = 400;
_maxZombies = 40;
};
};
*/
dayz_spawnZombies = 0;
dayz_CurrentZombies = 0;
_players = _position nearEntities ["CAManBase",_radius+200];
dayz_maxGlobalZombies = dayz_maxGlobalZombiesInit;
{
if(isPlayer _x) then {
dayz_maxGlobalZombies = dayz_maxGlobalZombies + dayz_maxGlobalZombiesIncrease;
} else {
if (local _x) then {
dayz_spawnZombies = dayz_spawnZombies + 1;
};
dayz_CurrentZombies = dayz_CurrentZombies + 1;
};
} foreach _players;
_spawnZombies = _position nearEntities ["zZombie_Base",_radius+100];
dayz_spawnZombies = 0;
{
if (local _x) then
{
//diag_log ("Local");
dayz_spawnZombies = dayz_spawnZombies + 1;
};
} foreach _spawnZombies;
dayz_CurrentZombies = count (_position nearEntities ["zZombie_Base",_radius+200]);
if ("ItemMap_Debug" in items player) then {
deleteMarkerLocal "MaxZeds";
deleteMarkerLocal "Counter";
@@ -110,6 +71,7 @@ diag_log ("dayz_maxCurrentZeds: " +str(dayz_maxCurrentZeds) + "/" +str(dayz_maxZ
};
_nearby = _position nearObjects ["building",_radius];
_nearbyCount = count _nearby;
if (_nearbyCount < 1) exitwith
@@ -119,50 +81,60 @@ if (_nearbyCount < 1) exitwith
};
};
{
_type = typeOf _x;
_config = configFile >> "CfgBuildingLoot" >> _type;
_canLoot = isClass (_config);
_dis = _x distance player;
//Loot
if ((_dis < 120) and (_dis > 30) and _canLoot and !_inVehicle) then {
_looted = (_x getVariable ["looted",-0.1]);
_cleared = (_x getVariable ["cleared",true]);
_dateNow = (DateToNumber date);
_age = (_dateNow - _looted) * 525948;
//diag_log ("SPAWN LOOT: " + _type + " Building is " + str(_age) + " old" );
if ((_age > 10) and (!_cleared)) then {
_nearByObj = nearestObjects [(getPosATL _x), ["WeaponHolder","WeaponHolderBase"],((sizeOf _type)+5)];
{deleteVehicle _x} forEach _nearByObj;
_x setVariable ["cleared",true,true];
_x setVariable ["looted",_dateNow,true];
if(_canLoot) then {
_dis = _x distance player;
//Loot
if ((_dis < 120) and (_dis > 30) and !_inVehicle) then {
_looted = (_x getVariable ["looted",-0.1]);
_cleared = (_x getVariable ["cleared",true]);
_dateNow = (DateToNumber date);
_age = (_dateNow - _looted) * 525948;
//diag_log ("SPAWN LOOT: " + _type + " Building is " + str(_age) + " old" );
if ((_age > 10) and (!_cleared)) then {
_nearByObj = nearestObjects [(getPosATL _x), ["WeaponHolder","WeaponHolderBase"],((sizeOf _type)+5)];
{deleteVehicle _x} forEach _nearByObj;
_x setVariable ["cleared",true,true];
_x setVariable ["looted",_dateNow,true];
};
if ((_age > 10) and (_cleared)) then {
//Register
_x setVariable ["looted",_dateNow,true];
//cleanup
_handle = [_x] spawn building_spawnLoot;
waitUntil{scriptDone _handle};
};
};
if ((_age > 10) and (_cleared)) then {
//Register
_x setVariable ["looted",_dateNow,true];
//cleanup
_handle = [_x] spawn building_spawnLoot;
waitUntil{scriptDone _handle};
};
};
//Zeds
if ((time - dayz_spawnWait) > dayz_spawnDelay) then {
if (dayz_maxCurrentZeds < dayz_maxZeds) then {
if (dayz_CurrentZombies < dayz_maxGlobalZombies) then {
if (dayz_spawnZombies < dayz_maxLocalZombies) then {
//[_radius, _position, _inVehicle, _dateNow, _age, _locationstypes, _nearestCity, _maxZombies] call player_spawnzedCheck;
_zombied = (_x getVariable ["zombieSpawn",-0.1]);
_dateNow = (DateToNumber date);
_age = (_dateNow - _zombied) * 525948;
if (_age > 3) then {
_x setVariable ["zombieSpawn",_dateNow,true];
[_x] call building_spawnZombies;
// do not spawn zeds if player is moving faster then 10kmh
if (!_onTheMove) then {
//Zeds
if ((time - dayz_spawnWait) > dayz_spawnDelay) then {
if (dayz_maxCurrentZeds < dayz_maxZeds) then {
if (dayz_CurrentZombies < dayz_maxGlobalZombies) then {
if (dayz_spawnZombies < dayz_maxLocalZombies) then {
//[_radius, _position, _inVehicle, _dateNow, _age, _locationstypes, _nearestCity, _maxZombies] call player_spawnzedCheck;
_zombied = (_x getVariable ["zombieSpawn",-0.1]);
_dateNow = (DateToNumber date);
_age = (_dateNow - _zombied) * 525948;
if (_age > 3) then {
_x setVariable ["zombieSpawn",_dateNow,true];
[_x] call building_spawnZombies;
};
} else {
dayz_spawnWait = time;
};
} else {
dayz_spawnWait = time;
};
};
};
};
};
} forEach _nearby;
} forEach _nearby;
["player_spawnCheck.sqf",(diag_tickTime - _t1)] call fnc_dump;