Advertisement
DeTrix

complies.sqf

Apr 20th, 2014
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.49 KB | None | 0 0
  1. /*
  2. FUNCTION COMPILES
  3. */
  4. //Player only
  5. if (!isDedicated) then {
  6.  
  7. "filmic" setToneMappingParams [0.07, 0.31, 0.23, 0.37, 0.011, 3.750, 6, 4]; setToneMapping "Filmic";
  8.  
  9.  
  10.  
  11. BIS_Effects_Burn = compile preprocessFile "\ca\Data\ParticleEffects\SCRIPTS\destruction\burn.sqf";
  12. player_zombieCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieCheck.sqf"; //Run on a players computer, checks if the player is near a zombie
  13. player_zombieAttack = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieAttack.sqf"; //Run on a players computer, causes a nearby zombie to attack them
  14. fnc_usec_damageActions = compile preprocessFileLineNumbers "custom\fn_damageActions.sqf"; //Checks which actions for nearby casualty
  15. fnc_inAngleSector = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_inAngleSector.sqf"; //Checks which actions for nearby casualty
  16. fnc_usec_selfActions = compile preprocessFileLineNumbers "custom\fn_selfActions.sqf"; // fnc_usec_selfActions - adds custom actions to dayz code
  17. fnc_usec_unconscious = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_unconscious.sqf";
  18. player_temp_calculation = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_temperatur.sqf"; //Temperatur System //TeeChange
  19. player_weaponFiredNear = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_weaponFiredNear.sqf";
  20. player_animalCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_animalCheck.sqf";
  21. player_spawnCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_spawnCheck.sqf";
  22. player_dumpBackpack = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_dumpBackpack.sqf";
  23. // player_spawnLootCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_spawnlootCheck.sqf";
  24. // player_spawnZedCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_spawnzedCheck.sqf";
  25. building_spawnLoot = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\building_spawnLoot.sqf";
  26. // player_taskHint = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_taskHint.sqf";
  27. building_spawnZombies = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\building_spawnZombies.sqf";
  28. dayz_spaceInterrupt = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\dayz_spaceInterrupt.sqf";
  29. //animal_monitor = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\animal_monitor.sqf";
  30. // building_monitor = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\building_monitor.sqf";
  31. player_fired = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_fired.sqf"; //Runs when player fires. Alerts nearby Zeds depending on calibre and audial rating
  32. player_harvest = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_harvest.sqf";
  33. player_packTent = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_packTent.sqf";
  34. player_packVault = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_packVault.sqf";
  35. player_unlockVault = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_unlockVault.sqf";
  36.  
  37. player_removeObject = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\remove.sqf";
  38. player_removeNet = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_removeNet.sqf";
  39. player_removeTankTrap = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_removeTankTrap.sqf";
  40.  
  41. player_unlockDoor = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_unlockDoor.sqf";
  42. player_changeCombo = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_changeCombo.sqf";
  43.  
  44. player_lockVault = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_lockVault.sqf";
  45. // control_zombieAgent = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\control_zombieAgent.sqf";
  46. player_updateGui = compile preprocessFileLineNumbers "custom\player_updateGui.sqf";
  47. player_crossbowBolt = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_crossbowBolt.sqf";
  48. //spawn_flies = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\spawn_flies.sqf";
  49. // stream_locationFill = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\stream_locationFill.sqf";
  50. // stream_locationDel = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\stream_locationDel.sqf";
  51. // stream_locationCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\stream_locationCheck.sqf";
  52. player_music = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_music.sqf"; //Used to generate ambient music
  53. player_login = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_login.sqf"; //Used to generate ambient music
  54. player_death = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_death.sqf";
  55. player_switchModel = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_switchModel.sqf";
  56. player_checkStealth = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_checkStealth.sqf";
  57. world_sunRise = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_sunRise.sqf";
  58. world_surfaceNoise = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_surfaceNoise.sqf";
  59. player_humanityMorph = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_humanityMorph.sqf";
  60. player_throwObject = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_throwObject.sqf";
  61. player_alertZombies = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_alertZombies.sqf";
  62. player_fireMonitor = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\fire_monitor.sqf";
  63. fn_gearMenuChecks = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_gearMenuChecks.sqf";
  64.  
  65. //Objects
  66. object_roadFlare = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_roadFlare.sqf";
  67. object_setpitchbank = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_setpitchbank.sqf";
  68. object_monitorGear = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_monitorGear.sqf";
  69.  
  70. local_roadDebris = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_roadDebris.sqf";
  71.  
  72. //Zombies
  73. zombie_findTargetAgent = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\zombie_findTargetAgent.sqf";
  74. zombie_loiter = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\zombie_loiter.sqf"; //Server compile, used for loiter behaviour
  75. zombie_generate = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\zombie_generate.sqf"; //Server compile, used for loiter behaviour
  76. wild_spawnZombies = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\wild_spawnZombies.sqf"; //Server compile, used for loiter behaviour
  77.  
  78. pz_attack = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\pzombie\pz_attack.sqf";
  79.  
  80. //
  81. dog_findTargetAgent = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\dog_findTargetAgent.sqf";
  82.  
  83. //actions
  84. player_countmagazines = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_countmagazines.sqf";
  85. player_addToolbelt = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_addToolbelt.sqf";
  86. player_copyKey = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_copyKey.sqf";
  87. player_reloadMag = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_reloadMags.sqf";
  88. player_loadCrate = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_loadCrate.sqf";
  89. player_craftItem = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_craftItem.sqf";
  90. player_tentPitch = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\tent_pitch.sqf";
  91. player_vaultPitch = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\vault_pitch.sqf";
  92. player_drink = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_drink.sqf";
  93. player_eat = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_eat.sqf";
  94. player_useMeds = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_useMeds.sqf";
  95. player_fillWater = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\water_fill.sqf";
  96. player_makeFire = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_makefire.sqf";
  97. //player_chopWood = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_chopWood.sqf";
  98. player_harvestPlant = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_harvestPlant.sqf";
  99. player_goFishing = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_goFishing.sqf";
  100. player_build = compile preprocessFileLineNumbers "custom\snap_build\player_build.sqf";
  101. player_wearClothes = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_wearClothes.sqf";
  102. //player_dropWeapon = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_dropWeapon.sqf";
  103. //playerpip_setTrap = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_setTrap.sqf";
  104. object_pickup = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\object_pickup.sqf";
  105. player_flipvehicle = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_flipvehicle.sqf";
  106. player_sleep = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_sleep.sqf";
  107. //player_mineOre = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_mineOre.sqf";
  108. player_antiWall = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_antiWall.sqf";
  109. player_deathBoard = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\list_playerDeathsAlt.sqf";
  110.  
  111. player_plotPreview = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_showPlotRadius.sqf";
  112. player_upgradeVehicle = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_upgradeVehicle.sqf";
  113.  
  114. //ui
  115. player_selectSlot = compile preprocessFileLineNumbers "custom\ui_selectSlot.sqf";
  116. player_gearSync = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_gearSync.sqf";
  117. player_gearSet = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_gearSet.sqf";
  118. ui_changeDisplay = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\ui_changeDisplay.sqf";
  119. ui_gear_sound = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\ui_gear_sound.sqf";
  120.  
  121. //System
  122. player_monitor = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\player_monitor.sqf";
  123. player_spawn_1 = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\player_spawn_1.sqf";
  124. player_spawn_2 = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\player_spawn_2.sqf";
  125. onPreloadStarted "dayz_preloadFinished = false;";
  126. onPreloadFinished "dayz_preloadFinished = true;";
  127.  
  128. // helper functions
  129. player_hasTools = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_hasTools.sqf";
  130. player_checkItems = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_checkItems.sqf";
  131. player_removeItems = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_removeItems.sqf";
  132. // combination of check and remove items
  133. player_checkAndRemoveItems = {
  134. private ["_items","_b"];
  135. _items = _this;
  136. _b = _items call player_checkItems;
  137. if (_b) then {
  138. _b = _items call player_removeItems;
  139. };
  140. _b
  141. };
  142.  
  143.  
  144. epoch_totalCurrency = {
  145. // total currency
  146. _total_currency = 0;
  147. {
  148. _part = (configFile >> "CfgMagazines" >> _x);
  149. _worth = (_part >> "worth");
  150. if isNumber (_worth) then {
  151. _total_currency = _total_currency + getNumber(_worth);
  152. };
  153. } forEach (magazines player);
  154. _total_currency
  155. };
  156.  
  157. epoch_itemCost = {
  158. _trade_total = 0;
  159. {
  160. _part_in_configClass = configFile >> "CfgMagazines" >> (_x select 0);
  161. if (isClass (_part_in_configClass)) then {
  162. _part_inWorth = (_part_in_configClass >> "worth");
  163. if isNumber (_part_inWorth) then {
  164. _trade_total = _trade_total + (getNumber(_part_inWorth) * (_x select 1));
  165. };
  166. };
  167. } forEach _this;
  168.  
  169. diag_log format["DEBUG TRADER ITEMCOST: %1", _this];
  170. _trade_total
  171. };
  172.  
  173. epoch_returnChange = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\epoch_returnChange.sqf";
  174. // usage [["partinclassname",4]] call epoch_returnChange;
  175.  
  176.  
  177.  
  178.  
  179. //
  180. RunTime = 0;
  181. TotalRuns = 0;
  182.  
  183. fnc_dump = {
  184. private["_code","_benchmark","_averageRunTime"];
  185. _code = _this select 0;
  186. _benchmark = _this select 1;
  187.  
  188. RunTime = RunTime + _benchmark;
  189. TotalRuns = TotalRuns + 1;
  190. _averageRunTime = RunTime/TotalRuns;
  191.  
  192. diag_log format["%1 - %2 (%3 / %4)",_code,_benchmark,_averageRunTime,TotalRuns];
  193. };
  194. dayz_losChance = {
  195. private["_agent","_maxDis","_dis","_val","_maxExp","_myExp"];
  196. _agent = _this select 0;
  197. _dis = _this select 1;
  198. _maxDis = _this select 2;
  199. // diag_log ("VAL: " + str(_this));
  200. _val = (_maxDis - _dis) max 0;
  201. _maxExp = ((exp 2) * _maxDis);
  202. _myExp = ((exp 2) * (_val)) / _maxExp;
  203. _myExp = _myExp * 0.7;
  204. _myExp
  205. };
  206.  
  207. ui_initDisplay = {
  208. private["_control","_ctrlBleed","_display","_ctrlFracture","_ctrlDogFood","_ctrlDogWater","_ctrlDogWaterBorder", "_ctrlDogFoodBorder"];
  209. disableSerialization;
  210. _display = uiNamespace getVariable 'DAYZ_GUI_display';
  211. _control = _display displayCtrl 1204;
  212. _control ctrlShow false;
  213. if (!r_player_injured) then {
  214. _ctrlBleed = _display displayCtrl 1303;
  215. _ctrlBleed ctrlShow false;
  216. };
  217. if (!r_fracture_legs and !r_fracture_arms) then {
  218. _ctrlFracture = _display displayCtrl 1203;
  219. _ctrlFracture ctrlShow false;
  220. };
  221. _ctrlDogFoodBorder = _display displayCtrl 1501;
  222. _ctrlDogFoodBorder ctrlShow false;
  223. _ctrlDogFood = _display displayCtrl 1701;
  224. _ctrlDogFood ctrlShow false;
  225.  
  226. _ctrlDogWaterBorder = _display displayCtrl 1502;
  227. _ctrlDogWaterBorder ctrlShow false;
  228. _ctrlDogWater = _display displayCtrl 1702;
  229. _ctrlDogWater ctrlShow false
  230. };
  231.  
  232. dayz_losCheck = {
  233. private["_target","_agent","_cantSee"];
  234. _target = _this select 0; // PUT THE PLAYER IN FIRST ARGUMENT!!!!
  235. _agent = _this select 1;
  236. _cantSee = true;
  237. if (!isNull _target) then {
  238.  
  239. _tPos = visiblePositionASL _target;
  240. _zPos = visiblePositionASL _agent;
  241.  
  242. _tPos set [2,(_tPos select 2)+1];
  243. _zPos set [2,(_zPos select 2)+1];
  244.  
  245. if ((count _tPos > 0) and (count _zPos > 0)) then {
  246. _cantSee = terrainIntersectASL [_tPos, _zPos];
  247. if (!_cantSee) then {
  248. _cantSee = lineIntersects [_tPos, _zPos, _agent, vehicle _target];
  249. };
  250. };
  251. };
  252. _cantSee
  253. };
  254.  
  255. eh_zombieInit = {
  256. private["_unit","_pos"];
  257. //_unit = _this select 0;
  258. //_pos = getPosATL _unit;
  259. //_id = [_pos,_unit] execFSM "\z\AddOns\dayz_code\system\zombie_agent.fsm";
  260. };
  261.  
  262. dayz_equipCheck = {
  263. private ["_empty", "_needed","_diff","_success"];
  264. _config = _this;
  265. _empty = [player] call BIS_fnc_invSlotsEmpty;
  266. _needed = [_config] call BIS_fnc_invSlotType;
  267. _diff = [_empty,_needed] call BIS_fnc_vectorDiff;
  268.  
  269. _success = true;
  270. {
  271. if (_x > 0) then {_success = false};
  272. } forEach _diff;
  273. hint format["Config: %5\nEmpty: %1\nNeeded: %2\nDiff: %3\nSuccess: %4",_empty,_needed,_diff,_success,_config];
  274. _success
  275. };
  276.  
  277. vehicle_gear_count = {
  278. private["_counter"];
  279. _counter = 0;
  280. {
  281. _counter = _counter + _x;
  282. } forEach _this;
  283. _counter
  284. };
  285.  
  286. player_tagFriendlyMsg = {
  287. if(player == (_this select 0)) then {
  288. cutText[(localize "str_epoch_player_2"),"PLAIN DOWN"];
  289. };
  290. };
  291.  
  292. player_serverModelChange = {
  293. private["_object","_model"];
  294. _object = _this select 0;
  295. _model = _this select 1;
  296. if (_object == player) then {
  297. _model call player_switchModel;
  298. };
  299. };
  300.  
  301. player_guiControlFlash = {
  302. private["_control"];
  303. _control = _this;
  304. if (ctrlShown _control) then {
  305. _control ctrlShow false;
  306. } else {
  307. _control ctrlShow true;
  308. };
  309. };
  310.  
  311. gear_ui_offMenu = {
  312. private["_control","_parent","_menu"];
  313. disableSerialization;
  314. _control = _this select 0;
  315. _parent = findDisplay 106;
  316. if (!(_this select 3)) then {
  317. for "_i" from 0 to 9 do {
  318. _menu = _parent displayCtrl (1600 + _i);
  319. _menu ctrlShow false;
  320. };
  321. _grpPos = ctrlPosition _control;
  322. _grpPos set [3,0];
  323. _control ctrlSetPosition _grpPos;
  324. _control ctrlShow false;
  325. _control ctrlCommit 0;
  326. };
  327. };
  328.  
  329. dze_surrender_off = {
  330. player setVariable ["DZE_Surrendered", false, true];
  331. DZE_Surrender = false;
  332. };
  333.  
  334. gear_ui_init = {
  335. private["_control","_parent","_menu","_dspl","_grpPos"];
  336. disableSerialization;
  337. _parent = findDisplay 106;
  338. _control = _parent displayCtrl 6902;
  339. for "_i" from 0 to 9 do {
  340. _menu = _parent displayCtrl (1600 + _i);
  341. _menu ctrlShow false;
  342. };
  343. _grpPos = ctrlPosition _control;
  344. _grpPos set [3,0];
  345. _control ctrlSetPosition _grpPos;
  346. _control ctrlShow false;
  347. _control ctrlCommit 0;
  348. };
  349.  
  350. dayz_eyeDir = {
  351. private["_vval","_vdir"];
  352. _vval = (eyeDirection _this);
  353. _vdir = (_vval select 0) atan2 (_vval select 1);
  354. if (_vdir < 0) then {_vdir = 360 + _vdir};
  355. _vdir
  356. };
  357.  
  358. DZE_getModelName = {
  359. _objInfo = toArray(str(_this));
  360. _lenInfo = count _objInfo - 1;
  361. _objName = [];
  362. _i = 0;
  363. // determine where the object name starts
  364. {
  365. if (58 == _objInfo select _i) exitWith {};
  366. _i = _i + 1;
  367. } forEach _objInfo;
  368. _i = _i + 2; // skip the ": " part
  369. for "_k" from _i to _lenInfo do {
  370. _objName = _objName + [_objInfo select _k];
  371. };
  372. _objName = toLower(toString(_objName));
  373. _objName
  374. };
  375.  
  376. dze_isnearest_player = {
  377. private ["_notClosest","_playerDistance","_nearPlayers","_obj","_playerNear"];
  378. if(!isNull _this) then {
  379. _nearPlayers = _this nearEntities ["CAManBase", 12];
  380. _playerNear = ({isPlayer _x} count _nearPlayers) > 1;
  381. _notClosest = false;
  382. if (_playerNear) then {
  383. // check if another player is closer
  384. _playerDistance = player distance _this;
  385. {
  386. if (_playerDistance > (_x distance _this)) exitWith { _notClosest = true; };
  387. } forEach _nearPlayers;
  388. };
  389. } else {
  390. _notClosest = false;
  391. };
  392. _notClosest
  393. };
  394.  
  395. // trader menu code
  396. if (DZE_ConfigTrader) then {
  397. call compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_traderMenuConfig.sqf";
  398. }else{
  399. call compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_traderMenuHive.sqf";
  400. };
  401. // recent murders menu code
  402. call compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_murderMenu.sqf";
  403.  
  404. //This is still needed but the fsm should terminate if any errors pop up.
  405. [] spawn {
  406. private["_timeOut","_display","_control1","_control2"];
  407. disableSerialization;
  408. _timeOut = 0;
  409. dayz_loadScreenMsg = "";
  410. diag_log "DEBUG: loadscreen guard started.";
  411. _display = uiNameSpace getVariable "BIS_loadingScreen";
  412. if (!isNil "_display") then {
  413. _control1 = _display displayctrl 8400;
  414. _control2 = _display displayctrl 102;
  415. };
  416. if (!isNil "dayz_DisplayGenderSelect") then {
  417. waitUntil {!dayz_DisplayGenderSelect};
  418. };
  419.  
  420. // 120 sec timeout (12000 * 0.01)
  421. while { _timeOut < 12000 } do {
  422. if (dayz_clientPreload && dayz_authed) exitWith { diag_log "PLOGIN: Login loop completed!"; };
  423. if (!isNil "_display") then {
  424. if ( isNull _display ) then {
  425. waitUntil { !dialog; };
  426. startLoadingScreen ["","RscDisplayLoadCustom"];
  427. _display = uiNameSpace getVariable "BIS_loadingScreen";
  428. _control1 = _display displayctrl 8400;
  429. _control2 = _display displayctrl 102;
  430. };
  431.  
  432. if ( dayz_loadScreenMsg != "" ) then {
  433. _control1 ctrlSetText dayz_loadScreenMsg;
  434. dayz_loadScreenMsg = "";
  435. };
  436.  
  437. _control2 ctrlSetText format["%1",round(_timeOut*0.01)];
  438. };
  439.  
  440. _timeOut = _timeOut + 1;
  441.  
  442. if (_timeOut >= 12000) then {
  443. 1 cutText [localize "str_player_login_timeout", "PLAIN DOWN"];
  444. sleep 10;
  445. endLoadingScreen;
  446. endMission "END1";
  447. };
  448.  
  449. sleep 0.01;
  450. };
  451. };
  452.  
  453. dayz_meleeMagazineCheck = {
  454. private["_meleeNum","_magType"];
  455. _magType = ([] + getArray (configFile >> "CfgWeapons" >> _wpnType >> "magazines")) select 0;
  456. _meleeNum = ({_x == _magType} count magazines player);
  457. if (_meleeNum < 1) then {
  458. player addMagazine _magType;
  459. };
  460. };
  461.  
  462. dayz_originalPlayer = player;
  463.  
  464. progressLoadingScreen 0.8;
  465. };
  466.  
  467. //Both
  468. BIS_fnc_selectRandom = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BIS_fnc\fn_selectRandom.sqf";
  469. BIS_fnc_vectorAdd = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BIS_fnc\fn_vectorAdd.sqf";
  470. BIS_fnc_halo = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BIS_fnc\fn_halo.sqf";
  471. BIS_fnc_findNestedElement = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BIS_fnc\fn_findNestedElement.sqf";
  472. BIS_fnc_param = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BIS_fnc\fn_param.sqf";
  473.  
  474. fnc_buildWeightedArray = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_buildWeightedArray.sqf"; //Checks which actions for nearby casualty
  475. fnc_usec_damageVehicle = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandlerVehicle.sqf"; //Event handler run on damage
  476. zombie_initialize = compile preprocessFileLineNumbers "\z\addons\dayz_code\init\zombie_init.sqf";
  477. // object_vehicleKilled = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_vehicleKilled.sqf"; //Event handler run on damage
  478. object_setHitServer = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_setHitServer.sqf"; //process the hit as a NORMAL damage (useful for persistent vehicles)
  479. object_setFixServer = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_setFixServer.sqf"; //process the hit as a NORMAL damage (useful for persistent vehicles)
  480. object_getHit = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_getHit.sqf"; //gets the hit value for a HitPoint (i.e. HitLegs) against the selection (i.e. "legs"), returns the value
  481. object_setHit = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_setHit.sqf"; //process the hit as a NORMAL damage (useful for persistent vehicles)
  482. object_processHit = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_processHit.sqf"; //process the hit in the REVO damage system (records and sets hit)
  483. object_delLocal = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_delLocal.sqf";
  484. // object_cargoCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_cargoCheck.sqf"; //Run by the player or server to monitor changes in cargo contents
  485. fnc_usec_damageHandler = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandler.sqf"; //Event handler run on damage
  486. fnc_veh_ResetEH = compile preprocessFileLineNumbers "\z\addons\dayz_code\init\veh_ResetEH.sqf"; //Initialize vehicle
  487. // Vehicle damage fix
  488. vehicle_handleDamage = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_handleDamage.sqf";
  489. vehicle_handleKilled = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_handleKilled.sqf";
  490. //fnc_vehicleEventHandler = compile preprocessFileLineNumbers "\z\addons\dayz_code\init\vehicle_init.sqf"; //Initialize vehicle
  491. fnc_inString = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_inString.sqf";
  492. fnc_isInsideBuilding = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_isInsideBuilding.sqf"; //_isInside = [_unit,_building] call fnc_isInsideBuilding;
  493. fnc_isInsideBuilding2 = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_isInsideBuilding2.sqf"; //_isInside = [_unit,_building] call fnc_isInsideBuilding;
  494. fnc_isInsideBuilding3 = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_isInsideBuilding3.sqf"; //_isInside = [_unit,_building] call fnc_isInsideBuilding;
  495. dayz_zombieSpeak = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_speak.sqf"; //Used to generate random speech for a unit
  496. vehicle_getHitpoints = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_getHitpoints.sqf";
  497. local_gutObject = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_gutObject.sqf"; //Generated on the server (or local to unit) when gutting an object
  498. local_lockUnlock = compile preprocessFileLineNumbers "Custom\local_lockUnlock.sqf"; //When vehicle is local to unit perform locking vehicle
  499. local_gutObjectZ = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_gutObjectZ.sqf"; //Generated on the server (or local to unit) when gutting an object
  500. local_zombieDamage = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandlerZ.sqf"; //Generated by the client who created a zombie to track damage
  501. local_setFuel = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_setFuel.sqf"; //Generated when someone refuels a vehicle
  502. local_eventKill = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_eventKill.sqf"; //Generated when something is killed
  503. //player_weaponCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_weaponCheck.sqf"; //Run by the player or server to monitor whether they have picked up a new weapon
  504. curTimeStr = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_curTimeStr.sqf";
  505. player_medBandage = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medBandaged.sqf";
  506. player_medInject = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medInject.sqf";
  507. player_medEpi = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medEpi.sqf";
  508. player_medTransfuse = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medTransfuse.sqf";
  509. player_medMorphine = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medMorphine.sqf";
  510. player_breaklegs = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medBreakLegs.sqf";
  511. player_medPainkiller = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medPainkiller.sqf";
  512. world_isDay = {if ((daytime < (24 - dayz_sunRise)) and (daytime > dayz_sunRise)) then {true} else {false}};
  513. player_humanityChange = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_humanityChange.sqf";
  514. spawn_loot = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\spawn_loot.sqf";
  515. spawn_loot_small = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\spawn_loot_small.sqf";
  516. // player_projectileNear = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_projectileNear.sqf";
  517.  
  518. dayz_HungerThirst = {
  519. dayz_hunger = dayz_hunger + (_this select 0);
  520. dayz_thirst = dayz_thirst + (_this select 1);
  521. };
  522.  
  523. // better item counting by maca134 - https://github.com/vbawol/DayZ-Epoch/issues/916
  524. MC_item_spaces = {
  525. private ["_unit", "_item", "_slotsEmpty", "_slotsItem", "_slotsAfterAdd", "_c", "_space"];
  526. _unit = _this select 0;
  527. _item = _this select 1;
  528.  
  529. _slotsEmpty = [_unit] call BIS_fnc_invSlotsEmpty;
  530. _slotsItem = [_item] call BIS_fnc_invSlotType;
  531. if ((typeName _unit) != "OBJECT") exitWith {textLogFormat ["INV_ Error: BIS_FNC_invAdd - 1st parameter must be unit! %1", _this];false};
  532. if (((typeName _item) != "CONFIG") && ((typeName _item) != "STRING")) exitWith {textLogFormat ["INV_ Error: BIS_FNC_invAdd - 2nd parameter must be config|string|array of (config|string)! %1", _this];false};
  533. if (isNil {_item}) exitWith {textLogFormat ["INV_ Error: BIS_FNC_invAdd - 2nd parameter - _item is undefined! %1", _this];false};
  534. _c = 0;
  535. _space = 0;
  536. {
  537. if (_x > 0) exitWith {
  538. _space = floor((_slotsEmpty select _c) / _x);
  539. };
  540. _c = _c + 1;
  541. } forEach _slotsItem;
  542. _space
  543. };
  544.  
  545. dayz_EjectPlayer = {
  546. // check if player in vehicle
  547. private ["_noDriver","_vehicle","_inVehicle"];
  548. _vehicle = vehicle player;
  549. _inVehicle = (_vehicle != player);
  550. if(_inVehicle) then {
  551. _noDriver = ((_vehicle emptyPositions "driver") > 0);
  552. if (_noDriver and (speed _vehicle) != 0) then {
  553. player action [ "eject", _vehicle];
  554. };
  555. };
  556. };
  557.  
  558. player_sumMedical = {
  559. private["_character","_wounds","_legs","_arms","_medical"];
  560. _character = _this;
  561. _wounds = [];
  562. if (_character getVariable["USEC_injured",false]) then {
  563. {
  564. if (_character getVariable[_x,false]) then {
  565. _wounds set [count _wounds,_x];
  566. };
  567. } forEach USEC_typeOfWounds;
  568. };
  569. _legs = _character getVariable ["hit_legs",0];
  570. _arms = _character getVariable ["hit_arms",0];
  571. _medical = [
  572. _character getVariable["USEC_isDead",false],
  573. _character getVariable["NORRN_unconscious", false],
  574. _character getVariable["USEC_infected",false],
  575. _character getVariable["USEC_injured",false],
  576. _character getVariable["USEC_inPain",false],
  577. _character getVariable["USEC_isCardiac",false],
  578. _character getVariable["USEC_lowBlood",false],
  579. _character getVariable["USEC_BloodQty",12000],
  580. _wounds,
  581. [_legs,_arms],
  582. _character getVariable["unconsciousTime",0],
  583. _character getVariable["messing",[0,0]]
  584. ];
  585. _medical
  586. };
  587.  
  588. //Server Only
  589. if (isServer) then {
  590. call compile preprocessFileLineNumbers "\z\addons\dayz_server\init\server_functions.sqf";
  591. } else {
  592. eh_localCleanup = {};
  593. };
  594.  
  595. initialized = true;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement