Advertisement
Guest User

compiles.sqf

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