Advertisement
Guest User

Untitled

a guest
Oct 28th, 2014
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 32.01 KB | None | 0 0
  1. /*
  2. FUNCTION COMPILES
  3. */
  4. //Player only
  5.  
  6. // usage
  7. // _removed = [player, 5000] call SC_fnc_removeCoins;
  8. // if(_removed = true)then{ GREAT SUCCES }else{ IT FAILED, not enoguh money};
  9.  
  10. SC_fnc_removeCoins=
  11. {
  12. private ["_player","_amount","_wealth","_newwealth", "_result"];
  13. _player = _this select 0;
  14. _amount = _this select 1;
  15. _result = false;
  16. _wealth = _player getVariable["cashMoney",0];
  17. if(_amount > 0)then{
  18. if (_wealth < _amount) then {
  19. _result = false;
  20. } else {
  21. _newwealth = _wealth - _amount;
  22. _player setVariable["cashMoney",_newwealth, true];
  23. _player setVariable ["moneychanged",1,true];
  24. _result = true;
  25. PVDZE_plr_Save = [_player,(magazines _player),true,true] ;
  26. publicVariableServer "PVDZE_plr_Save";
  27. };
  28. }else{
  29. _result = true;
  30. };
  31. _result
  32. };
  33.  
  34. // usage
  35. // _added = [player, 5000] call SC_fnc_addCoins;
  36. // if(_added = true)then{ GREAT SUCCES }else{ IT FAILED, Something went wrong};
  37.  
  38. SC_fnc_addCoins =
  39. {
  40. private ["_player","_amount","_wealth","_newwealth", "_result"];
  41. _player = _this select 0;
  42. _amount = _this select 1;
  43. _result = false;
  44. _wealth = _player getVariable["cashMoney",0];
  45. _player setVariable["cashMoney",_wealth + _amount, true];
  46. PVDZE_plr_Save = [_player,(magazines _player),true,true] ;
  47. publicVariableServer "PVDZE_plr_Save";
  48. _player setVariable ["moneychanged",1,true];
  49. _newwealth = _player getVariable["cashMoney",0];
  50. if (_newwealth >= _wealth) then { _result = true; };
  51. _result
  52. };
  53.  
  54. BIS_fnc_numberDigits = compile preprocessFileLineNumbers "custom\numberDigits.sqf";
  55. BIS_fnc_numberText = compile preprocessFileLineNumbers "custom\numberText.sqf";
  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 "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 "\z\addons\dayz_code\compile\zombie_generate.sqf"; //Server compile, used for loiter behaviour
  131. wild_spawnZombies = compile preprocessFileLineNumbers "\z\addons\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 "\z\addons\dayz_code\actions\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. // combination of check && remove items
  186. player_checkAndRemoveItems = {
  187. private ["_items","_b"];
  188. _items = _this;
  189. _b = _items call player_checkItems;
  190. if (_b) then {
  191. _b = _items call player_removeItems;
  192. };
  193. _b
  194. };
  195.  
  196. dayz_HungerThirst = {
  197. dayz_hunger = dayz_hunger + (_this select 0);
  198. dayz_thirst = dayz_thirst + (_this select 1);
  199. };
  200.  
  201. epoch_totalCurrency = {
  202. // total currency
  203. _total_currency = 0;
  204. {
  205. _part = (configFile >> "CfgMagazines" >> _x);
  206. _worth = (_part >> "worth");
  207. if isNumber (_worth) then {
  208. _total_currency = _total_currency + getNumber(_worth);
  209. };
  210. } count (magazines player);
  211. _total_currency
  212. };
  213.  
  214. epoch_itemCost = {
  215. _trade_total = 0;
  216. {
  217. _part_in_configClass = configFile >> "CfgMagazines" >> (_x select 0);
  218. if (isClass (_part_in_configClass)) then {
  219. _part_inWorth = (_part_in_configClass >> "worth");
  220. if isNumber (_part_inWorth) then {
  221. _trade_total = _trade_total + (getNumber(_part_inWorth) * (_x select 1));
  222. };
  223. };
  224. } count _this;
  225.  
  226. //diag_log format["DEBUG TRADER ITEMCOST: %1", _this];
  227. _trade_total
  228. };
  229.  
  230. epoch_returnChange = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\epoch_returnChange.sqf";
  231. // usage [["partinclassname",4]] call epoch_returnChange;
  232.  
  233. dayz_losChance = {
  234. private["_agent","_maxDis","_dis","_val","_maxExp","_myExp"];
  235. _agent = _this select 0;
  236. _dis = _this select 1;
  237. _maxDis = _this select 2;
  238. // diag_log ("VAL: " + str(_this));
  239. _val = (_maxDis - _dis) max 0;
  240. _maxExp = ((exp 2) * _maxDis);
  241. _myExp = ((exp 2) * (_val)) / _maxExp;
  242. _myExp = _myExp * 0.7;
  243. _myExp
  244. };
  245.  
  246. ui_initDisplay = {
  247. private["_control","_ctrlBleed","_display","_ctrlFracture","_ctrlDogFood","_ctrlDogWater","_ctrlDogWaterBorder", "_ctrlDogFoodBorder"];
  248. disableSerialization;
  249. _display = uiNamespace getVariable 'DAYZ_GUI_display';
  250. _control = _display displayCtrl 1204;
  251. _control ctrlShow false;
  252. if (!r_player_injured) then {
  253. _ctrlBleed = _display displayCtrl 1303;
  254. _ctrlBleed ctrlShow false;
  255. };
  256. if (!r_fracture_legs && !r_fracture_arms) then {
  257. _ctrlFracture = _display displayCtrl 1203;
  258. _ctrlFracture ctrlShow false;
  259. };
  260. _ctrlDogFoodBorder = _display displayCtrl 1501;
  261. _ctrlDogFoodBorder ctrlShow false;
  262. _ctrlDogFood = _display displayCtrl 1701;
  263. _ctrlDogFood ctrlShow false;
  264.  
  265. _ctrlDogWaterBorder = _display displayCtrl 1502;
  266. _ctrlDogWaterBorder ctrlShow false;
  267. _ctrlDogWater = _display displayCtrl 1702;
  268. _ctrlDogWater ctrlShow false
  269. };
  270.  
  271. dayz_losCheck = {
  272. private["_target","_agent","_cantSee"];
  273. _target = _this select 0; // PUT THE PLAYER IN FIRST ARGUMENT!!!!
  274. _agent = _this select 1;
  275. _cantSee = true;
  276. if (!isNull _target) then {
  277.  
  278. _tPos = visiblePositionASL _target;
  279. _zPos = visiblePositionASL _agent;
  280.  
  281. _tPos set [2,(_tPos select 2)+1];
  282. _zPos set [2,(_zPos select 2)+1];
  283.  
  284. if ((count _tPos > 0) && (count _zPos > 0)) then {
  285. _cantSee = terrainIntersectASL [_tPos, _zPos];
  286. if (!_cantSee) then {
  287. _cantSee = lineIntersects [_tPos, _zPos, _agent, vehicle _target];
  288. };
  289. };
  290. };
  291. _cantSee
  292. };
  293.  
  294. dayz_equipCheck = {
  295. private ["_empty", "_needed","_diff","_success"];
  296. _config = _this;
  297. _empty = [player] call BIS_fnc_invSlotsEmpty;
  298. _needed = [_config] call BIS_fnc_invSlotType;
  299. _diff = [_empty,_needed] call BIS_fnc_vectorDiff;
  300.  
  301. _success = true;
  302. {
  303. if (_x > 0) then {_success = false};
  304. } count _diff;
  305. hint format["Config: %5\nEmpty: %1\nNeeded: %2\nDiff: %3\nSuccess: %4",_empty,_needed,_diff,_success,_config];
  306. _success
  307. };
  308.  
  309. vehicle_gear_count = {
  310. private["_counter"];
  311. _counter = 0;
  312. {
  313. _counter = _counter + _x;
  314. } count _this;
  315. _counter
  316. };
  317.  
  318. player_tagFriendlyMsg = {
  319. if(player == (_this select 0)) then {
  320. cutText[(localize "str_epoch_player_2"),"PLAIN DOWN"];
  321. };
  322. };
  323.  
  324. player_serverModelChange = {
  325. private["_object","_model"];
  326. _object = _this select 0;
  327. _model = _this select 1;
  328. if (_object == player) then {
  329. _model call player_switchModel;
  330. };
  331. };
  332.  
  333. player_guiControlFlash = {
  334. private["_control"];
  335. _control = _this;
  336. if (ctrlShown _control) then {
  337. _control ctrlShow false;
  338. } else {
  339. _control ctrlShow true;
  340. };
  341. };
  342.  
  343. gearDialog_create = {
  344. private ["_i","_dialog"];
  345. if (!isNull (findDisplay 106)) then {
  346. (findDisplay 106) closeDisplay 0;
  347. };
  348. openMap false;
  349. closeDialog 0;
  350. if (gear_done) then {sleep 0.001;};
  351. player action ["Gear", player];
  352. if (gear_done) then {sleep 0.001;};
  353. _dialog = findDisplay 106;
  354. _i = 0;
  355. while {isNull _dialog} do {//DO NOT CHANGE TO A FOR LOOP!
  356. _i = _i + 1;
  357. _dialog = findDisplay 106;
  358. if (gear_done) then {sleep 0.001;};
  359. if (_i in [100,200,299]) then {
  360. closeDialog 0;
  361. player action ["Gear", player];
  362. };
  363. if (_i > 300) exitWith {};
  364. };
  365. if (gear_done) then {sleep 0.001;};
  366. _dialog = findDisplay 106;
  367. if ((parseNumber(_this select 0)) != 0) then {
  368. ctrlActivate (_dialog displayCtrl 157);
  369. if (gear_done) then {
  370. waitUntil {ctrlShown (_dialog displayCtrl 159)};
  371. sleep 0.001;
  372. };
  373. };
  374. _dialog
  375. };
  376.  
  377. gear_ui_offMenu = {
  378. private["_control","_parent","_menu"];
  379. disableSerialization;
  380. _control = _this select 0;
  381. _parent = findDisplay 106;
  382. if (!(_this select 3)) then {
  383. for "_i" from 0 to 9 do {
  384. _menu = _parent displayCtrl (1600 + _i);
  385. _menu ctrlShow false;
  386. };
  387. _grpPos = ctrlPosition _control;
  388. _grpPos set [3,0];
  389. _control ctrlSetPosition _grpPos;
  390. _control ctrlShow false;
  391. _control ctrlCommit 0;
  392. };
  393. };
  394.  
  395. dze_surrender_off = {
  396. player setVariable ["DZE_Surrendered", false, true];
  397. DZE_Surrender = false;
  398. };
  399.  
  400. gear_ui_init = {
  401. private["_control","_parent","_menu","_dspl","_grpPos"];
  402. disableSerialization;
  403. _parent = findDisplay 106;
  404. _control = _parent displayCtrl 6902;
  405. for "_i" from 0 to 9 do {
  406. _menu = _parent displayCtrl (1600 + _i);
  407. _menu ctrlShow false;
  408. };
  409. _grpPos = ctrlPosition _control;
  410. _grpPos set [3,0];
  411. _control ctrlSetPosition _grpPos;
  412. _control ctrlShow false;
  413. _control ctrlCommit 0;
  414. };
  415.  
  416. dayz_eyeDir = {
  417. private["_vval","_vdir"];
  418. _vval = (eyeDirection _this);
  419. _vdir = (_vval select 0) atan2 (_vval select 1);
  420. if (_vdir < 0) then {_vdir = 360 + _vdir};
  421. _vdir
  422. };
  423.  
  424. DZE_getModelName = {
  425. _objInfo = toArray(str(_this));
  426. _lenInfo = count _objInfo - 1;
  427. _objName = [];
  428. _i = 0;
  429. // determine where the object name starts
  430. {
  431. if (58 == _objInfo select _i) exitWith {};
  432. _i = _i + 1;
  433. } count _objInfo;
  434. _i = _i + 2; // skip the ": " part
  435. for "_k" from _i to _lenInfo do {
  436. _objName set [(count _objName), (_objInfo select _k)];
  437. };
  438. _objName = toLower(toString(_objName));
  439. _objName
  440. };
  441.  
  442. dze_isnearest_player = {
  443. private ["_notClosest","_playerDistance","_nearPlayers","_obj","_playerNear"];
  444. if(!isNull _this) then {
  445. _nearPlayers = _this nearEntities ["CAManBase", 12];
  446. _playerNear = ({isPlayer _x} count _nearPlayers) > 1;
  447. _notClosest = false;
  448. if (_playerNear) then {
  449. // check if another player is closer
  450. _playerDistance = player distance _this;
  451. {
  452. if (_playerDistance > (_x distance _this)) exitWith { _notClosest = true; };
  453. } count _nearPlayers;
  454. };
  455. } else {
  456. _notClosest = false;
  457. };
  458. _notClosest
  459. };
  460.  
  461. // trader menu code
  462. if (DZE_ConfigTrader) then {
  463. call compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_traderMenuConfig.sqf";
  464. }else{
  465. call compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_traderMenuHive.sqf";
  466. };
  467. // recent murders menu code
  468. call compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_murderMenu.sqf";
  469.  
  470. //This is still needed but the fsm should terminate if any errors pop up.
  471. [] spawn {
  472. private["_timeOut","_display","_control1","_control2"];
  473. disableSerialization;
  474. _timeOut = 0;
  475. dayz_loadScreenMsg = "";
  476. diag_log "DEBUG: loadscreen guard started.";
  477. _display = uiNameSpace getVariable "BIS_loadingScreen";
  478. if (!isNil "_display") then {
  479. _control1 = _display displayctrl 8400;
  480. _control2 = _display displayctrl 102;
  481. };
  482. if (!isNil "dayz_DisplayGenderSelect") then {
  483. waitUntil {!dayz_DisplayGenderSelect};
  484. };
  485.  
  486. // 120 sec timeout (12000 * 0.01)
  487. while { _timeOut < 12000 } do {
  488. if (dayz_clientPreload && dayz_authed) exitWith {
  489. endLoadingScreen;
  490. diag_log "PLOGIN: Login loop completed!";
  491. };
  492. if (!isNil "_display") then {
  493. if ( isNull _display ) then {
  494. waitUntil { !dialog; };
  495. startLoadingScreen ["","RscDisplayLoadCustom"];
  496. _display = uiNameSpace getVariable "BIS_loadingScreen";
  497. _control1 = _display displayctrl 8400;
  498. _control2 = _display displayctrl 102;
  499. };
  500.  
  501. if ( dayz_loadScreenMsg != "" ) then {
  502. _control1 ctrlSetText dayz_loadScreenMsg;
  503. dayz_loadScreenMsg = "";
  504. };
  505.  
  506. _control2 ctrlSetText format["%1",round(_timeOut*0.01)];
  507. };
  508.  
  509. _timeOut = _timeOut + 1;
  510.  
  511. if (_timeOut >= 12000) then {
  512. 1 cutText [localize "str_player_login_timeout", "PLAIN DOWN"];
  513. sleep 10;
  514. endLoadingScreen;
  515. endMission "END1";
  516. };
  517.  
  518. sleep 0.01;
  519. };
  520. };
  521.  
  522. dayz_meleeMagazineCheck = {
  523. private["_meleeNum","_magType"];
  524. _magType = ([] + getArray (configFile >> "CfgWeapons" >> _wpnType >> "magazines")) select 0;
  525. _meleeNum = ({_x == _magType} count magazines player);
  526. if (_meleeNum < 1) then {
  527. player addMagazine _magType;
  528. };
  529. };
  530.  
  531. dayz_originalPlayer = player;
  532.  
  533. progressLoadingScreen 0.8;
  534. };
  535.  
  536. //Both
  537. BIS_fnc_selectRandom = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BIS_fnc\fn_selectRandom.sqf";
  538. BIS_fnc_vectorAdd = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BIS_fnc\fn_vectorAdd.sqf";
  539. BIS_fnc_halo = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BIS_fnc\fn_halo.sqf";
  540. BIS_fnc_findNestedElement = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BIS_fnc\fn_findNestedElement.sqf";
  541. BIS_fnc_param = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BIS_fnc\fn_param.sqf";
  542.  
  543. fnc_buildWeightedArray = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_buildWeightedArray.sqf"; //Checks which actions for nearby casualty
  544. fnc_usec_damageVehicle = compile preprocessFileLineNumbers "zupa\fn_damageHandlerVehicle.sqf"; //Event handler run on damage
  545.  
  546. // object_vehicleKilled = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_vehicleKilled.sqf"; //Event handler run on damage
  547. object_setHitServer = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_setHitServer.sqf"; //process the hit as a NORMAL damage (useful for persistent vehicles)
  548. object_setFixServer = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_setFixServer.sqf"; //process the hit as a NORMAL damage (useful for persistent vehicles)
  549. 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
  550. object_setHit = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_setHit.sqf"; //process the hit as a NORMAL damage (useful for persistent vehicles)
  551. object_processHit = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_processHit.sqf"; //process the hit in the REVO damage system (records && sets hit)
  552. object_delLocal = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_delLocal.sqf";
  553. // object_cargoCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_cargoCheck.sqf"; //Run by the player || server to monitor changes in cargo contents
  554. fnc_usec_damageHandler = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandler.sqf"; //Event handler run on damage
  555. fnc_veh_ResetEH = compile preprocessFileLineNumbers "\z\addons\dayz_code\init\veh_ResetEH.sqf"; //Initialize vehicle
  556. // Vehicle damage fix
  557. vehicle_handleDamage = compile preprocessFileLineNumbers "zupa\vehicle_handleDamage.sqf";
  558. vehicle_handleKilled = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_handleKilled.sqf";
  559. //fnc_vehicleEventHandler = compile preprocessFileLineNumbers "\z\addons\dayz_code\init\vehicle_init.sqf"; //Initialize vehicle
  560. fnc_inString = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_inString.sqf";
  561. fnc_isInsideBuilding = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_isInsideBuilding.sqf"; //_isInside = [_unit,_building] call fnc_isInsideBuilding;
  562. fnc_isInsideBuilding2 = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_isInsideBuilding2.sqf"; //_isInside = [_unit,_building] call fnc_isInsideBuilding2;
  563. fnc_isInsideBuilding3 = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_isInsideBuilding3.sqf"; //_isInside = [_unit,_building] call fnc_isInsideBuilding3;
  564. dayz_zombieSpeak = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_speak.sqf"; //Used to generate random speech for a unit
  565. vehicle_getHitpoints = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_getHitpoints.sqf";
  566. local_gutObject = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_gutObject.sqf"; //Generated on the server (|| local to unit) when gutting an object
  567. local_lockUnlock = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_lockUnlock.sqf"; //When vehicle is local to unit perform locking vehicle
  568. local_gutObjectZ = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_gutObjectZ.sqf"; //Generated on the server (|| local to unit) when gutting an object
  569. local_zombieDamage = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandlerZ.sqf"; //Generated by the client who created a zombie to track damage
  570. local_eventKill = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_eventKill.sqf"; //Generated when something is killed
  571. //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
  572. curTimeStr = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_curTimeStr.sqf";
  573. player_medBandage = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medBandaged.sqf";
  574. player_medInject = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medInject.sqf";
  575. player_medEpi = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medEpi.sqf";
  576. player_medTransfuse = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medTransfuse.sqf";
  577. player_medMorphine = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medMorphine.sqf";
  578. player_breaklegs = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medBreakLegs.sqf";
  579. player_medPainkiller = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medPainkiller.sqf";
  580. world_isDay = {if ((daytime < (24 - dayz_sunRise)) && (daytime > dayz_sunRise)) then {true} else {false}};
  581. player_humanityChange = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_humanityChange.sqf";
  582. spawn_loot = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\spawn_loot.sqf";
  583. spawn_loot_small = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\spawn_loot_small.sqf";
  584. // player_projectileNear = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_projectileNear.sqf";
  585. FNC_GetSetPos = { //DO NOT USE IF YOU NEED ANGLE COMPENSATION!!!!
  586. private "_pos";
  587. _thingy = _this select 0;
  588. _pos = getPosASL _thingy;
  589. if (surfaceIsWater _pos) then {
  590. _thingy setPosASL _pos;
  591. } else {
  592. _thingy setPosATL (ASLToATL _pos);
  593. };
  594. };
  595. FNC_GetPos = {
  596. private "_pos";
  597. if (isNil {_this select 0}) exitWith {[0,0,0]};
  598. _thingy = _this select 0;
  599. _pos = getPosASL _thingy;
  600. if !(surfaceIsWater _pos) then {
  601. _pos = ASLToATL _pos;
  602. };
  603. _pos
  604. };
  605. local_setFuel = {
  606. private["_qty","_vehicle"];
  607. _vehicle = _this select 0;
  608. _qty = _this select 1;
  609. _vehicle setFuel _qty;
  610. };
  611. zombie_initialize = {
  612. private ["_unit","_position"];
  613. _unit = _this select 0;
  614. if (isServer) then {
  615. _unit addEventHandler ["local", {_this call zombie_findOwner}];
  616. };
  617. _id = _unit addeventhandler["HandleDamage", { _this call local_zombieDamage }];
  618. _id = _unit addeventhandler["Killed", { [_this, "zombieKills"] call local_eventKill }];
  619. };
  620.  
  621. dayz_EjectPlayer = {
  622. // check if player in vehicle
  623. private ["_noDriver","_vehicle","_inVehicle"];
  624. _vehicle = vehicle player;
  625. _inVehicle = (_vehicle != player);
  626. if(_inVehicle) then {
  627. _noDriver = ((_vehicle emptyPositions "driver") > 0);
  628. if (_noDriver && (speed _vehicle) != 0) then {
  629. player action [ "eject", _vehicle];
  630. };
  631. };
  632. };
  633.  
  634. player_sumMedical = {
  635. private["_character","_wounds","_legs","_arms","_medical"];
  636. _character = _this;
  637. _wounds = [];
  638. if (_character getVariable["USEC_injured",false]) then {
  639. {
  640. if (_character getVariable[_x,false]) then {
  641. _wounds set [count _wounds,_x];
  642. };
  643. } count USEC_typeOfWounds;
  644. };
  645. _legs = _character getVariable ["hit_legs",0];
  646. _arms = _character getVariable ["hit_arms",0];
  647. _medical = [
  648. _character getVariable["USEC_isDead",false],
  649. _character getVariable["NORRN_unconscious", false],
  650. _character getVariable["USEC_infected",false],
  651. _character getVariable["USEC_injured",false],
  652. _character getVariable["USEC_inPain",false],
  653. _character getVariable["USEC_isCardiac",false],
  654. _character getVariable["USEC_lowBlood",false],
  655. _character getVariable["USEC_BloodQty",12000],
  656. _wounds,
  657. [_legs,_arms],
  658. _character getVariable["unconsciousTime",0],
  659. _character getVariable["messing",[0,0]]
  660. ];
  661. _medical
  662. };
  663.  
  664. //Server Only
  665. if (isServer) then {
  666. call compile preprocessFileLineNumbers "\z\addons\dayz_server\init\server_functions.sqf";
  667. } else {
  668. eh_localCleanup = {};
  669. };
  670.  
  671. call compile preprocessFileLineNumbers "gold\player_traderMenu.sqf";
  672. //INSTALL SNAP BUILDING PRO 1.4.1
  673. if (!isDedicated) then {
  674. player_build = compile preprocessFileLineNumbers "custom\snap_pro\player_build.sqf";
  675. snap_build = compile preprocessFileLineNumbers "custom\snap_pro\snap_build.sqf";
  676. dayz_spaceInterrupt = compile preprocessFileLineNumbers "custom\snap_pro\dayz_spaceInterrupt.sqf";
  677. };
  678.  
  679. /*Plot*/
  680. PlotGetFriends = compile preprocessFileLineNumbers "plotManagement\plotGetFriends.sqf";
  681. PlotNearbyHumans = compile preprocessFileLineNumbers "plotManagement\plotNearbyHumans.sqf";
  682. PlotAddFriend = compile preprocessFileLineNumbers "plotManagement\plotAddFriend.sqf";
  683. PlotRemoveFriend = compile preprocessFileLineNumbers "plotManagement\plotRemoveFriend.sqf";
  684. /*Plot End*/
  685.  
  686. initialized = true;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement