mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-05-13 14:21:11 +03:00
0.65
This commit is contained in:
@@ -182,19 +182,17 @@ RoadList = MarkerPosition nearRoads DynamicVehicleArea;
|
||||
BuildingList = MarkerPosition nearObjects ["House",DynamicVehicleArea];
|
||||
|
||||
spawn_vehicles = {
|
||||
private["_vehicle","_isAir","_isShip","_position","_roadlist","_buildinglist","_istoomany","_marker","_veh","_objPosition","_weights","_index","_uid","_velimit","_counter"];
|
||||
private["_weights","_isOverLimit","_isAbort","_counter","_index","_vehicle","_velimit","_qty","_isAir","_isShip","_position","_dir","_istoomany","_veh","_objPosition"];
|
||||
|
||||
if (isDedicated) then {
|
||||
|
||||
_counter = _this select 0;
|
||||
|
||||
waituntil {!isnil "fnc_buildWeightedArray"};
|
||||
|
||||
_weights = [];
|
||||
_weights = [AllowedVehiclesList,AllowedVehiclesChance] call fnc_buildWeightedArray;
|
||||
|
||||
_isOverLimit = true;
|
||||
|
||||
_isAbort = false;
|
||||
_counter = 0;
|
||||
while {_isOverLimit} do {
|
||||
|
||||
waitUntil{!isNil "BIS_fnc_selectRandom"};
|
||||
@@ -203,7 +201,7 @@ spawn_vehicles = {
|
||||
_vehicle = AllowedVehiclesList select _index;
|
||||
_velimit = AllowedVehiclesLimit select _index;
|
||||
|
||||
_qty = {_x == _vehicle} count _counter;
|
||||
_qty = {_x == _vehicle} count serverVehicleCounter;
|
||||
|
||||
// If under limit allow to proceed
|
||||
if(_qty < _velimit) then {
|
||||
@@ -211,15 +209,25 @@ spawn_vehicles = {
|
||||
};
|
||||
|
||||
// TODO add counter to stop after X attempts
|
||||
_counter = _counter + 1;
|
||||
|
||||
if(_counter > 5) then {
|
||||
_isOverLimit = false;
|
||||
_isAbort = true;
|
||||
};
|
||||
};
|
||||
|
||||
if (_isAbort) then {
|
||||
diag_log("DEBUG: unable to find sutable vehicle");
|
||||
} else {
|
||||
|
||||
// add vehicle to counter for next pass
|
||||
serverVehicleCounter set [count serverVehicleCounter,_vehicle];
|
||||
|
||||
// Find Vehicle Type to better control spawns
|
||||
_isAir = _vehicle isKindOf "Air";
|
||||
_isShip = _vehicle isKindOf "Ship";
|
||||
|
||||
|
||||
|
||||
if(_isShip || _isAir) then {
|
||||
if(_isShip) then {
|
||||
// Spawn anywhere on coast on water
|
||||
@@ -289,6 +297,7 @@ spawn_vehicles = {
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
spawn_roadblocks = {
|
||||
private["_position","_veh","_num","_config","_itemType","_itemChance","_weights","_index","_iArray","_isRoad","_roadlist","_istoomany"];
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
dayz_versionNo = getText(configFile >> "CfgMods" >> "DayZ" >> "version");
|
||||
dayz_hiveVersionNo = getNumber(configFile >> "CfgMods" >> "DayZ" >> "hiveVersion");
|
||||
|
||||
_serverVehicleCounter = [];
|
||||
serverVehicleCounter = [];
|
||||
|
||||
if ((count playableUnits == 0) and !isDedicated) then {
|
||||
isSinglePlayer = true;
|
||||
@@ -169,7 +169,7 @@ diag_log "HIVE: Starting";
|
||||
_totalvehicles = _totalvehicles + 1;
|
||||
|
||||
// total each vehicle
|
||||
_serverVehicleCounter set [count _serverVehicleCounter,_type];
|
||||
serverVehicleCounter set [count _serverVehicleCounter,_type];
|
||||
|
||||
};
|
||||
|
||||
@@ -226,13 +226,14 @@ _vehLimit = MaxVehicleLimit - _totalvehicles;
|
||||
diag_log ("HIVE: Spawning # of Vehicles: " + str(_vehLimit));
|
||||
if(_vehLimit > 0) then {
|
||||
for "_x" from 1 to _vehLimit do {
|
||||
_id = [_serverVehicleCounter] spawn spawn_vehicles; // Needs setup
|
||||
_id = [] spawn spawn_vehicles; // Needs setup
|
||||
waitUntil{scriptDone _id};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// spawn_roadblocks
|
||||
diag_log ("HIVE: Spawning # of Debris: " + str(MaxDynamicDebris));
|
||||
for "_x" from 1 to MaxDynamicDebris do {
|
||||
_id = [] spawn spawn_roadblocks;
|
||||
//waitUntil{scriptDone _id};
|
||||
|
||||
Reference in New Issue
Block a user