Guest User

compiles.sqf EPOCH 1.0.5.1

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