Advertisement
Guest User

Untitled

a guest
Jan 28th, 2013
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.45 KB | None | 0 0
  1. []execVM "\z\addons\dayz_server\system\s_fps.sqf";
  2. dayz_versionNo = getText(configFile >> "CfgMods" >> "DayZ" >> "version");
  3. dayz_hiveVersionNo = getNumber(configFile >> "CfgMods" >> "DayZ" >> "hiveVersion");
  4. diag_log("SERVER VERSION: Bliss v4.2");
  5.  
  6. if ((count playableUnits == 0) and !isDedicated) then {
  7. isSinglePlayer = true;
  8. };
  9.  
  10. waitUntil{initialized};
  11.  
  12. //Send the key
  13. _key = format["CHILD:999:select payload, loop_interval, start_delay from message where instance_id = ?:[%1]:", dayZ_instance];
  14. _data = "HiveEXT" callExtension _key;
  15.  
  16. diag_log("SERVER: Fetching messages...");
  17.  
  18. //Process result
  19. _result = call compile format ["%1", _data];
  20. _status = _result select 0;
  21.  
  22. msgList = [];
  23. _msgCount = 0;
  24. if (_status == "CustomStreamStart") then {
  25. _val = _result select 1;
  26. for "_i" from 1 to _val do {
  27. _data = "HiveEXT" callExtension _key;
  28. _result = call compile format ["%1",_data];
  29.  
  30. _status = _result select 0;
  31. msgList set [count msgList, _result];
  32. _msgCount = _msgCount + 1;
  33. };
  34. diag_log ("SERVER: Added " + str(_msgCount) + " messages!");
  35. };
  36.  
  37. //Send the key
  38. _key = format["CHILD:302:%1:", dayZ_instance];
  39. _data = "HiveEXT" callExtension _key;
  40.  
  41. diag_log("SERVER: Fetching objects...");
  42.  
  43. //Process result
  44. _result = call compile format ["%1", _data];
  45. _status = _result select 0;
  46.  
  47. _objList = [];
  48. _objCount = 0;
  49. if (_status == "ObjectStreamStart") then {
  50. _val = _result select 1;
  51. for "_i" from 1 to _val do {
  52. _data = "HiveEXT" callExtension _key;
  53. _result = call compile format ["%1",_data];
  54.  
  55. _status = _result select 0;
  56. _objList set [count _objList, _result];
  57. _objCount = _objCount + 1;
  58. };
  59. diag_log ("SERVER: Fetched " + str(_objCount) + " objects!");
  60. };
  61.  
  62. //Spawn objects
  63. _countr = 0;
  64. {
  65. //Parse individual vehicle row
  66. _countr = _countr + 1;
  67.  
  68. _idKey = _x select 1;
  69. _type = _x select 2;
  70. _ownerID = _x select 3;
  71.  
  72. _worldspace = _x select 4;
  73. _dir = 0;
  74. _pos = [0,0,0];
  75. _wsDone = false;
  76. if (count _worldspace >= 2) then
  77. {
  78. _dir = _worldspace select 0;
  79. if (count (_worldspace select 1) == 3) then {
  80. _pos = _worldspace select 1;
  81. _wsDone = true;
  82. }
  83. };
  84. if (!_wsDone) then {
  85. if (count _worldspace >= 1) then { _dir = _worldspace select 0; };
  86. _pos = [getMarkerPos "center",0,4000,10,0,2000,0] call BIS_fnc_findSafePos;
  87. if (count _pos < 3) then { _pos = [_pos select 0,_pos select 1,0]; };
  88. diag_log ("MOVED OBJ: " + str(_idKey) + " of class " + _type + " to pos: " + str(_pos));
  89. };
  90.  
  91. _intentory= _x select 5;
  92. _hitPoints= _x select 6;
  93. _fuel = _x select 7;
  94. _damage = _x select 8;
  95.  
  96. if (_damage < 1) then {
  97. diag_log("Spawned: " + str(_idKey) + " " + _type);
  98.  
  99. _object = createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"];
  100. _object setVariable ["lastUpdate",time];
  101.  
  102. // Don't set objects for deployables to ensure proper inventory updates
  103. if (_ownerID == "0") then {
  104. _object setVariable ["ObjectID", str(_idKey), true];
  105. } else {
  106. _object setVariable ["ObjectUID", _worldspace call dayz_objectUID2, true];
  107. };
  108.  
  109. _object setVariable ["CharacterID", _ownerID, true];
  110.  
  111. clearWeaponCargoGlobal _object;
  112. clearMagazineCargoGlobal _object;
  113.  
  114. if (_object isKindOf "TentStorage") then {
  115. _pos set [2,0];
  116. _object setpos _pos;
  117. };
  118. _object setdir _dir;
  119. _object setDamage _damage;
  120.  
  121. if (count _intentory > 0) then {
  122. //Add weapons
  123. _objWpnTypes = (_intentory select 0) select 0;
  124. _objWpnQty = (_intentory select 0) select 1;
  125. _countr = 0;
  126. {
  127. _isOK = isClass(configFile >> "CfgWeapons" >> _x);
  128. if (_isOK) then {
  129. _block = getNumber(configFile >> "CfgWeapons" >> _x >> "stopThis") == 1;
  130. if (!_block) then {
  131. _object addWeaponCargoGlobal [_x,(_objWpnQty select _countr)];
  132. };
  133. };
  134. _countr = _countr + 1;
  135. } forEach _objWpnTypes;
  136.  
  137. //Add Magazines
  138. _objWpnTypes = (_intentory select 1) select 0;
  139. _objWpnQty = (_intentory select 1) select 1;
  140. _countr = 0;
  141. {
  142. _isOK = isClass(configFile >> "CfgMagazines" >> _x);
  143. if (_isOK) then {
  144. _block = getNumber(configFile >> "CfgMagazines" >> _x >> "stopThis") == 1;
  145. if (!_block) then {
  146. _object addMagazineCargoGlobal [_x,(_objWpnQty select _countr)];
  147. };
  148. };
  149. _countr = _countr + 1;
  150. } forEach _objWpnTypes;
  151.  
  152. //Add Backpacks
  153. _objWpnTypes = (_intentory select 2) select 0;
  154. _objWpnQty = (_intentory select 2) select 1;
  155. _countr = 0;
  156. {
  157. _isOK = isClass(configFile >> "CfgVehicles" >> _x);
  158. if (_isOK) then {
  159. _block = getNumber(configFile >> "CfgVehicles" >> _x >> "stopThis") == 1;
  160. if (!_block) then {
  161. _object addBackpackCargoGlobal [_x,(_objWpnQty select _countr)];
  162. };
  163. };
  164. _countr = _countr + 1;
  165. } forEach _objWpnTypes;
  166. };
  167.  
  168. if (_object isKindOf "AllVehicles") then {
  169. {
  170. _selection = _x select 0;
  171. _dam = _x select 1;
  172. if (_selection in dayZ_explosiveParts and _dam > 0.8) then {_dam = 0.8};
  173. [_object,_selection,_dam] call object_setFixServer;
  174. } forEach _hitpoints;
  175. _object setvelocity [0,0,1];
  176. _object setFuel _fuel;
  177. if (getDammage _object == 1) then {
  178. _position = ([(getPosATL _object),0,100,10,0,500,0] call BIS_fnc_findSafePos);
  179. if (count _pos < 3) then { _pos = [_pos select 0,_pos select 1,0]; };
  180. _object setPosATL _position;
  181. };
  182. _object call fnc_vehicleEventHandler;
  183. };
  184.  
  185. //Monitor the object
  186. //_object enableSimulation false;
  187. dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object];
  188. };
  189. } forEach _objList;
  190. //Send the key
  191. _key = format["CHILD:999:select b.class_name, ib.worldspace from instance_building ib join building b on ib.building_id = b.id where ib.instance_id = ?:[%1]:", dayZ_instance];
  192. _data = "HiveEXT" callExtension _key;
  193.  
  194. diag_log("SERVER: Fetching buildings...");
  195.  
  196. //Process result
  197. _result = call compile format ["%1", _data];
  198. _status = _result select 0;
  199.  
  200. _bldList = [];
  201. _bldCount = 0;
  202. if (_status == "CustomStreamStart") then {
  203. _val = _result select 1;
  204. for "_i" from 1 to _val do {
  205. _data = "HiveEXT" callExtension _key;
  206. _result = call compile format ["%1",_data];
  207.  
  208. _pos = call compile (_result select 1);
  209. _dir = _pos select 0;
  210. _pos = _pos select 1;
  211.  
  212. _building = createVehicle [_result select 0, _pos, [], 0, "CAN_COLLIDE"];
  213. _building setDir _dir;
  214. _bldCount = _bldCount + 1;
  215. };
  216. diag_log ("SERVER: Spawned " + str(_bldCount) + " buildings!");
  217. };
  218.  
  219. //TIME
  220. _key = "CHILD:307:";
  221. _result = [_key] call server_hiveReadWrite;
  222. _outcome = _result select 0;
  223. if (_outcome == "PASS") then {
  224. _date = [2012,8,31,(_result select 1) select 3, (_result select 1) select 4];
  225. if (isDedicated) then {
  226. setDate _date;
  227. dayzSetDate = _date;
  228. publicVariable "dayzSetDate";
  229. };
  230.  
  231. diag_log("SERVER: Set local time to " + str(_date));
  232. };
  233.  
  234. createCenter civilian;
  235. if (isDedicated) then {
  236. endLoadingScreen;
  237. };
  238. hiveInUse = false;
  239.  
  240. if (isDedicated) then {
  241. _id = [] execFSM "\z\addons\dayz_server\system\server_cleanup.fsm";
  242. };
  243.  
  244. allowConnection = true;
  245. for "_x" from 1 to 6 do {
  246. _id = [] spawn spawn_carePackages;
  247. }; //Spawn care packages
  248. for "_x" from 1 to 20 do {
  249. _id = [] spawn spawn_wrecks;
  250. }; //Spawn wrecks
  251.  
  252. for "_x" from 1 to 4 do {
  253. _id = [] spawn spawn_heliCrash;
  254. }; //Spawn heli crash
  255. for "_x" from 1 to 1 do {
  256. _id = [] spawn spawn_sniperCrash;
  257. }; //Spawn sniper heli crash
  258. for "_x" from 1 to 1 do {
  259. _id = [] spawn spawn_mgCrash;
  260. }; //Spawn mg heli crash
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement