Advertisement
NyxGrimlock

compiles.sqf

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