Advertisement
Guest User

Compiles.sqf

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