Guest User

compiles.sqf

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