Advertisement
TBsThug

server_monitor.sqf

Jun 15th, 2017
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.14 KB | None | 0 0
  1. private ["_date","_year","_month","_day","_hour","_minute","_date1","_key","_objectCount","_dir","_point","_i","_action","_dam","_selection","_wantExplosiveParts","_entity","_worldspace","_damage","_booleans","_rawData","_ObjectID","_class","_CharacterID","_inventory","_hitpoints","_fuel","_id","_objectArray","_script","_result","_outcome","_shutdown","_res"];
  2. [] execVM "\z\addons\dayz_server\system\s_fps.sqf"; //server monitor FPS (writes each ~181s diag_fps+181s diag_fpsmin*)
  3. #include "\z\addons\dayz_server\compile\server_toggle_debug.hpp"
  4.  
  5. waitUntil {!isNil "BIS_MPF_InitDone" && initialized};
  6. if (!isNil "sm_done") exitWith {}; // prevent server_monitor be called twice (bug during login of the first player)
  7. sm_done = false;
  8.  
  9. _legacyStreamingMethod = false; //use old object streaming method, more secure but will be slower and subject to the callExtension return size limitation.
  10.  
  11. dayz_serverIDMonitor = [];
  12. _DZE_VehObjects = [];
  13. dayz_versionNo = getText (configFile >> "CfgMods" >> "DayZ" >> "version");
  14. dayz_hiveVersionNo = getNumber (configFile >> "CfgMods" >> "DayZ" >> "hiveVersion");
  15. _hiveLoaded = false;
  16. _serverVehicleCounter = [];
  17. _tempMaint = DayZ_WoodenFence + DayZ_WoodenGates;
  18. diag_log "HIVE: Starting";
  19.  
  20. //Set the Time
  21. _key = "CHILD:307:";
  22. _result = _key call server_hiveReadWrite;
  23. _outcome = _result select 0;
  24. if (_outcome == "PASS") then {
  25. _date = _result select 1;
  26. _year = _date select 0;
  27. _month = _date select 1;
  28. _day = _date select 2;
  29. _hour = _date select 3;
  30. _minute = _date select 4;
  31.  
  32. if (dayz_ForcefullmoonNights) then {_date = [2012,8,2,_hour,_minute];};
  33. diag_log ["TIME SYNC: Local Time set to:", _date, "Fullmoon:",dayz_ForcefullmoonNights,"Date given by HiveExt.dll:",_result select 1];
  34. setDate _date;
  35. dayzSetDate = _date;
  36. publicVariable "dayzSetDate";
  37. };
  38.  
  39. //Stream in objects
  40. /* STREAM OBJECTS */
  41. //Send the key
  42. _timeStart = diag_tickTime;
  43.  
  44. for "_i" from 1 to 5 do {
  45. diag_log "HIVE: trying to get objects";
  46. _key = format["CHILD:302:%1:%2:",dayZ_instance, _legacyStreamingMethod];
  47. _result = _key call server_hiveReadWrite;
  48. if (typeName _result == "STRING") then {
  49. _shutdown = format["CHILD:400:%1:",(profileNamespace getVariable "SUPERKEY")];
  50. _res = _shutdown call server_hiveReadWrite;
  51. diag_log ("HIVE: attempt to kill.. HiveExt response:"+str(_res));
  52. } else {
  53. diag_log ("HIVE: found "+str(_result select 1)+" objects" );
  54. _i = 99; // break
  55. };
  56. };
  57.  
  58. if (typeName _result == "STRING") exitWith {
  59. diag_log "HIVE: Connection error. Server_monitor.sqf is exiting.";
  60. };
  61.  
  62. diag_log "HIVE: Request sent";
  63. _myArray = [];
  64. _val = 0;
  65. _status = _result select 0; //Process result
  66. _val = _result select 1;
  67. if (_legacyStreamingMethod) then {
  68. if (_status == "ObjectStreamStart") then {
  69. profileNamespace setVariable ["SUPERKEY",(_result select 2)];
  70. _hiveLoaded = true;
  71. //Stream Objects
  72. diag_log ("HIVE: Commence Object Streaming...");
  73. for "_i" from 1 to _val do {
  74. _result = _key call server_hiveReadWriteLarge;
  75. _status = _result select 0;
  76. _myArray set [count _myArray,_result];
  77. };
  78. };
  79. } else {
  80. if (_val > 0) then {
  81. _fileName = _key call server_hiveReadWrite;
  82. _lastFN = profileNamespace getVariable["lastFN",""];
  83. profileNamespace setVariable["lastFN",_fileName];
  84. saveProfileNamespace;
  85. if (_status == "ObjectStreamStart") then {
  86. profileNamespace setVariable ["SUPERKEY",(_result select 2)];
  87. _hiveLoaded = true;
  88. _myArray = Call Compile PreProcessFile _fileName;
  89. _key = format["CHILD:302:%1:%2:",_lastFN, _legacyStreamingMethod];
  90. _result = _key call server_hiveReadWrite; //deletes previous object data dump
  91. };
  92. } else {
  93. if (_status == "ObjectStreamStart") then {
  94. profileNamespace setVariable ["SUPERKEY",(_result select 2)];
  95. _hiveLoaded = true;
  96. };
  97. };
  98. };
  99.  
  100. diag_log ("HIVE: Streamed " + str(_val) + " objects");
  101.  
  102. // Don't spawn objects if no clients are online (createVehicle fails with Ref to nonnetwork object)
  103. if ((playersNumber west + playersNumber civilian) == 0) exitWith {
  104. diag_log "All clients disconnected. Server_monitor.sqf is exiting.";
  105. };
  106.  
  107. {
  108. private ["_object","_posATL"];
  109. //Parse Array
  110. _action = _x select 0;
  111. _idKey = _x select 1;
  112. _type = _x select 2;
  113. _ownerID = _x select 3;
  114. _worldspace = _x select 4;
  115. _inventory = _x select 5;
  116. _hitPoints = _x select 6;
  117. _fuel = _x select 7;
  118. _damage = _x select 8;
  119. _storageMoney = _x select 9;
  120.  
  121. //set object to be in maintenance mode
  122. _maintenanceMode = false;
  123. _maintenanceModeVars = [];
  124.  
  125. _dir = 90;
  126. _pos = [0,0,0];
  127. _wsDone = false;
  128. _wsCount = count _worldspace;
  129.  
  130. //Vector building
  131. _vector = [[0,0,0],[0,0,0]];
  132. _vecExists = false;
  133. _ownerPUID = "0";
  134.  
  135. if (_wsCount >= 2) then {
  136. _dir = _worldspace select 0;
  137. _posATL = _worldspace select 1;
  138. if (count _posATL == 3) then {
  139. _pos = _posATL;
  140. _wsDone = true;
  141. };
  142. if (_wsCount >= 3) then{
  143. _ws2TN = typename (_worldspace select 2);
  144. _ws3TN = typename (_worldspace select 3);
  145. if (_wsCount == 3) then{
  146. if (_ws2TN == "STRING") then{
  147. _ownerPUID = _worldspace select 2;
  148. } else {
  149. if (_ws2TN == "ARRAY") then{
  150. _vector = _worldspace select 2;
  151. _vecExists = true;
  152. };
  153. };
  154. } else {
  155. if (_wsCount == 4) then{
  156. if (_ws3TN == "STRING") then{
  157. _ownerPUID = _worldspace select 3;
  158. } else {
  159. if (_ws2TN == "STRING") then{
  160. _ownerPUID = _worldspace select 2;
  161. };
  162. };
  163. if (_ws2TN == "ARRAY") then{
  164. _vector = _worldspace select 2;
  165. _vecExists = true;
  166. } else {
  167. if (_ws3TN == "ARRAY") then{
  168. _vector = _worldspace select 3;
  169. _vecExists = true;
  170. };
  171. };
  172. };
  173. };
  174. } else {
  175. _worldspace set [count _worldspace, "0"];
  176. };
  177. };
  178.  
  179. if (!_wsDone) then {
  180. if ((count _posATL) >= 2) then {
  181. _pos = [_posATL select 0,_posATL select 1,0];
  182. diag_log format["MOVED OBJ: %1 of class %2 with worldspace array = %3 to pos: %4",_idKey,_type,_worldspace,_pos];
  183. } else {
  184. diag_log format["MOVED OBJ: %1 of class %2 with worldspace array = %3 to pos: [0,0,0]",_idKey,_type,_worldspace];
  185. };
  186. };
  187.  
  188. //diag_log format["OBJ: %1 - %2,%3,%4,%5,%6,%7,%8", _idKey,_type,_ownerID,_worldspace,_inventory,_hitPoints,_fuel,_damage];
  189. /*
  190. if (_type in _tempMaint) then {
  191. //Use hitpoints for Maintenance system and other systems later.
  192. //Enable model swap for a damaged model.
  193. if ("Maintenance" in _hitPoints) then {
  194. _maintenanceModeVars = [_type,_pos];
  195. _type = _type + "_Damaged";
  196. };
  197. //TODO add remove object and readd old fence (hideobject would be nice to use here :-( )
  198. //Pending change to new fence models\Layout
  199. };
  200. */
  201. _nonCollide = _type in DayZ_nonCollide;
  202. //Create it
  203. if (_nonCollide) then {
  204. _object = createVehicle [_type, [0,0,0], [], 0, "NONE"];
  205. } else {
  206. _object = _type createVehicle [0,0,0]; //more than 2x faster than createvehicle array
  207. };
  208. _object setDir _dir;
  209. _object setPosATL _pos;
  210. _object setDamage _damage;
  211. if (_vecExists) then {
  212. _object setVectorDirAndUp _vector;
  213. };
  214. _object enableSimulation false;
  215.  
  216. _doorLocked = _type in DZE_DoorsLocked;
  217. _isPlot = _type == "Plastic_Pole_EP1_DZ";
  218.  
  219. // prevent immediate hive write when vehicle parts are set up
  220. _object setVariable ["lastUpdate",diag_ticktime];
  221. _object setVariable ["ObjectID", _idKey, true];
  222. _object setVariable ["OwnerPUID", _ownerPUID, true];
  223. if (Z_SingleCurrency && {(_type in DZE_MoneyStorageClasses) || (_object isKindOf "AllVehicles")}) then {
  224. _object setVariable [Z_MoneyVariable, _storageMoney, true];
  225. };
  226.  
  227. dayz_serverIDMonitor set [count dayz_serverIDMonitor,_idKey];
  228.  
  229. if (!_wsDone) then {[_object,"position",true] call server_updateObject;};
  230. if (_type == "Base_Fire_DZ") then {_object spawn base_fireMonitor;};
  231.  
  232. _isDZ_Buildable = _object isKindOf "DZ_buildables";
  233. _isTrapItem = _object isKindOf "TrapItems";
  234. _isSafeObject = _type in DayZ_SafeObjects;
  235.  
  236. //Dont add inventory for traps.
  237. if (!_isDZ_Buildable && !_isTrapItem) then {
  238. clearWeaponCargoGlobal _object;
  239. clearMagazineCargoGlobal _object;
  240. clearBackpackCargoGlobal _object;
  241. if( (count _inventory > 0) && !_isPlot && !_doorLocked) then {
  242. if (_type in DZE_LockedStorage) then {
  243. // Do not send big arrays over network! Only server needs these
  244. _object setVariable ["WeaponCargo",(_inventory select 0),false];
  245. _object setVariable ["MagazineCargo",(_inventory select 1),false];
  246. _object setVariable ["BackpackCargo",(_inventory select 2),false];
  247. } else {
  248. _weaponcargo = _inventory select 0 select 0;
  249. _magcargo = _inventory select 1 select 0;
  250. _backpackcargo = _inventory select 2 select 0;
  251. _weaponqty = _inventory select 0 select 1;
  252. {_object addWeaponCargoGlobal [_x, _weaponqty select _foreachindex];} foreach _weaponcargo;
  253.  
  254. _magqty = _inventory select 1 select 1;
  255. {_object addMagazineCargoGlobal [_x, _magqty select _foreachindex];} foreach _magcargo;
  256.  
  257. _backpackqty = _inventory select 2 select 1;
  258. {_object addBackpackCargoGlobal [_x, _backpackqty select _foreachindex];} foreach _backpackcargo;
  259. };
  260. } else {
  261. if (DZE_permanentPlot && _isPlot) then {
  262. _object setVariable ["plotfriends", _inventory, true];
  263. };
  264. if (DZE_doorManagement && _doorLocked) then {
  265. _object setVariable ["doorfriends", _inventory, true];
  266. };
  267. };
  268. };
  269.  
  270. if (_object isKindOf "AllVehicles") then {
  271. _object setVariable ["CharacterID", _ownerID, true];
  272. _isAir = _object isKindOf "Air";
  273. {
  274. _selection = _x select 0;
  275. _dam = if (!_isAir && {_selection in dayZ_explosiveParts}) then {(_x select 1) min 0.8;} else {_x select 1;};
  276. _strH = "hit_" + (_selection);
  277. _object setHit[_selection,_dam];
  278. _object setVariable [_strH,_dam,true];
  279. } foreach _hitpoints;
  280. [_object,"damage"] call server_updateObject;
  281.  
  282. _object setFuel _fuel;
  283. if (!_isSafeObject) then {
  284. _DZE_VehObjects set [count _DZE_VehObjects,_object];
  285. _object call fnc_veh_ResetEH;
  286. if (_ownerID != "0" && {!(_object isKindOf "Bicycle")}) then {_object setVehicleLock "locked";};
  287. _serverVehicleCounter set [count _serverVehicleCounter,_type]; // total each vehicle
  288. } else {
  289. _object enableSimulation true;
  290. };
  291. } else {
  292. // Fix for leading zero issues on safe codes after restart
  293. _lockable = getNumber (configFile >> "CfgVehicles" >> _type >> "lockable");
  294. _codeCount = count (toArray _ownerID);
  295. switch (_lockable) do {
  296. case 4: {
  297. switch (_codeCount) do {
  298. case 3: {_ownerID = format["0%1",_ownerID];};
  299. case 2: {_ownerID = format["00%1",_ownerID];};
  300. case 1: {_ownerID = format["000%1",_ownerID];};
  301. };
  302. };
  303. case 3: {
  304. switch (_codeCount) do {
  305. case 2: {_ownerID = format["0%1",_ownerID];};
  306. case 1: {_ownerID = format["00%1",_ownerID];};
  307. };
  308. };
  309. };
  310. _object setVariable ["CharacterID", _ownerID, true];
  311. if (_isDZ_Buildable || {(_isSafeObject && !_isTrapItem)}) then {
  312. _object setVariable["memDir",_dir,true];
  313. if (DZE_GodModeBase && {!(_type in DZE_GodModeBaseExclude)}) then {
  314. _object addEventHandler ["HandleDamage",{false}];
  315. } else {
  316. _object addMPEventHandler ["MPKilled",{_this call vehicle_handleServerKilled;}];
  317. };
  318. _object setVariable ["OEMPos",_pos,true]; // used for inplace upgrades and lock/unlock of safe
  319. } else {
  320. _object enableSimulation true;
  321. };
  322. if (_isDZ_Buildable || {_isTrapItem}) then {
  323. //Use inventory for owner/clan info and traps armed state
  324. {
  325. _xTypeName = typeName _x;
  326. switch (_xTypeName) do {
  327. case "ARRAY": {
  328. _x1 = _x select 1;
  329. switch (_x select 0) do {
  330. case "ownerArray" : { _object setVariable ["ownerArray", _x1, true]; };
  331. case "clanArray" : { _object setVariable ["clanArray", _x1, true]; };
  332. case "armed" : { _object setVariable ["armed", _x1, true]; };
  333. case "padlockCombination" : { _object setVariable ["dayz_padlockCombination", _x1, false]; };
  334. case "BuildLock" : { _object setVariable ["BuildLock", _x1, true]; };
  335. };
  336. };
  337. case "STRING": {_object setVariable ["ownerArray", [_x], true]; };
  338. case "BOOLEAN": {_object setVariable ["armed", _x, true]};
  339. };
  340. } foreach _inventory;
  341.  
  342. if (_maintenanceMode) then { _object setVariable ["Maintenance", true, true]; _object setVariable ["MaintenanceVars", _maintenanceModeVars]; };
  343. };
  344. };
  345. dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object]; //Monitor the object
  346. } forEach _myArray;
  347.  
  348. //enable simulation on vehicles after all buildables are spawned
  349. {
  350. _x enableSimulation true;
  351. _x setVelocity [0,0,1];
  352. } forEach _DZE_VehObjects;
  353.  
  354. diag_log format["HIVE: BENCHMARK - Server_monitor.sqf finished streaming %1 objects in %2 seconds (unscheduled)",_val,diag_tickTime - _timeStart];
  355.  
  356. // # END OF STREAMING #
  357. if (dayz_townGenerator) then {
  358. call compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_plantSpawner.sqf"; // Draw the pseudo random seeds
  359. };
  360. [] execFSM "\z\addons\dayz_server\system\server_vehicleSync.fsm";
  361. [] execVM "\z\addons\dayz_server\system\scheduler\sched_init.sqf"; // launch the new task scheduler
  362.  
  363. [] ExecVM "\z\addons\dayz_server\sectorB_loot\truck.sqf";
  364.  
  365. createCenter civilian;
  366.  
  367. actualSpawnMarkerCount = 0;
  368. // count valid spawn markers, since different maps have different amounts
  369. for "_i" from 0 to 10 do {
  370. if ((getMarkerPos format["spawn%1",_i]) distance [0,0,0] > 0) then {
  371. actualSpawnMarkerCount = actualSpawnMarkerCount + 1;
  372. } else {
  373. _i = 11; // exit since we did not find any further markers
  374. };
  375. };
  376. diag_log format["Total Number of spawn locations %1", actualSpawnMarkerCount];
  377.  
  378. if (isDedicated) then {endLoadingScreen;};
  379. [] call compile preprocessFileLineNumbers "\z\addons\dayz_server\DZAI\init\dzai_initserver.sqf";
  380. [] ExecVM "\z\addons\dayz_server\WAI\init.sqf";
  381. [] ExecVM "\z\addons\dayz_server\DZMS\DZMSInit.sqf";
  382. allowConnection = true;
  383. sm_done = true;
  384. publicVariable "sm_done";
  385.  
  386. // Trap loop
  387. [] spawn {
  388. private ["_array","_array2","_array3","_script","_armed"];
  389. _array = str dayz_traps;
  390. _array2 = str dayz_traps_active;
  391. _array3 = str dayz_traps_trigger;
  392.  
  393. while {1 == 1} do {
  394. if ((str dayz_traps != _array) || (str dayz_traps_active != _array2) || (str dayz_traps_trigger != _array3)) then {
  395. _array = str dayz_traps;
  396. _array2 = str dayz_traps_active;
  397. _array3 = str dayz_traps_trigger;
  398. //diag_log "DEBUG: traps";
  399. //diag_log format["dayz_traps (%2) -> %1", dayz_traps, count dayz_traps];
  400. //diag_log format["dayz_traps_active (%2) -> %1", dayz_traps_active, count dayz_traps_active];
  401. //diag_log format["dayz_traps_trigger (%2) -> %1", dayz_traps_trigger, count dayz_traps_trigger];
  402. //diag_log "DEBUG: end traps";
  403. };
  404.  
  405. {
  406. if (isNull _x) then {
  407. dayz_traps = dayz_traps - [_x];
  408. _armed = false;
  409. _script = {};
  410. } else {
  411. _armed = _x getVariable ["armed", false];
  412. _script = call compile getText (configFile >> "CfgVehicles" >> typeOf _x >> "script");
  413. };
  414.  
  415. if (_armed) then {
  416. if !(_x in dayz_traps_active) then {["arm", _x] call _script;};
  417. } else {
  418. if (_x in dayz_traps_active) then {["disarm", _x] call _script;};
  419. };
  420. uiSleep 0.01;
  421. } forEach dayz_traps;
  422. uiSleep 1;
  423. };
  424. };
  425.  
  426. //Points of interest
  427. //[] execVM "\z\addons\dayz_server\compile\server_spawnInfectedCamps.sqf"; //Adds random spawned camps in the woods with corpses and loot tents (negatively impacts FPS)
  428. [] execVM "\z\addons\dayz_server\compile\server_spawnCarePackages.sqf";
  429. [] execVM "\z\addons\dayz_server\compile\server_spawnCrashSites.sqf";
  430.  
  431. if (dayz_townGenerator) then {execVM "\z\addons\dayz_server\system\lit_fireplaces.sqf";};
  432.  
  433. "PVDZ_sec_atp" addPublicVariableEventHandler {
  434. _x = _this select 1;
  435. switch (1==1) do {
  436. case (typeName (_x select 0) == "SCALAR") : { // just some logs from the client
  437. diag_log (toString _x);
  438. };
  439. case (count _x == 2) : { // wrong side
  440. diag_log format["P1ayer %1 reports possible 'side' hack. Server may be compromised!",(_x select 1) call fa_plr2Str];
  441. };
  442. default { // player hit
  443. _unit = _x select 0;
  444. _source = _x select 1;
  445. if (!isNull _source) then {
  446. diag_log format ["P1ayer %1 hit by %2 %3 from %4 meters in %5 for %6 damage",
  447. _unit call fa_plr2Str, _source call fa_plr2Str, toString (_x select 2), _x select 3, _x select 4, _x select 5];
  448. };
  449. };
  450. };
  451. };
  452.  
  453. "PVDZ_objgather_Knockdown" addPublicVariableEventHandler {
  454. _tree = (_this select 1) select 0;
  455. _player = (_this select 1) select 1;
  456. _dis = _player distance _tree;
  457. _name = if (alive _player) then {name _player} else {"DeadPlayer"};
  458. _uid = getPlayerUID _player;
  459. _treeModel = _tree call fn_getModelName;
  460.  
  461. if ((_dis < 30) && (_treeModel in dayz_trees) && (_uid != "")) then {
  462. _tree setDamage 1;
  463. dayz_choppedTrees set [count dayz_choppedTrees,_tree];
  464. diag_log format["Server setDamage on tree %1 chopped down by %2(%3)",_treeModel,_name,_uid];
  465. };
  466. };
  467.  
  468. // preload server traders menu data into cache
  469. if !(DZE_ConfigTrader) then {
  470. {
  471. // get tids
  472. _traderData = call compile format["menu_%1;",_x];
  473. if (!isNil "_traderData") then {
  474. {
  475. _traderid = _x select 1;
  476. _retrader = [];
  477.  
  478. _key = format["CHILD:399:%1:",_traderid];
  479. _data = "HiveEXT" callExtension _key;
  480. _result = call compile format["%1",_data];
  481. _status = _result select 0;
  482.  
  483. if (_status == "ObjectStreamStart") then {
  484. _val = _result select 1;
  485. call compile format["ServerTcache_%1 = [];",_traderid];
  486. for "_i" from 1 to _val do {
  487. _data = "HiveEXT" callExtension _key;
  488. _result = call compile format ["%1",_data];
  489. call compile format["ServerTcache_%1 set [count ServerTcache_%1,%2]",_traderid,_result];
  490. _retrader set [count _retrader,_result];
  491. };
  492. };
  493. } forEach (_traderData select 0);
  494. };
  495. } forEach serverTraders;
  496. };
  497.  
  498. if (_hiveLoaded) then {
  499. _serverVehicleCounter spawn {
  500. // spawn_vehicles
  501. // Get all buildings and roads only once. Very taxing, but only on first startup
  502. _serverVehicleCounter = _this;
  503. _vehiclesToUpdate = [];
  504. _startTime = diag_tickTime;
  505. _buildingList = [];
  506. _cfgLootFile = missionConfigFile >> "CfgLoot" >> "Buildings";
  507. {
  508. if (isClass (_cfgLootFile >> typeOf _x)) then {
  509. _buildingList set [count _buildingList,_x];
  510. };
  511. } count (getMarkerPos "center" nearObjects ["building",((getMarkerSize "center") select 1)]);
  512. _roadList = getMarkerPos "center" nearRoads ((getMarkerSize "center") select 1);
  513.  
  514. _vehLimit = MaxVehicleLimit - (count _serverVehicleCounter);
  515. if (_vehLimit > 0) then {
  516. diag_log ("HIVE: Spawning # of Vehicles: " + str(_vehLimit));
  517. for "_x" from 1 to _vehLimit do {call spawn_vehicles;};
  518. } else {
  519. diag_log "HIVE: Vehicle Spawn limit reached!";
  520. _vehLimit = 0;
  521. };
  522.  
  523. if (dayz_townGenerator) then {
  524. // Vanilla town generator spawns debris locally on each client
  525. MaxDynamicDebris = 0;
  526. } else {
  527. // Epoch global dynamic debris
  528. diag_log ("HIVE: Spawning # of Debris: " + str(MaxDynamicDebris));
  529. for "_x" from 1 to MaxDynamicDebris do {call spawn_roadblocks;};
  530. };
  531.  
  532. diag_log ("HIVE: Spawning # of Ammo Boxes: " + str(MaxAmmoBoxes));
  533. for "_x" from 1 to MaxAmmoBoxes do {call spawn_ammosupply;};
  534.  
  535. diag_log ("HIVE: Spawning # of Veins: " + str(MaxMineVeins));
  536. for "_x" from 1 to MaxMineVeins do {call spawn_mineveins;};
  537.  
  538. diag_log format["HIVE: BENCHMARK - Server finished spawning %1 DynamicVehicles, %2 Debris, %3 SupplyCrates and %4 MineVeins in %5 seconds (scheduled)",_vehLimit,MaxDynamicDebris,MaxAmmoBoxes,MaxMineVeins,diag_tickTime - _startTime];
  539.  
  540. //Update gear last after all dynamic vehicles are created to save random loot to database (low priority)
  541. {[_x,"gear"] call server_updateObject} count _vehiclesToUpdate;
  542. };
  543. };
  544.  
  545. [] spawn server_spawnEvents;
  546. /* //Causes issues with changing clothes
  547. _debugMarkerPosition = [(respawn_west_original select 0),(respawn_west_original select 1),1];
  548. _vehicle_0 = createVehicle ["DebugBox_DZ", _debugMarkerPosition, [], 0, "CAN_COLLIDE"];
  549. _vehicle_0 setPos _debugMarkerPosition;
  550. _vehicle_0 setVariable ["ObjectID","1",true];
  551. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement