Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.02 KB | None | 0 0
  1. private ["_object","_worldspace","_location","_dir","_class","_uid","_dam","_hitpoints","_selection","_array","_damage","_fuel","_key","_totaldam","_spawnDMG","_characterID"];
  2.  
  3. _object = _this select 0;
  4. _worldspace = _this select 1;
  5. _class = _this select 2;
  6. _spawnDMG = _this select 3;
  7. _characterID = _this select 4;
  8. _fuel = 1;
  9. _damage = 0;
  10. _array = [];
  11.  
  12. diag_log ("PUBLISH: Attempt " + str(_object));
  13.  
  14. _dir = _worldspace select 0;
  15. _location = _worldspace select 1;
  16. _uid = _worldspace call dayz_objectUID2;
  17.  
  18. if (_spawnDMG) then {
  19.  
  20. _fuel = 0;
  21.  
  22. if (getNumber(configFile >> "CfgVehicles" >> _class >> "isBicycle") != 1) then {
  23.  
  24. _totaldam = 0;
  25. _hitpoints = _object call vehicle_getHitpoints;
  26.  
  27. {
  28.  
  29. _dam = call generate_new_damage;
  30. _selection = getText(configFile >> "cfgVehicles" >> _class >> "HitPoints" >> _x >> "name");
  31.  
  32. if (_dam > 0) then {
  33. _array set [count _array,[_selection,_dam]];
  34. _totaldam = _totaldam + _dam;
  35. };
  36.  
  37. } count _hitpoints;
  38. _damage = 0;
  39. _fuel = (random(DynamicVehicleFuelHigh-DynamicVehicleFuelLow)+DynamicVehicleFuelLow) / 100;
  40. };
  41. };
  42.  
  43. _key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, _damage , _characterID, _worldspace, [], _array, _fuel,_uid];
  44.  
  45. diag_log ("HIVE: WRITE: "+ str(_key));
  46.  
  47. _key call server_hiveWrite;
  48.  
  49. PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_object];
  50.  
  51. [_object,_uid,_fuel,_damage,_array,_characterID,_class] spawn {
  52.  
  53. private["_object","_uid","_fuel","_damage","_array","_characterID","_done","_retry","_key","_result","_outcome","_oid","_selection","_dam","_class"];
  54.  
  55. _object = _this select 0;
  56. _uid = _this select 1;
  57. _fuel = _this select 2;
  58. _damage = _this select 3;
  59. _array = _this select 4;
  60. _characterID = _this select 5;
  61. _class = _this select 6;
  62. _done = false;
  63. _retry = 0;
  64.  
  65. while {_retry < 10} do {
  66.  
  67. sleep 1;
  68. _key = format["CHILD:388:%1:",_uid];
  69. diag_log ("HIVE: WRITE: "+ str(_key));
  70. _result = _key call server_hiveReadWrite;
  71. _outcome = _result select 0;
  72. if (_outcome == "PASS") then {
  73. _oid = _result select 1;
  74. _object setVariable ["ObjectID", _oid, true];
  75. diag_log("CUSTOM: Selected " + str(_oid));
  76. _done = true;
  77. _retry = 100;
  78. } else {
  79. diag_log("CUSTOM: trying again to get id for: " + str(_uid));
  80. _done = false;
  81. _retry = _retry + 1;
  82. };
  83. };
  84.  
  85. if(!_done) exitWith { deleteVehicle _object; diag_log("CUSTOM: failed to get id for : " + str(_uid)); };
  86.  
  87. _object setVariable ["lastUpdate",time];
  88. _object setVariable ["CharacterID", _characterID, true];
  89. _object setDamage _damage;
  90.  
  91. {
  92. _selection = _x select 0;
  93. _dam = _x select 1;
  94. if (_selection in dayZ_explosiveParts && _dam > 0.8) then {_dam = 0.8};
  95. [_object,_selection,_dam] call object_setFixServer;
  96. } count _array;
  97.  
  98. _object setFuel _fuel;
  99. _object setvelocity [0,0,1];
  100. _object call fnc_veh_ResetEH;
  101.  
  102. PVDZE_veh_Init = _object;
  103.  
  104. publicVariable "PVDZE_veh_Init";
  105.  
  106. diag_log ("PUBLISH: Created " + (_class) + " with ID " + str(_uid));
  107.  
  108. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement