Guest User

Compiles.sqf

a guest
Nov 29th, 2013
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 36.94 KB | None | 0 0
  1. /*
  2. FUNCTION COMPILES
  3. */
  4. //Player only
  5. if (!isDedicated) then {
  6. _config = configFile >> "CfgLoot";
  7. _config1 = configFile >> "CfgMagazines" >> "FoodEdible";
  8. _config2 = configFile >> "CfgWeapons" >> "Loot";
  9.  
  10. "filmic" setToneMappingParams [0.07, 0.31, 0.23, 0.37, 0.011, 3.750, 6, 4]; setToneMapping "Filmic";
  11.  
  12. BIS_Effects_Burn = compile preprocessFile "\ca\Data\ParticleEffects\SCRIPTS\destruction\burn.sqf";
  13. 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
  14. player_zombieAttack = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieAttack.sqf"; //Run on a players computer, causes a nearby zombie to attack them
  15. fnc_usec_damageActions = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageActions.sqf"; //Checks which actions for nearby casualty
  16. fnc_inAngleSector = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_inAngleSector.sqf"; //Checks which actions for nearby casualty
  17. fnc_usec_selfActions = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_selfActions.sqf"; //Checks which actions for self
  18. fnc_usec_unconscious = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_unconscious.sqf";
  19. player_temp_calculation = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_temperatur.sqf"; //Temperatur System //TeeChange
  20. player_weaponFiredNear = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_weaponFiredNear.sqf";
  21. player_animalCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_animalCheck.sqf";
  22. player_spawnCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_spawnCheck.sqf";
  23. player_dumpBackpack = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_dumpBackpack.sqf";
  24. // player_spawnLootCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_spawnlootCheck.sqf";
  25. // player_spawnZedCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_spawnzedCheck.sqf";
  26. building_spawnLoot = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\building_spawnLoot.sqf";
  27. // player_taskHint = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_taskHint.sqf";
  28. building_spawnZombies = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\building_spawnZombies.sqf";
  29. //animal_monitor = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\animal_monitor.sqf";
  30. // building_monitor = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\building_monitor.sqf";
  31. player_fired = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_fired.sqf"; //Runs when player fires. Alerts nearby Zeds depending on calibre and audial rating
  32. player_packTent = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_packTent.sqf";
  33. player_packVault = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_packVault.sqf";
  34. player_unlockVault = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_unlockVault.sqf";
  35.  
  36. player_unlockDoor = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_unlockDoor.sqf";
  37. player_changeCombo = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_changeCombo.sqf";
  38.  
  39. player_lockVault = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_lockVault.sqf";
  40. // control_zombieAgent = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\control_zombieAgent.sqf";
  41. player_updateGui = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_updateGui.sqf";
  42. player_crossbowBolt = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_crossbowBolt.sqf";
  43. spawn_flies = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\spawn_flies.sqf";
  44. // stream_locationFill = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\stream_locationFill.sqf";
  45. // stream_locationDel = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\stream_locationDel.sqf";
  46. // stream_locationCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\stream_locationCheck.sqf";
  47. player_music = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_music.sqf"; //Used to generate ambient music
  48. player_login = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_login.sqf"; //Used to generate ambient music
  49. player_death = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_death.sqf";
  50. player_switchModel = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_switchModel.sqf";
  51. player_checkStealth = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_checkStealth.sqf";
  52. world_sunRise = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_sunRise.sqf";
  53. world_surfaceNoise = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_surfaceNoise.sqf";
  54. player_humanityMorph = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_humanityMorph.sqf";
  55. player_throwObject = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_throwObject.sqf";
  56. player_alertZombies = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_alertZombies.sqf";
  57. player_fireMonitor = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\fire_monitor.sqf";
  58. fn_gearMenuChecks = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_gearMenuChecks.sqf";
  59.  
  60. //Objects
  61. object_roadFlare = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_roadFlare.sqf";
  62. object_setpitchbank = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_setpitchbank.sqf";
  63. object_monitorGear = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_monitorGear.sqf";
  64.  
  65. //Zombies
  66. zombie_findTargetAgent = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\zombie_findTargetAgent.sqf";
  67. zombie_loiter = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\zombie_loiter.sqf"; //Server compile, used for loiter behaviour
  68. zombie_generate = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\zombie_generate.sqf"; //Server compile, used for loiter behaviour
  69. wild_spawnZombies = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\wild_spawnZombies.sqf"; //Server compile, used for loiter behaviour
  70.  
  71. pz_attack = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\pzombie\pz_attack.sqf";
  72.  
  73.  
  74. //
  75. dog_findTargetAgent = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\dog_findTargetAgent.sqf";
  76.  
  77. // Vehicle damage fix
  78. vehicle_handleDamage = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_handleDamage.sqf";
  79. vehicle_handleKilled = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_handleKilled.sqf";
  80.  
  81. //actions
  82. player_countmagazines = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_countmagazines.sqf";
  83. player_addToolbelt = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_addToolbelt.sqf";
  84. player_copyKey = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_copyKey.sqf";
  85. player_reloadMag = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_reloadMags.sqf";
  86. player_loadCrate = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_loadCrate.sqf";
  87. player_craftItem = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_craftItem.sqf";
  88. player_tentPitch = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\tent_pitch.sqf";
  89. player_vaultPitch = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\vault_pitch.sqf";
  90. player_drink = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_drink.sqf";
  91. player_eat = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_eat.sqf";
  92. player_useMeds = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_useMeds.sqf";
  93. player_fillWater = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\water_fill.sqf";
  94. player_makeFire = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_makefire.sqf";
  95. player_chopWood = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_chopWood.sqf";
  96. player_harvestPlant = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_harvestPlant.sqf";
  97. player_goFishing = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_goFishing.sqf";
  98. player_build = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_build.sqf";
  99. player_wearClothes = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_wearClothes.sqf";
  100. player_dropWeapon = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_dropWeapon.sqf";
  101. player_setTrap = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_setTrap.sqf";
  102. object_pickup = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\object_pickup.sqf";
  103. player_flipvehicle = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_flipvehicle.sqf";
  104. player_sleep = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_sleep.sqf";
  105. player_mineOre = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_mineOre.sqf";
  106.  
  107. //ui
  108. player_selectSlot = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\ui_selectSlot.sqf";
  109. player_gearSync = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_gearSync.sqf";
  110. player_gearSet = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_gearSet.sqf";
  111. ui_changeDisplay = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\ui_changeDisplay.sqf";
  112. ui_gear_sound = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\ui_gear_sound.sqf";
  113.  
  114. //System
  115. player_monitor = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\player_monitor.sqf";
  116. player_spawn_1 = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\player_spawn_1.sqf";
  117. player_spawn_2 = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\player_spawn_2.sqf";
  118. onPreloadStarted "dayz_preloadFinished = false;";
  119. onPreloadFinished "dayz_preloadFinished = true;";
  120.  
  121. // TODO: need move it in player_monitor.fsm
  122. // allow player disconnect from server, if loading hang, kicked by BE etc.
  123. [] spawn {
  124. private["_timeOut","_display","_control1","_control2"];
  125. disableSerialization;
  126. _timeOut = 0;
  127. dayz_loadScreenMsg = "";
  128. diag_log "DEBUG: loadscreen guard started.";
  129. _display = uiNameSpace getVariable "BIS_loadingScreen";
  130. _control1 = _display displayctrl 8400;
  131. _control2 = _display displayctrl 102;
  132. // 120 sec timeout
  133. while { _timeOut < 3000 && !dayz_clientPreload && !dayz_authed } do {
  134.  
  135. if ( isNull _display ) then {
  136. waitUntil { !dialog; };
  137. startLoadingScreen ["","RscDisplayLoadCustom"];
  138. _display = uiNameSpace getVariable "BIS_loadingScreen";
  139. _control1 = _display displayctrl 8400;
  140. _control2 = _display displayctrl 102;
  141. };
  142.  
  143. if ( dayz_loadScreenMsg != "" ) then {
  144. _control1 ctrlSetText dayz_loadScreenMsg;
  145. dayz_loadScreenMsg = "";
  146. };
  147. _control2 ctrlSetText format["%1",round(_timeOut*0.01)];
  148. _timeOut = _timeOut + 1;
  149. sleep 0.01;
  150. };
  151. endLoadingScreen;
  152. /*
  153. if ( !dayz_clientPreload && !dayz_authed ) then {
  154. diag_log "DEBUG: loadscreen guard ended with timeout.";
  155. disableUserInput false;
  156. 1 cutText ["Disconnected!", "PLAIN"];
  157. player enableSimulation false;
  158. } else { diag_log "DEBUG: loadscreen guard ended."; };
  159. */
  160. };
  161.  
  162. //
  163. RunTime = 0;
  164. TotalRuns = 0;
  165.  
  166. fnc_dump = {
  167. private["_code","_benchmark","_averageRunTime"];
  168. _code = _this select 0;
  169. _benchmark = _this select 1;
  170.  
  171. RunTime = RunTime + _benchmark;
  172. TotalRuns = TotalRuns + 1;
  173. _averageRunTime = RunTime/TotalRuns;
  174.  
  175. diag_log format["%1 - %2 (%3 / %4)",_code,_benchmark,_averageRunTime,TotalRuns];
  176. };
  177. dayz_losChance = {
  178. private["_agent","_maxDis","_dis","_val","_maxExp","_myExp"];
  179. _agent = _this select 0;
  180. _dis = _this select 1;
  181. _maxDis = _this select 2;
  182. // diag_log ("VAL: " + str(_this));
  183. _val = (_maxDis - _dis) max 0;
  184. _maxExp = ((exp 2) * _maxDis);
  185. _myExp = ((exp 2) * (_val)) / _maxExp;
  186. _myExp = _myExp * 0.7;
  187. _myExp
  188. };
  189.  
  190. ui_initDisplay = {
  191. private["_control","_ctrlBleed","_display","_ctrlFracture","_ctrlDogFood","_ctrlDogWater","_ctrlDogWaterBorder", "_ctrlDogFoodBorder"];
  192. disableSerialization;
  193. _display = uiNamespace getVariable 'DAYZ_GUI_display';
  194. _control = _display displayCtrl 1204;
  195. _control ctrlShow false;
  196. if (!r_player_injured) then {
  197. _ctrlBleed = _display displayCtrl 1303;
  198. _ctrlBleed ctrlShow false;
  199. };
  200. if (!r_fracture_legs and !r_fracture_arms) then {
  201. _ctrlFracture = _display displayCtrl 1203;
  202. _ctrlFracture ctrlShow false;
  203. };
  204. _ctrlDogFoodBorder = _display displayCtrl 1501;
  205. _ctrlDogFoodBorder ctrlShow false;
  206. _ctrlDogFood = _display displayCtrl 1701;
  207. _ctrlDogFood ctrlShow false;
  208.  
  209. _ctrlDogWaterBorder = _display displayCtrl 1502;
  210. _ctrlDogWaterBorder ctrlShow false;
  211. _ctrlDogWater = _display displayCtrl 1702;
  212. _ctrlDogWater ctrlShow false
  213. };
  214.  
  215. dayz_losCheck = {
  216. private["_target","_agent","_cantSee"];
  217. _target = _this select 0; // PUT THE PLAYER IN FIRST ARGUMENT!!!!
  218. _agent = _this select 1;
  219. _cantSee = true;
  220. if (!isNull _target) then {
  221. _tPos = aimPos _target;
  222. _zPos = aimPos _agent;
  223. if ((count _tPos > 0) and (count _zPos > 0)) then {
  224. _cantSee = terrainIntersectASL [_tPos, _zPos];
  225. if (!_cantSee) then {
  226. _cantSee = lineIntersects [_tPos, _zPos, _agent, vehicle _target];
  227. };
  228. };
  229. };
  230. _cantSee
  231. };
  232.  
  233. eh_zombieInit = {
  234. private["_unit","_pos"];
  235. //_unit = _this select 0;
  236. //_pos = getPosATL _unit;
  237. //_id = [_pos,_unit] execFSM "\z\AddOns\dayz_code\system\zombie_agent.fsm";
  238. };
  239.  
  240. dayz_equipCheck = {
  241. private ["_empty", "_needed","_diff","_success"];
  242. _config = _this;
  243. _empty = [player] call BIS_fnc_invSlotsEmpty;
  244. _needed = [_config] call BIS_fnc_invSlotType;
  245. _diff = [_empty,_needed] call BIS_fnc_vectorDiff;
  246.  
  247. _success = true;
  248. {
  249. if (_x > 0) then {_success = false};
  250. } forEach _diff;
  251. hint format["Config: %5\nEmpty: %1\nNeeded: %2\nDiff: %3\nSuccess: %4",_empty,_needed,_diff,_success,_config];
  252. _success
  253. };
  254.  
  255. vehicle_gear_count = {
  256. private["_counter"];
  257. _counter = 0;
  258. {
  259. _counter = _counter + _x;
  260. } forEach _this;
  261. _counter
  262. };
  263.  
  264. dayz_spaceInterrupt = {
  265. private ["_dikCode", "_handled"];
  266. _dikCode = _this select 1;
  267.  
  268. _handled = false;
  269.  
  270. if (_dikCode in[0x58,0x57,0x44,0x43,0x42,0x41,0x40,0x3F,0x3E,0x3D,0x3C,0x3B,0x0B,0x0A,0x09,0x08,0x07,0x06,0x05]) then {
  271. _handled = true;
  272. };
  273.  
  274. if (_dikCode in actionKeys "MoveForward") exitWith {r_interrupt = true};
  275. if (_dikCode in actionKeys "MoveLeft") exitWith {r_interrupt = true};
  276. if (_dikCode in actionKeys "MoveRight") exitWith {r_interrupt = true};
  277. if (_dikCode in actionKeys "MoveBack") exitWith {r_interrupt = true};
  278.  
  279. //Prevent exploit of drag body
  280. if ((_dikCode in actionKeys "Prone") and r_drag_sqf) exitWith { force_dropBody = true; };
  281. if ((_dikCode in actionKeys "Crouch") and r_drag_sqf) exitWith { force_dropBody = true; };
  282.  
  283. _shift = _this select 2;
  284. _ctrl = _this select 3;
  285. _alt = _this select 4;
  286.  
  287. //diag_log format["Keypress: %1", _this];
  288.  
  289.  
  290. if (_dikCode in (actionKeys "GetOver")) then {
  291.  
  292. if (player isKindOf "PZombie_VB") then {
  293. _handled = true;
  294. DZE_PZATTACK = true;
  295. } else {
  296. _nearbyObjects = nearestObjects[getPosATL player, dayz_disallowedVault, 8];
  297. if (count _nearbyObjects > 0) then {
  298. if((diag_tickTime - dayz_lastCheckBit > 4)) then {
  299. [objNull, player, rSwitchMove,"GetOver"] call RE;
  300. player playActionNow "GetOver";
  301. dayz_lastCheckBit = diag_tickTime;
  302. } else {
  303. _handled = true;
  304. };
  305. };
  306. };
  307. };
  308. //if (_dikCode == 57) then {_handled = true}; // space
  309. //if (_dikCode in actionKeys 'MoveForward' or _dikCode in actionKeys 'MoveBack') then {r_interrupt = true};
  310. if (_dikCode == 210) then {
  311. _nill = execvm "\z\addons\dayz_code\actions\playerstats.sqf";
  312. };
  313.  
  314. if (_dikCode in actionKeys "ForceCommandingMode") then {_handled = true};
  315. if (_dikCode in actionKeys "PushToTalk" and (diag_tickdiag_tickTime - dayz_lastCheckBit > 10)) then {
  316. dayz_lastCheckBit = diag_tickTime;
  317. [player,50,true,(getPosATL player)] spawn player_alertZombies;
  318. };
  319. if (_dikCode in actionKeys "VoiceOverNet" and (diag_tickTime - dayz_lastCheckBit > 10)) then {
  320. dayz_lastCheckBit = diag_tickTime;
  321. [player,50,true,(getPosATL player)] spawn player_alertZombies;
  322. };
  323. if (_dikCode in actionKeys "PushToTalkDirect" and (diag_tickTime - dayz_lastCheckBit > 10)) then {
  324. dayz_lastCheckBit = diag_tickTime;
  325. [player,15,false,(getPosATL player)] spawn player_alertZombies;
  326. };
  327. if (_dikCode in actionKeys "Chat" and (diag_tickTime - dayz_lastCheckBit > 10)) then {
  328. dayz_lastCheckBit = diag_tickTime;
  329. [player,15,false,(getPosATL player)] spawn player_alertZombies;
  330. };
  331. if (_dikCode in actionKeys "User20" and (diag_tickTime - dayz_lastCheckBit > 5)) then {
  332. dayz_lastCheckBit = diag_tickTime;
  333. _nill = execvm "\z\addons\dayz_code\actions\playerstats.sqf";
  334. };
  335.  
  336. // numpad 8 0x48 now pgup 0xC9 1
  337. if ((_dikCode == 0xC9 and (!_alt or !_ctrl)) or (_dikCode in actionKeys "User15")) then {
  338. DZE_Q = true;
  339. };
  340. // numpad 2 0x50 now pgdn 0xD1
  341. if ((_dikCode == 0xD1 and (!_alt or !_ctrl)) or (_dikCode in actionKeys "User16")) then {
  342. DZE_Z = true;
  343. };
  344.  
  345.  
  346. // numpad 8 0x48 now pgup 0xC9 0.1
  347. if ((_dikCode == 0xC9 and (_alt and !_ctrl)) or (_dikCode in actionKeys "User13")) then {
  348. DZE_Q_alt = true;
  349. };
  350. // numpad 2 0x50 now pgdn 0xD1
  351. if ((_dikCode == 0xD1 and (_alt and !_ctrl)) or (_dikCode in actionKeys "User14")) then {
  352. DZE_Z_alt = true;
  353. };
  354.  
  355.  
  356. // numpad 8 0x48 now pgup 0xC9 0.01
  357. if ((_dikCode == 0xC9 and (!_alt and _ctrl)) or (_dikCode in actionKeys "User7")) then {
  358. DZE_Q_ctrl = true;
  359. };
  360. // numpad 2 0x50 now pgdn 0xD1
  361. if ((_dikCode == 0xD1 and (!_alt and _ctrl)) or (_dikCode in actionKeys "User8")) then {
  362. DZE_Z_ctrl = true;
  363. };
  364.  
  365.  
  366.  
  367.  
  368. // numpad 4 0x4B now Q 0x10
  369. if (_dikCode == 0x10 or (_dikCode in actionKeys "User17")) then {
  370. DZE_4 = true;
  371. };
  372. // numpad 6 0x4D now E 0x12
  373. if (_dikCode == 0x12 or (_dikCode in actionKeys "User18")) then {
  374. DZE_6 = true;
  375. };
  376. // numpad 5 0x4C now space 0x39
  377. if (_dikCode == 0x39 or (_dikCode in actionKeys "User19")) then {
  378. DZE_5 = true;
  379. };
  380.  
  381. // esc
  382. if (_dikCode == 0x01) then {
  383. DZE_cancelBuilding = true;
  384. };
  385.  
  386. if ((_dikCode == 0x3E or _dikCode == 0x0F or _dikCode == 0xD3) and (diag_tickTime - dayz_lastCheckBit > 10)) then {
  387. dayz_lastCheckBit = diag_tickTime;
  388. call dayz_forceSave;
  389. };
  390. /*
  391. if (_dikCode in actionKeys "IngamePause") then {
  392. _idOnPause = [] spawn dayz_onPause;
  393. };
  394. */
  395. _handled
  396. };
  397.  
  398. player_serverModelChange = {
  399. private["_object","_model"];
  400. _object = _this select 0;
  401. _model = _this select 1;
  402. if (_object == player) then {
  403. _model call player_switchModel;
  404. };
  405. };
  406.  
  407. player_guiControlFlash = {
  408. private["_control"];
  409. _control = _this;
  410. if (ctrlShown _control) then {
  411. _control ctrlShow false;
  412. } else {
  413. _control ctrlShow true;
  414. };
  415. };
  416.  
  417. gear_ui_offMenu = {
  418. private["_control","_parent","_menu"];
  419. disableSerialization;
  420. _control = _this select 0;
  421. _parent = findDisplay 106;
  422. if (!(_this select 3)) then {
  423. for "_i" from 0 to 9 do {
  424. _menu = _parent displayCtrl (1600 + _i);
  425. _menu ctrlShow false;
  426. };
  427. _grpPos = ctrlPosition _control;
  428. _grpPos set [3,0];
  429. _control ctrlSetPosition _grpPos;
  430. _control ctrlShow false;
  431. _control ctrlCommit 0;
  432. };
  433. };
  434.  
  435.  
  436. gear_ui_init = {
  437. private["_control","_parent","_menu","_dspl","_grpPos"];
  438. disableSerialization;
  439. _parent = findDisplay 106;
  440. _control = _parent displayCtrl 6902;
  441. for "_i" from 0 to 9 do {
  442. _menu = _parent displayCtrl (1600 + _i);
  443. _menu ctrlShow false;
  444. };
  445. _grpPos = ctrlPosition _control;
  446. _grpPos set [3,0];
  447. _control ctrlSetPosition _grpPos;
  448. _control ctrlShow false;
  449. _control ctrlCommit 0;
  450. };
  451.  
  452. dayz_eyeDir = {
  453. private["_vval","_vdir"];
  454. _vval = (eyeDirection _this);
  455. _vdir = (_vval select 0) atan2 (_vval select 1);
  456. if (_vdir < 0) then {_vdir = 360 + _vdir};
  457. _vdir
  458. };
  459.  
  460. DZE_getModelName = {
  461. _objInfo = toArray(str(_this));
  462. _lenInfo = count _objInfo - 1;
  463. _objName = [];
  464. _i = 0;
  465. // determine where the object name starts
  466. {
  467. if (58 == _objInfo select _i) exitWith {};
  468. _i = _i + 1;
  469. } forEach _objInfo;
  470. _i = _i + 2; // skip the ": " part
  471. for "_k" from _i to _lenInfo do {
  472. _objName = _objName + [_objInfo select _k];
  473. };
  474. _objName = toLower(toString(_objName));
  475. _objName
  476. };
  477.  
  478. dayz_originalPlayer = player;
  479.  
  480.  
  481. // trader menu gui by maca134
  482. TraderDialogCatList = 12000;
  483. TraderDialogItemList = 12001;
  484. TraderDialogBuyPrice = 12002;
  485. TraderDialogSellPrice = 12003;
  486.  
  487. TraderCurrentCatIndex = -1;
  488. TraderCatList = -1;
  489. TraderItemList = -1;
  490.  
  491. TraderDialogLoadItemList = {
  492. private ["_index", "_trader_id", "_activatingPlayer"];
  493. TraderItemList = -1;
  494. _index = _this select 0;
  495.  
  496. if (_index < 0 or TraderCurrentCatIndex == _index) exitWith {};
  497. TraderCurrentCatIndex = _index;
  498.  
  499. _trader_id = TraderCatList select _index;
  500. _activatingPlayer = player;
  501.  
  502. lbClear TraderDialogItemList;
  503. ctrlSetText [TraderDialogBuyPrice, ""];
  504. ctrlSetText [TraderDialogSellPrice, ""];
  505.  
  506. lbAdd [TraderDialogItemList, "Loading items..."];
  507.  
  508. PVDZE_plr_TradeMenuResult = call compile format["tcacheBuy_%1;",_trader_id];
  509.  
  510. if(isNil "PVDZE_plr_TradeMenuResult") then {
  511. PVDZE_plr_TradeMenu = [_activatingPlayer,_trader_id];
  512. publicVariableServer "PVDZE_plr_TradeMenu";
  513. waitUntil {!isNil "PVDZE_plr_TradeMenuResult"};
  514. };
  515.  
  516. lbClear TraderDialogItemList;
  517. _item_list = [];
  518. {
  519. private ["_header", "_item", "_name", "_type", "_textPart", "_qty", "_buy", "_bqty", "_bname", "_btype", "_btextCurrency", "_sell", "_sqty", "_sname", "_stype", "_stextCurrency", "_order", "_order", "_afile", "_File", "_count", "_bag", "_bagclass", "_index", "_image"];
  520. _header = _x select 0; // "TRD"
  521. _item = _x select 1;
  522. _name = _item select 0;
  523. _type = _item select 1;
  524. switch (true) do {
  525. case (_type == 1): {
  526. _type = "CfgMagazines";
  527. };
  528. case (_type == 2): {
  529. _type = "CfgVehicles";
  530. };
  531. case (_type == 3): {
  532. _type = "CfgWeapons";
  533. };
  534. };
  535. // Display Name of item
  536. _textPart = getText(configFile >> _type >> _name >> "displayName");
  537.  
  538. // Total in stock
  539. _qty = _x select 2;
  540.  
  541. // Buy Data from array
  542. _buy = _x select 3;
  543. _bqty = _buy select 0;
  544. _bname = _buy select 1;
  545. _btype = _buy select 2;
  546. switch(true)do{
  547. case (_btype == 1): {
  548. _btype = "CfgMagazines";
  549. };
  550. case (_btype == 2): {
  551. _btype = "CfgVehicles";
  552. };
  553. case (_btype == 3): {
  554. _btype = "CfgWeapons";
  555. };
  556. };
  557.  
  558. // Display Name of buy item
  559. _btextCurrency = getText(configFile >> _btype >> _bname >> "displayName");
  560.  
  561. _sell = _x select 4;
  562. _sqty = _sell select 0;
  563. _sname = _sell select 1;
  564. _stype = _sell select 2;
  565. switch(true)do{
  566. case (_stype == 1): {
  567. _stype = "CfgMagazines";
  568. };
  569. case (_stype == 2): {
  570. _stype = "CfgVehicles";
  571. };
  572. case (_stype == 3): {
  573. _stype = "CfgWeapons";
  574. };
  575. };
  576. // Display Name of sell item
  577. _stextCurrency = getText(configFile >> _stype >> _sname >> "displayName");
  578.  
  579. // Menu sort order
  580. _order = _x select 5;
  581.  
  582. // Action file to use for trade
  583. _afile = _x select 7;
  584. _File = "\z\addons\dayz_code\actions\" + _afile + ".sqf";
  585.  
  586. _count = 0;
  587. if(_type == "CfgVehicles") then {
  588. if (_afile == "trade_backpacks") then {
  589. _bag = unitBackpack player;
  590. _bagclass = typeOf _bag;
  591. if(_name == _bagclass) then {
  592. _count = 1;
  593. };
  594. } else {
  595. _count = {(typeOf _x) == _name} count (nearestObjects [player, [_name], 20]);
  596. }
  597. };
  598.  
  599. if(_type == "CfgMagazines") then {
  600. _count = {_x == _name} count magazines player;
  601. };
  602.  
  603. if(_type == "CfgWeapons") then {
  604. _count = {_x == _name} count weapons player;
  605. };
  606.  
  607. _index = lbAdd [TraderDialogItemList, format["%1 (%2)", _textPart, _name]];
  608.  
  609. if (_count > 0) then {
  610. lbSetColor [TraderDialogItemList, _index, [0, 1, 0, 1]];
  611. };
  612.  
  613. _image = getText(configFile >> _type >> _name >> "picture");
  614. lbSetPicture [TraderDialogItemList, _index, _image];
  615.  
  616. _item_list set [count _item_list, [
  617. _name,
  618. _textPart,
  619. _bqty,
  620. _bname,
  621. _btextCurrency,
  622. _sqty,
  623. _sname,
  624. _stextCurrency,
  625. _header,
  626. _File
  627. ]];
  628. } forEach PVDZE_plr_TradeMenuResult;
  629. TraderItemList = _item_list;
  630. };
  631.  
  632. TraderDialogShowPrices = {
  633. private ["_index", "_item"];
  634. _index = _this select 0;
  635. if (_index < 0) exitWith {};
  636. while {count TraderItemList < 1} do { sleep 1; };
  637. _item = TraderItemList select _index;
  638. ctrlSetText [TraderDialogBuyPrice, format["%1 %2", _item select 2, _item select 4]];
  639. ctrlSetText [TraderDialogSellPrice, format["%1 %2", _item select 5, _item select 7]];
  640. };
  641.  
  642. TraderDialogBuy = {
  643. private ["_index", "_item", "_data"];
  644. _index = _this select 0;
  645. if (_index < 0) exitWith {
  646. cutText ["Trading canceled." , "PLAIN DOWN"];
  647. };
  648. _item = TraderItemList select _index;
  649. _data = [_item select 0, _item select 3, 1, _item select 2, "buy", _item select 4, _item select 1, _item select 8];
  650. [0, player, '', _data] execVM (_item select 9);
  651. TraderItemList = -1;
  652. };
  653.  
  654. TraderDialogSell = {
  655. private ["_index", "_item", "_data"];
  656. _index = _this select 0;
  657. if (_index < 0) exitWith {
  658. cutText ["Trading canceled." , "PLAIN DOWN"];
  659. };
  660. _item = TraderItemList select _index;
  661. _data = [_item select 6, _item select 0, _item select 5, 1, "sell", _item select 1, _item select 7, _item select 8];
  662. [0, player, '', _data] execVM (_item select 9);
  663. TraderItemList = -1;
  664. };
  665.  
  666. // murder message boards by maca134
  667. /*
  668. _death_record = [
  669. 0_victimName,
  670. 1_killerName,
  671. 2_weapon,
  672. 3_distance,
  673. 4ServerCurrentTime
  674. ];
  675. */
  676. EpochDeathBoardDialogList = 21000;
  677. EpochDeathBoardDialogSText = 21001;
  678. EpochDeathBoardDeaths = [];
  679.  
  680.  
  681. EpochDeathBoardLoad = {
  682. createdialog "EpochDeathBoardDialog";
  683. /*PVDZE_plr_DeathBResult = [
  684. ["maca134","Bob","AK_107_Kobra",100,[8,30]],
  685. ["Fred","Jonny","FN_FAL",42,[8,32]],
  686. ["maca134","Bob","M9SD",100,[5,30]],
  687. ["Fred","Jonny","BAF_AS50_scoped",42,[8,34]]
  688. ];*/
  689. {
  690. lbAdd [EpochDeathBoardDialogList, (_x select 0)];
  691. } forEach PVDZE_plr_DeathBResult;
  692. };
  693.  
  694.  
  695. EpochDeathBoardClick = {
  696. disableSerialization;
  697. private ["_i", "_record", "_output", "_record_stxt", "_name", "_image", "_h", "_m", "_format"];
  698. _quotes = [
  699. "Death is God's way of telling you not to be such a wise guy.",
  700. "What happens if you get scared half to death, twice?",
  701. "Don't upset me.. I'm running out of places to hide the bodies.",
  702. "Don't run, you'll just die tired.",
  703. "Give me immortality or give me death.",
  704. "I can't live with death; he's always leaving the toilet seat up.",
  705. "Why won't you die?!?!",
  706. "Guns don't kill people; death kills people. It's a proven medical fact."
  707. ];
  708. _i = _this select 0;
  709. if (_i < 0) exitWith {};
  710. _output = _this select 1;
  711. _record = PVDZE_plr_DeathBResult select _i;
  712. _record_stxt = call compile format["epoch_death_board_record_%1;",_i];
  713. if(isNil "_record_stxt") then {
  714. _record_stxt = format["<t size='1.6' align='left'>%1</t><br /><br />", (_record select 0)];
  715.  
  716. _format = {
  717. private ["_codeCount", "_str"];
  718. _str = format["%1", _this];
  719. _codeCount = (count (toArray _str));
  720. if (_codeCount == 1) then {
  721. _str = format["0%1", _str];
  722. };
  723. _str;
  724. };
  725. _h = (_record select 4) select 0;
  726. _m = (_record select 4) select 1;
  727.  
  728. _record_stxt = format["%1<t size='1' align='left'>Died at %2:%3</t><br /><br />", _record_stxt, (_h call _format), (_m call _format)];
  729.  
  730. if ((_record select 1) != 'unknown') then {
  731. _record_stxt = format["%1<t size='1' align='left'>Was killed by %2</t><br /><br />", _record_stxt, (_record select 1)];
  732. };
  733.  
  734. if ((_record select 2) != 'unknown') then {
  735. _name = getText(configFile >> "cfgWeapons" >> (_record select 2) >> "displayName");
  736. _image = getText(configFile >> "cfgWeapons" >> (_record select 2) >> "picture");
  737. _record_stxt = format["%1<t size='1' align='left'>With a %2<br /><img size='3' image='%3' /></t><br /><br />", _record_stxt, _name, _image];
  738. };
  739.  
  740. if (format["%1", (_record select 3)] != 'unknown') then {
  741. _record_stxt = format["%1<t size='1' align='left'>At a distance of %2m</t><br /><br />", _record_stxt, (_record select 3)];
  742. };
  743. _record_stxt = format["%1<t font='Bitstream'>%2</t>", _record_stxt, (_quotes call BIS_fnc_selectRandom)];
  744. call compile format["epoch_death_board_record_%1 = ""%2"";" ,_i , _record_stxt];
  745. };
  746. _output ctrlSetStructuredText parseText _record_stxt;
  747. };
  748.  
  749.  
  750.  
  751. };
  752.  
  753. progressLoadingScreen 0.8;
  754.  
  755. //Both
  756. BIS_fnc_selectRandom = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BIS_fnc\fn_selectRandom.sqf"; //Checks which actions for nearby casualty
  757. BIS_fnc_vectorAdd = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BIS_fnc\fn_vectorAdd.sqf"; //Checks which actions for nearby casualty
  758. fnc_buildWeightedArray = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_buildWeightedArray.sqf"; //Checks which actions for nearby casualty
  759. fnc_usec_damageVehicle = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandlerVehicle.sqf"; //Event handler run on damage
  760. zombie_initialize = compile preprocessFileLineNumbers "\z\addons\dayz_code\init\zombie_init.sqf";
  761. // object_vehicleKilled = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_vehicleKilled.sqf"; //Event handler run on damage
  762. object_setHitServer = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_setHitServer.sqf"; //process the hit as a NORMAL damage (useful for persistent vehicles)
  763. object_setFixServer = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_setFixServer.sqf"; //process the hit as a NORMAL damage (useful for persistent vehicles)
  764. 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
  765. object_setHit = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_setHit.sqf"; //process the hit as a NORMAL damage (useful for persistent vehicles)
  766. object_processHit = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_processHit.sqf"; //process the hit in the REVO damage system (records and sets hit)
  767. object_delLocal = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_delLocal.sqf";
  768. // object_cargoCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_cargoCheck.sqf"; //Run by the player or server to monitor changes in cargo contents
  769. fnc_usec_damageHandler = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandler.sqf"; //Event handler run on damage
  770. fnc_veh_ResetEH = compile preprocessFileLineNumbers "\z\addons\dayz_code\init\veh_ResetEH.sqf"; //Initialize vehicle
  771. // Vehicle damage fix
  772. vehicle_handleDamage = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_handleDamage.sqf";
  773. vehicle_handleKilled = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_handleKilled.sqf";
  774. //fnc_vehicleEventHandler = compile preprocessFileLineNumbers "\z\addons\dayz_code\init\vehicle_init.sqf"; //Initialize vehicle
  775. fnc_inString = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_inString.sqf";
  776. fnc_isInsideBuilding = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_isInsideBuilding.sqf"; //_isInside = [_unit,_building] call fnc_isInsideBuilding;
  777. fnc_isInsideBuilding2 = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_isInsideBuilding2.sqf"; //_isInside = [_unit,_building] call fnc_isInsideBuilding;
  778. fnc_isInsideBuilding3 = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_isInsideBuilding3.sqf"; //_isInside = [_unit,_building] call fnc_isInsideBuilding;
  779. dayz_zombieSpeak = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_speak.sqf"; //Used to generate random speech for a unit
  780. vehicle_getHitpoints = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_getHitpoints.sqf";
  781. local_gutObject = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_gutObject.sqf"; //Generated on the server (or local to unit) when gutting an object
  782. local_lockUnlock = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_lockUnlock.sqf"; //When vehicle is local to unit perform locking vehicle
  783. local_gutObjectZ = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_gutObjectZ.sqf"; //Generated on the server (or local to unit) when gutting an object
  784. local_zombieDamage = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandlerZ.sqf"; //Generated by the client who created a zombie to track damage
  785. local_setFuel = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_setFuel.sqf"; //Generated when someone refuels a vehicle
  786. local_eventKill = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_eventKill.sqf"; //Generated when something is killed
  787. //player_weaponCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_weaponCheck.sqf"; //Run by the player or server to monitor whether they have picked up a new weapon
  788. curTimeStr = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_curTimeStr.sqf";
  789. player_medBandage = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medBandaged.sqf";
  790. player_medInject = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medInject.sqf";
  791. player_medEpi = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medEpi.sqf";
  792. player_medTransfuse = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medTransfuse.sqf";
  793. player_medMorphine = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medMorphine.sqf";
  794. player_breaklegs = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medBreakLegs.sqf";
  795. player_medPainkiller = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medPainkiller.sqf";
  796. world_isDay = {if ((daytime < (24 - dayz_sunRise)) and (daytime > dayz_sunRise)) then {true} else {false}};
  797. player_humanityChange = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_humanityChange.sqf";
  798. spawn_loot = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\spawn_loot.sqf";
  799. spawn_loot_small = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\spawn_loot_small.sqf";
  800. // player_projectileNear = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_projectileNear.sqf";
  801.  
  802. player_sumMedical = {
  803. private["_character","_wounds","_legs","_arms","_medical"];
  804. _character = _this;
  805. _wounds = [];
  806. if (_character getVariable["USEC_injured",false]) then {
  807. {
  808. if (_character getVariable[_x,false]) then {
  809. _wounds set [count _wounds,_x];
  810. };
  811. } forEach USEC_typeOfWounds;
  812. };
  813. _legs = _character getVariable ["hit_legs",0];
  814. _arms = _character getVariable ["hit_arms",0];
  815. _medical = [
  816. _character getVariable["USEC_isDead",false],
  817. _character getVariable["NORRN_unconscious", false],
  818. _character getVariable["USEC_infected",false],
  819. _character getVariable["USEC_injured",false],
  820. _character getVariable["USEC_inPain",false],
  821. _character getVariable["USEC_isCardiac",false],
  822. _character getVariable["USEC_lowBlood",false],
  823. _character getVariable["USEC_BloodQty",12000],
  824. _wounds,
  825. [_legs,_arms],
  826. _character getVariable["unconsciousTime",0],
  827. _character getVariable["messing",[0,0]]
  828. ];
  829. _medical
  830. };
  831.  
  832.  
  833. //Server Only
  834. if (isServer) then {
  835. call compile preprocessFileLineNumbers "\z\addons\dayz_server\init\server_functions.sqf";
  836. } else {
  837. eh_localCleanup = {};
  838. };
  839.  
  840.  
  841. //Start Dynamic Weather
  842. execVM "DynamicWeatherEffects.sqf";
  843. initialized = true;
Advertisement
Add Comment
Please, Sign In to add comment