Guest User

Compiles.sqf

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