Advertisement
Guest User

Untitled

a guest
Feb 10th, 2015
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.52 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 "Custom\A_Plot_for_Life\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 "Custom\A_Plot_for_Life\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 "Custom\Snap_Pro\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 "Custom\A_Plot_for_Life\Compile\player_packTent.sqf";
  27. player_packVault = compile preprocessFileLineNumbers "Custom\A_Plot_for_Life\Compile\player_packVault.sqf";
  28. player_unlockVault = compile preprocessFileLineNumbers "Custom\A_Plot_for_Life\Compile\player_unlockVault.sqf";
  29. //player_removeObject = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\remove.sqf";
  30. player_removeObject = compile preprocessFileLineNumbers "custom\remove.sqf"; //gem rarity change
  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 "Custom\A_Plot_for_Life\Compile\player_lockVault.sqf";
  55. player_updateGui = compile preprocessFileLineNumbers "Custom\A_Plot_for_Life\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 "Custom\A_Plot_for_Life\Action\tent_pitch.sqf";
  94. player_vaultPitch = compile preprocessFileLineNumbers "Custom\A_Plot_for_Life\Action\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. player_build = compile preprocessFileLineNumbers "Custom\A_Plot_for_Life\Action\modular_build.sqf";
  104. //player_build = compile preprocessFileLineNumbers "custom\snap_pro\player_build.sqf";
  105. player_build_countNearby = compile preprocessFileLineNumbers "Custom\A_Plot_for_Life\Action\player_build_countNearby.sqf";
  106. player_build_states = compile preprocessFileLineNumbers "Custom\A_Plot_for_Life\Action\player_build_states.sqf";
  107. player_build_needNearby = compile preprocessFileLineNumbers "Custom\A_Plot_for_Life\Action\player_build_needNearby.sqf";
  108. player_build_getConfig = compile preprocessFileLineNumbers "Custom\A_Plot_for_Life\Action\player_build_getConfig.sqf";
  109. player_build_plotCheck = compile preprocessFileLineNumbers "Custom\A_Plot_for_Life\Action\player_build_plotCheck.sqf";
  110. player_build_buildReq = compile preprocessFileLineNumbers "Custom\A_Plot_for_Life\Action\player_build_buildReq.sqf";
  111. player_build_create = compile preprocessFileLineNumbers "Custom\A_Plot_for_Life\Action\player_build_create.sqf";
  112. player_build_controls = compile preprocessFileLineNumbers "Custom\A_Plot_for_Life\Action\player_build_controls.sqf";
  113. player_build_publish = compile preprocessFileLineNumbers "Custom\A_Plot_for_Life\Action\player_build_publish.sqf";
  114. DZE_snap_build_file = "Custom\Snap_Pro\snap_build.sqf"; // Set as a global variable as it is also referenced in snapbuild.sqf
  115. snap_build = compile preprocessFileLineNumbers DZE_snap_build_file;
  116.  
  117. FNC_check_owner = compile preprocessFileLineNumbers "Custom\A_Plot_for_Life\Compile\fn_check_owner.sqf";
  118. FNC_find_plots = compile preprocessFileLineNumbers "Custom\A_Plot_for_Life\Compile\fn_find_plots.sqf";
  119.  
  120. player_wearClothes = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_wearClothes.sqf";
  121. object_pickup = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\object_pickup.sqf";
  122. player_flipvehicle = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_flipvehicle.sqf";
  123. player_sleep = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_sleep.sqf";
  124. player_antiWall = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_antiWall.sqf";
  125. player_deathBoard = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\list_playerDeathsAlt.sqf";
  126.  
  127. player_plotPreview = compile preprocessFileLineNumbers "Custom\A_Plot_for_Life\Action\object_showPlotRadius.sqf";
  128. player_upgradeVehicle = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_upgradeVehicle.sqf";
  129.  
  130. //ui
  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 { diag_log "PLOGIN: Login loop completed!"; };
  455. if (!isNil "_display") then {
  456. if ( isNull _display ) then {
  457. waitUntil { !dialog; };
  458. startLoadingScreen ["","RscDisplayLoadCustom"];
  459. _display = uiNameSpace getVariable "BIS_loadingScreen";
  460. _control1 = _display displayctrl 8400;
  461. _control2 = _display displayctrl 102;
  462. };
  463.  
  464. if ( dayz_loadScreenMsg != "" ) then {
  465. _control1 ctrlSetText dayz_loadScreenMsg;
  466. dayz_loadScreenMsg = "";
  467. };
  468.  
  469. _control2 ctrlSetText format["%1",round(_timeOut*0.01)];
  470. };
  471.  
  472. _timeOut = _timeOut + 1;
  473.  
  474. if (_timeOut >= 12000) then {
  475. 1 cutText [localize "str_player_login_timeout", "PLAIN DOWN"];
  476. sleep 10;
  477. endLoadingScreen;
  478. endMission "END1";
  479. };
  480.  
  481. sleep 0.01;
  482. };
  483. };
  484.  
  485. dayz_meleeMagazineCheck = {
  486. private["_meleeNum","_magType"];
  487. _magType = ([] + getArray (configFile >> "CfgWeapons" >> _wpnType >> "magazines")) select 0;
  488. _meleeNum = ({_x == _magType} count magazines player);
  489. if (_meleeNum < 1) then {
  490. player addMagazine _magType;
  491. };
  492. };
  493.  
  494. dayz_originalPlayer = player;
  495.  
  496. progressLoadingScreen 0.8;
  497. };
  498.  
  499. //Both
  500. BIS_fnc_selectRandom = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BIS_fnc\fn_selectRandom.sqf";
  501. BIS_fnc_vectorAdd = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BIS_fnc\fn_vectorAdd.sqf";
  502. BIS_fnc_halo = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BIS_fnc\fn_halo.sqf";
  503. BIS_fnc_findNestedElement = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BIS_fnc\fn_findNestedElement.sqf";
  504. BIS_fnc_param = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BIS_fnc\fn_param.sqf";
  505.  
  506. fnc_buildWeightedArray = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_buildWeightedArray.sqf"; //Checks which actions for nearby casualty
  507. fnc_usec_damageVehicle = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandlerVehicle.sqf"; //Event handler run on damage
  508.  
  509. // object_vehicleKilled = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_vehicleKilled.sqf"; //Event handler run on damage
  510. object_setHitServer = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_setHitServer.sqf"; //process the hit as a NORMAL damage (useful for persistent vehicles)
  511. object_setFixServer = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_setFixServer.sqf"; //process the hit as a NORMAL damage (useful for persistent vehicles)
  512. 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
  513. object_setHit = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_setHit.sqf"; //process the hit as a NORMAL damage (useful for persistent vehicles)
  514. object_processHit = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_processHit.sqf"; //process the hit in the REVO damage system (records && sets hit)
  515. object_delLocal = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_delLocal.sqf";
  516. // object_cargoCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_cargoCheck.sqf"; //Run by the player || server to monitor changes in cargo contents
  517. fnc_usec_damageHandler = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandler.sqf"; //Event handler run on damage
  518. fnc_veh_ResetEH = compile preprocessFileLineNumbers "\z\addons\dayz_code\init\veh_ResetEH.sqf"; //Initialize vehicle
  519. // Vehicle damage fix
  520. vehicle_handleDamage = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_handleDamage.sqf";
  521. vehicle_handleKilled = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_handleKilled.sqf";
  522. //fnc_vehicleEventHandler = compile preprocessFileLineNumbers "\z\addons\dayz_code\init\vehicle_init.sqf"; //Initialize vehicle
  523. fnc_inString = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_inString.sqf";
  524. fnc_isInsideBuilding = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_isInsideBuilding.sqf"; //_isInside = [_unit,_building] call fnc_isInsideBuilding;
  525. fnc_isInsideBuilding2 = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_isInsideBuilding2.sqf"; //_isInside = [_unit,_building] call fnc_isInsideBuilding2;
  526. fnc_isInsideBuilding3 = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_isInsideBuilding3.sqf"; //_isInside = [_unit,_building] call fnc_isInsideBuilding3;
  527. dayz_zombieSpeak = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_speak.sqf"; //Used to generate random speech for a unit
  528. vehicle_getHitpoints = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_getHitpoints.sqf";
  529. local_gutObject = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_gutObject.sqf"; //Generated on the server (|| local to unit) when gutting an object
  530. local_lockUnlock = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_lockUnlock.sqf"; //When vehicle is local to unit perform locking vehicle
  531. local_gutObjectZ = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_gutObjectZ.sqf"; //Generated on the server (|| local to unit) when gutting an object
  532. local_zombieDamage = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandlerZ.sqf"; //Generated by the client who created a zombie to track damage
  533. local_eventKill = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_eventKill.sqf"; //Generated when something is killed
  534. //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
  535. curTimeStr = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_curTimeStr.sqf";
  536. player_medBandage = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medBandaged.sqf";
  537. player_medInject = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medInject.sqf";
  538. player_medEpi = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medEpi.sqf";
  539. player_medTransfuse = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medTransfuse.sqf";
  540. player_medMorphine = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medMorphine.sqf";
  541. player_breaklegs = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medBreakLegs.sqf";
  542. player_medPainkiller = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medPainkiller.sqf";
  543. world_isDay = {if ((daytime < (24 - dayz_sunRise)) && (daytime > dayz_sunRise)) then {true} else {false}};
  544. player_humanityChange = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_humanityChange.sqf";
  545. spawn_loot = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\spawn_loot.sqf";
  546. spawn_loot_small = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\spawn_loot_small.sqf";
  547. // player_projectileNear = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_projectileNear.sqf";
  548.  
  549. FNC_GetPlayerUID = {
  550. private ["_object","_version","_PID"];
  551. _object = _this select 0;
  552. _version = productVersion select 3;
  553. if (DayZ_UseSteamID) then {
  554. _PID = GetPlayerUID _object;
  555. } else {
  556. if (_version >= 125548) then {
  557. _PID = call (compile "GetPlayerUIDOld _object");
  558. } else {
  559. _PID = GetPlayerUID _object;
  560. 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];
  561. };
  562. };
  563. _PID
  564. };
  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.  
  577. FNC_GetPos = {
  578. private "_pos";
  579. if (isNil {_this select 0}) exitWith {[0,0,0]};
  580. _thingy = _this select 0;
  581. _pos = getPosASL _thingy;
  582. if !(surfaceIsWater _pos) then {
  583. _pos = ASLToATL _pos;
  584. };
  585. _pos
  586. };
  587.  
  588. local_setFuel = {
  589. private["_qty","_vehicle"];
  590. _vehicle = _this select 0;
  591. _qty = _this select 1;
  592. _vehicle setFuel _qty;
  593. };
  594.  
  595. zombie_initialize = {
  596. private ["_unit","_position"];
  597. _unit = _this select 0;
  598. if (isServer) then {
  599. _unit addEventHandler ["local", {_this call zombie_findOwner}];
  600. };
  601. _id = _unit addeventhandler["HandleDamage", { _this call local_zombieDamage }];
  602. _id = _unit addeventhandler["Killed", { [_this, "zombieKills"] call local_eventKill }];
  603. };
  604.  
  605. dayz_EjectPlayer = {
  606. // check if player in vehicle
  607. private ["_noDriver","_vehicle","_inVehicle"];
  608. _vehicle = vehicle player;
  609. _inVehicle = (_vehicle != player);
  610. if(_inVehicle) then {
  611. _noDriver = ((_vehicle emptyPositions "driver") > 0);
  612. if (_noDriver && (speed _vehicle) != 0) then {
  613. player action [ "eject", _vehicle];
  614. };
  615. };
  616. };
  617.  
  618. player_sumMedical = {
  619. private["_character","_wounds","_legs","_arms","_medical"];
  620. _character = _this;
  621. _wounds = [];
  622. if (_character getVariable["USEC_injured",false]) then {
  623. {
  624. if (_character getVariable[_x,false]) then {
  625. _wounds set [count _wounds,_x];
  626. };
  627. } count USEC_typeOfWounds;
  628. };
  629. _legs = _character getVariable ["hit_legs",0];
  630. _arms = _character getVariable ["hit_arms",0];
  631. _medical = [
  632. _character getVariable["USEC_isDead",false],
  633. _character getVariable["NORRN_unconscious", false],
  634. _character getVariable["USEC_infected",false],
  635. _character getVariable["USEC_injured",false],
  636. _character getVariable["USEC_inPain",false],
  637. _character getVariable["USEC_isCardiac",false],
  638. _character getVariable["USEC_lowBlood",false],
  639. _character getVariable["USEC_BloodQty",12000],
  640. _wounds,
  641. [_legs,_arms],
  642. _character getVariable["unconsciousTime",0],
  643. _character getVariable["messing",[0,0]]
  644. ];
  645. _medical
  646. };
  647.  
  648. //Server Only
  649. if (isServer) then {
  650. call compile preprocessFileLineNumbers "custom\init\server_functions.sqf";
  651. } else {
  652. eh_localCleanup = {};
  653. };
  654.  
  655. initialized = true;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement