Guest User

compiles.sqf

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