Guest User

Untitled

a guest
Sep 24th, 2014
477
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 33.88 KB | None | 0 0
  1. //Player only
  2. if (!isDedicated) then {
  3. "filmic" setToneMappingParams [0.07, 0.31, 0.23, 0.37, 0.011, 3.750, 6, 4]; setToneMapping "Filmic";
  4.  
  5. BIS_Effects_Burn = compile preprocessFile "\ca\Data\ParticleEffects\SCRIPTS\destruction\burn.sqf";
  6. spawn_flies = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\spawn_flies.sqf";
  7. 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
  8. player_zombieAttack = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieAttack.sqf"; //Run on a players computer, causes a nearby zombie to attack them
  9. player_attackdelay = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_attackfsmdelay.sqf";
  10. fnc_usec_damageActions = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageActions.sqf"; //Checks which actions for nearby casualty
  11. fnc_inAngleSector = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_inAngleSector.sqf"; //Checks which actions for nearby casualty
  12. fnc_usec_selfActions = compile preprocessFileLineNumbers "compile\fn_selfActions.sqf";
  13. fnc_usec_upgardeActions = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_upgardeActions.sqf";
  14. player_temp_calculation = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_temperatur.sqf"; //Temperatur System //TeeChange
  15. player_weaponFiredNear = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_weaponFiredNear.sqf";
  16. player_animalCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_animalCheck.sqf";
  17. player_spawnCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_spawnCheck.sqf";
  18. //player_spawnLootCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_spawnlootCheck.sqf";
  19. //player_spawnZedCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_spawnzedCheck.sqf";
  20. building_spawnLoot = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\building_spawnLoot.sqf";
  21. //player_taskHint = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_taskHint.sqf";
  22. building_spawnZombies = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\building_spawnZombies.sqf";
  23. //animal_monitor = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\animal_monitor.sqf";
  24. //building_monitor = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\building_monitor.sqf";
  25. 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
  26. player_packTent = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_packTent.sqf";
  27. //control_zombieAgent = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\control_zombieAgent.sqf";
  28. player_updateGui = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_updateGui.sqf";
  29. player_crossbowBolt = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_crossbowBolt.sqf";
  30. stream_locationFill = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\stream_locationFill.sqf";
  31. stream_locationDel = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\stream_locationDel.sqf";
  32. stream_locationCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\stream_locationCheck.sqf";
  33. player_music = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_music.sqf"; //Used to generate ambient music
  34. //player_login = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_login.sqf"; //Used to generate ambient music
  35. player_death = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_death.sqf";
  36. player_switchModel = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_switchModel.sqf";
  37. player_checkStealth = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_checkStealth.sqf";
  38. world_sunRise = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_sunRise.sqf";
  39. world_surfaceNoise = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_surfaceNoise.sqf";
  40. player_humanityMorph = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_humanityMorph.sqf";
  41. player_throwObject = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_throwObject.sqf";
  42. player_alertZombies = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_alertZombies.sqf";
  43. player_fireMonitor = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\fire_monitor.sqf";
  44. player_countMagazines = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_countMagazines.sqf";
  45. player_forceSave = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_forceSave.sqf";
  46. player_destroyTent = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_destroyTent.sqf";
  47. player_Bubble = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_Bubble.sqf";
  48. //Objects
  49. object_roadFlare = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_roadFlare.sqf";
  50. object_setpitchbank = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_setpitchbank.sqf";
  51. object_monitorGear = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_monitorGear.sqf";
  52.  
  53. //Zombies
  54. zombie_findTargetAgent = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\zombie_findTargetAgent.sqf";
  55. player_zombieSwarmAttack = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieSwarmAttack.sqf";
  56. zombie_loiter = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\zombie_loiter.sqf"; //Server compile, used for loiter behaviour
  57. zombie_generate = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\zombie_generate.sqf"; //Server compile, used for loiter behaviours
  58. zombie_generateSwarm = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\swarm_generate.sqf";
  59.  
  60. //actions
  61. player_addToolbelt = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_addToolbelt.sqf";
  62. player_addtoBack = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_addtoBack.sqf";
  63. player_reloadMag = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_reloadMags.sqf";
  64. player_tentPitch = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\tent_pitch.sqf";
  65. player_createstash = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_createstash.sqf";
  66. player_drink = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_drink.sqf";
  67. player_drinkWater = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_drinkWater.sqf";
  68. player_eat = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_eat.sqf";
  69. player_useMeds = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_useMeds.sqf";
  70. player_useAttchment = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_useAttchment.sqf";
  71. player_fillWater = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\water_fill.sqf";
  72. player_makeFire = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_makefire.sqf";
  73. player_chopWood = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_chopWood.sqf";
  74. player_build = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_build.sqf";
  75. object_build = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\object_build.sqf";
  76. player_wearClothes = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_wearClothes.sqf";
  77. player_dropWeapon = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_dropWeapon.sqf";
  78. player_setTrap = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_setTrap.sqf";
  79. object_pickup = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\object_pickup.sqf";
  80. player_flipvehicle = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_flipvehicle.sqf";
  81. player_sleep = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_sleep.sqf";
  82. player_combineMag = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_combineMags.sqf";
  83. player_createquiver = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_createQuiver.sqf";
  84. player_fillquiver = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_fillQuiver.sqf";
  85. player_takearrow = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_takeArrow.sqf";
  86. player_switchWeapon = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_switchWeapon.sqf";
  87. player_goFishing = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_goFishing.sqf";
  88. player_gather = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_gather.sqf";
  89. player_fixBottle = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_fixBottle.sqf";
  90. player_tearClothes = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_tearClothes.sqf";
  91. object_remove = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\remove.sqf";
  92. player_fixHatchet = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_fixHatchet.sqf";
  93.  
  94. //ui
  95. player_selectSlot = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\ui_selectSlot.sqf";
  96. player_gearSet = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_gearSet.sqf";
  97. ui_changeDisplay = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\ui_changeDisplay.sqf";
  98. ui_gear_sound = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\ui_gear_sound.sqf";
  99.  
  100. //playerstats
  101. horde_epeen_fnc_fill_page = compile preProcessFile "\z\addons\dayz_code\actions\playerstats\fill_page_fnc.sqf";
  102. horde_epeen_determine_humanity_fnc = compile preProcessFile "\z\addons\dayz_code\actions\playerstats\determine_humanity_fnc.sqf";
  103. horde_epeen_setText_journal_fnc = compile preProcessFile "\z\addons\dayz_code\actions\playerstats\epeen_setText_journal.sqf";
  104. horde_epeen_setText_humanity_fnc = compile preProcessFile "\z\addons\dayz_code\actions\playerstats\epeen_setText_humanity.sqf";
  105. horde_epeen_setText_stats_fnc = compile preProcessFile "\z\addons\dayz_code\actions\playerstats\epeen_setText_stats.sqf";
  106. horde_epeen_show_humanity_fnc = compile preProcessFile "\z\addons\dayz_code\actions\playerstats\show_humanity_fnc.sqf";
  107.  
  108. //System
  109. player_monitor = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\player_monitor.sqf";
  110. player_spawn_1 = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\player_spawn_1.sqf";
  111. player_spawn_2 = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\player_spawn_2.sqf";
  112. onPreloadStarted "dayz_preloadFinished = false;";
  113. onPreloadFinished "dayz_preloadFinished = true;";
  114. infectedcamps = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_infectedcamps.sqf";
  115. camp_spawnZombies = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\camp_spawnZombies.sqf"; //Server compile, used for loiter behaviour
  116.  
  117. //Crafting
  118. fn_updateCraftUI = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_updateCraftUI.sqf";
  119. player_craftItem = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_craftItem.sqf";
  120. player_craftItemGUI = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_craftItemGUI.sqf";
  121. player_checkRecipe = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_checkRecipe.sqf";
  122.  
  123. fn_buildCamera = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_buildCamera.sqf";
  124.  
  125. // TODO: need move it in player_monitor.fsm
  126. // allow player disconnect from server, if loading hang, kicked by BE etc.
  127.  
  128. //This is still needed but the fsm should terminate if any errors pop up.
  129.  
  130. [] spawn {
  131. private["_timeOut","_display","_control1","_control2"];
  132. disableSerialization;
  133. _timeOut = 0;
  134. dayz_loadScreenMsg = "";
  135. diag_log "DEBUG: loadscreen guard started.";
  136. _display = uiNameSpace getVariable "BIS_loadingScreen";
  137. if (!isNil "_display") then {
  138. _control1 = _display displayctrl 8400;
  139. _control2 = _display displayctrl 102;
  140. };
  141.  
  142. //waitUntil {!dayz_DisplayGenderSelect};
  143.  
  144. // 120 sec timeout (12000 * 0.01)
  145. while { _timeOut < 12000 } do {
  146. if (dayz_clientPreload && dayz_authed) exitWith { diag_log "PLOGIN: Login loop completed!"; };
  147. if (!isNil "_display") then {
  148. if ( isNull _display ) then {
  149. waitUntil { !dialog; };
  150. startLoadingScreen ["","RscDisplayLoadCustom"];
  151. _display = uiNameSpace getVariable "BIS_loadingScreen";
  152. _control1 = _display displayctrl 8400;
  153. _control2 = _display displayctrl 102;
  154. };
  155.  
  156. if ( dayz_loadScreenMsg != "" ) then {
  157. _control1 ctrlSetText dayz_loadScreenMsg;
  158. dayz_loadScreenMsg = "";
  159. };
  160.  
  161. _control2 ctrlSetText format["%1",round(_timeOut*0.01)];
  162. };
  163.  
  164. _timeOut = _timeOut + 1;
  165.  
  166. if (_timeOut >= 12000) then {
  167. 1 cutText [localize "str_player_login_timeout", "PLAIN DOWN"];
  168. sleep 10;
  169. endLoadingScreen;
  170. endMission "END1";
  171. };
  172.  
  173. sleep 0.01;
  174. };
  175. };
  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 ["_ctrlBleed","_ctrlFracture"];
  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. };
  205.  
  206. dayz_angleCheck = {
  207. private ["_degree","_tPos","_zPos","_inAngle"];
  208. _target = _this select 0;
  209. _agent = _this select 1;
  210. _degree = _this select 2;
  211. _inAngle = false;
  212. _tPos = (getPosASL _target);
  213. _zPos = (getPosASL _agent);
  214. _eyeDir = (direction _agent);
  215. _inAngle = [_zPos,_eyeDir,_degree,_tPos] call fnc_inAngleSector;
  216. _inAngle
  217. };
  218.  
  219. dayz_AttackCheck = {
  220. private ["_cantSee","_attackCheck"];
  221. _target = _this select 0;
  222. _agent = _this select 1;
  223. _degree = _this select 2;
  224. _attackCheck = false;
  225. _inAngle = [_target,_agent,_degree] call dayz_angleCheck;
  226. if (_inAngle) then {
  227. _cantSee = [_target,_agent] call dayz_losCheck;
  228. if (!_cantSee) then {
  229. _attackCheck = true;
  230. };
  231. };
  232. _attackCheck
  233. };
  234.  
  235. dayz_losCheck = {
  236. private "_cantSee";
  237. _target = _this select 0; // PUT THE PLAYER IN FIRST ARGUMENT!!!!
  238. _agent = _this select 1;
  239. _cantSee = true;
  240.  
  241. if ((!isNull _target) and (!isNull _agent)) then {
  242. private ["_tPos","_zPos"];
  243. _tPos = eyePos _target;
  244. _zPos = eyePos _agent;
  245. if ((count _tPos > 0) and (count _zPos > 0)) then {
  246. _cantSee = terrainIntersectASL [(eyePos _target), (eyePos _agent)];
  247. //diag_log ("terrainIntersectASL: " + str(_cantSee));
  248.  
  249. if (!_cantSee) then {
  250. _cantSee = lineIntersects [(eyePos _target), (eyePos _agent)];
  251. //diag_log ("lineIntersects: " + str(_cantSee));
  252. };
  253. };
  254. };
  255. _cantSee
  256. };
  257.  
  258. dayz_dropItem = {
  259. private ["_nearByPile","_item"];
  260.  
  261. _type = _this select 0;
  262. _dropItem = _this select 1;
  263. _dropAmount = _this select 2;
  264.  
  265. _nearByPile = nearestObjects [(getPosATL player), ["WeaponHolder","WeaponHolderBase"],2];
  266. if (count _nearByPile == 0) then {
  267. _item = createVehicle ["WeaponHolder", (getPosATL player), [], 0.0, "CAN_COLLIDE"];
  268. } else {
  269. _item = _nearByPile select 0;
  270. };
  271. _item addMagazineCargoGlobal [_dropItem,_dropAmount];
  272. _item setvelocity [0,0,1];
  273. };
  274.  
  275. dayz_NutritionSystem = {
  276. private ["_type","_baseRegen","_nutrition","_calorieCount","_hungerCount","_thirstCount","_tempCount","_Thirst","_Hunger","_bloodregen","_golbalNutrition"];
  277. //["type",regen,[NutritionTable,thirst(Working Class),hunger(Working Class)]]
  278. //info to be added
  279. _type = _this select 0;
  280. _baseRegen = _this select 1;
  281. _nutrition = _this select 2;
  282.  
  283. //Nutrition array
  284. _calorieCount = ((_this select 2) select 0);
  285. //gain
  286. _hungerCount = ((_this select 2) select 1);
  287. _thirstCount = ((_this select 2) select 2);
  288. _tempCount = ((_this select 2) select 3);
  289.  
  290. diag_log format["Type: %1, BaseRegen: %2, Nutrition: %3",_type,_baseRegen,_nutrition];
  291.  
  292. //3610 is based on a 80kg male 180cm tall
  293. if (_calorieCount > 0) then {
  294. _hungerCount = _hungerCount + (SleepFood * (((ln ((_calorieCount / 3610) * 100)) * (1 - (dayz_hunger / SleepFood))) / 100));
  295. _thirstCount = _thirstCount + (SleepWater * (((ln ((_calorieCount / 3610) * 100)) * (1 - (dayz_thirst / SleepWater))) / 100));
  296. };
  297.  
  298. switch (_type) do {
  299. case "FoodDrink": {
  300. //hunger
  301. if (_hungerCount > 0) then {
  302. if (dayz_hunger > _hungerCount) then {
  303. dayz_hunger = dayz_hunger - (_hungerCount);
  304. } else {
  305. dayz_hunger = 0;
  306. };
  307. };
  308. //thirst
  309. if (_thirstCount > 0) then {
  310. if (dayz_thirst > _thirstCount) then {
  311. dayz_thirst = dayz_thirst - _thirstCount;
  312. } else {
  313. dayz_thirst = 0;
  314. };
  315. };
  316. //temp
  317. if (_tempCount > 0) then { dayz_temperatur = dayz_temperatur + _tempCount; };
  318. //calorie
  319. if (_calorieCount > 0) then { dayz_nutrition = dayz_nutrition + _calorieCount; };
  320. //blood
  321. if (_baseRegen > 0) then { r_player_bloodregen = r_player_bloodregen + _baseRegen; };
  322. };
  323.  
  324. case "Working": {
  325. if (_calorieCount > 0) then { dayz_nutrition = dayz_nutrition - _calorieCount; };
  326. if (_thirstCount > 0) then { dayz_thirst = dayz_thirst + _thirstCount; };
  327. if (_hungerCount > 0) then { dayz_hunger = dayz_hunger + _hungerCount; };
  328. if (_tempCount > 0) then { dayz_temperatur = dayz_temperatur + _tempCount; };
  329. };
  330.  
  331. };
  332.  
  333. //systemChat format ["%6, Nutrition add: %1, Nutrition Total: %2, Thurst: %3, Hunger: %4, BloodRegen: %5",_this,r_player_Nutrition,_Thirst,_Hunger,_bloodregen,_type];
  334. //diag_log format ["%6, Nutrition add: %1, Nutrition Total: %7/%2, Thurst: %3, Hunger: %4, BloodRegen: %5",_this,r_player_Nutrition,_Thirst,_Hunger,_bloodregen,_type,_golbalNutrition];
  335.  
  336. };
  337.  
  338. dayz_spaceInterrupt = {
  339. private "_handled";
  340. _dikCode = _this select 1;
  341. _shiftState = _this select 2;
  342. _ctrlState = _this select 3;
  343. _altState = _this select 4;
  344. _handled = false;
  345.  
  346. // Disable ESC after death (not sure if needed but it's here to make sure)
  347. if (_dikCode == 0x01 && r_player_dead) then {
  348. _handled = true;
  349. };
  350.  
  351. switch (_dikCode) do {
  352. case 0x02: {
  353. ["rifle"] spawn player_switchWeapon;
  354. _handled = true;
  355. };
  356. case 0x03: {
  357. ["pistol"] spawn player_switchWeapon;
  358. _handled = true;
  359. };
  360. case 0x04: {
  361. ["melee"] spawn player_switchWeapon;
  362. _handled = true;
  363. };
  364. default {
  365. if (_dikCode in [0x58,0x57,0x44,0x43,0x42,0x41,0x40,0x3F,0x3E,0x3D,0x3C,0x3B,0x0B,0x0A,0x09,0x08,0x07,0x06,0x05]) then {
  366. _handled = true;
  367. };
  368. };
  369. };
  370.  
  371. if ((_dikCode in actionKeys "Gear") and (vehicle player != player) and !_shiftState and !_ctrlState and !_altState && !dialog) then {
  372. createGearDialog [player, "RscDisplayGear"];
  373. _handled = true;
  374. };
  375.  
  376. if ((_dikCode in actionKeys "Gear") and (vehicle player == player) and (speed vehicle player > 0)) then {
  377. [objNull, player, rSwitchMove,""] call RE;
  378. _handled = true;
  379. };
  380.  
  381. //if (_dikCode in actionKeys 'MoveForward' or _dikCode in actionKeys 'MoveBack') then {r_interrupt = true};
  382. //Prevent exploit of drag body
  383. if ((_dikCode in actionKeys "Prone") and r_drag_sqf) then { force_dropBody = true; };
  384. if ((_dikCode in actionKeys "Crouch") and r_drag_sqf) then { force_dropBody = true; };
  385.  
  386. if (_dikCode in actionKeys "MoveLeft") then {r_interrupt = true};
  387. if (_dikCode in actionKeys "MoveRight") then {r_interrupt = true};
  388. if (_dikCode in actionKeys "MoveForward") then {r_interrupt = true};
  389. if (_dikCode in actionKeys "MoveBack") then {r_interrupt = true};
  390. if (_dikCode in actionKeys "ForceCommandingMode") then {_handled = true};
  391. if (_dikCode in actionKeys "PushToTalk" and (diag_ticktime - dayz_lastCheckBit > 10)) then {
  392. dayz_lastCheckBit = diag_ticktime;
  393. [player,20,true,(getPosATL player)] call player_alertZombies;
  394. };
  395. if (_dikCode in actionKeys "VoiceOverNet" and (diag_ticktime - dayz_lastCheckBit > 10)) then {
  396. dayz_lastCheckBit = diag_ticktime;
  397. [player,20,true,(getPosATL player)] call player_alertZombies;
  398. };
  399. if (_dikCode in actionKeys "PushToTalkDirect" and (diag_ticktime - dayz_lastCheckBit > 10)) then {
  400. dayz_lastCheckBit = diag_ticktime;
  401. [player,20,false,(getPosATL player)] call player_alertZombies;
  402. };
  403. if (_dikCode in actionKeys "Chat" and (diag_ticktime - dayz_lastCheckBit > 10)) then {
  404. dayz_lastCheckBit = diag_ticktime;
  405. [player,20,false,(getPosATL player)] call player_alertZombies;
  406. };
  407. if (_dikCode in actionKeys "User20" or _dikCode in actionKeys "NetworkStats") then {
  408. if (!dayz_isSwimming and !dialog) then {
  409. [player,4,true,(getPosATL player)] call player_alertZombies;
  410. createDialog "horde_journal_front_cover";
  411. };
  412. _handled = true;
  413. };
  414. if ((_dikCode in actionKeys "Turbo") and (vehicle player == player)) then {
  415. [objNull, player, rSwitchMove,""] call RE;
  416. _handled = true;
  417. };
  418. if ((_dikCode in [0x3E,0x0F,0xD3]) and (diag_ticktime - dayz_lastCheckBit > 10)) then {
  419. dayz_lastCheckBit = diag_ticktime;
  420. call player_forceSave;
  421. };
  422. if (_dikCode in [0xB8,0x38,0x3E,0x2A,0x36,0x01]) then {
  423. _displayg = findDisplay 106;
  424. if (!isNull _displayg) then {
  425. call player_forceSave;
  426. } else {
  427. if (dialog) then {
  428. call player_forceSave;
  429. };
  430. };
  431. };
  432. if ((_dikCode in actionKeys "LeanLeft") or (_dikCode in actionKeys "LeanRight")) then {
  433. dayz_dodge = true;
  434. //_handled = true;
  435. };
  436. _object = player getVariable ["constructionObject", objNull];
  437. if (!isNull _object and _dikCode in actionKeys "LeanLeft") then {
  438. _dir = getDir _object - 3;
  439. _object setDir _dir;
  440. _handled = true;
  441. };
  442. if (!isNull _object and _dikCode in actionKeys "LeanRight") then {
  443. _dir = getDir _object + 3;
  444. _object setDir _dir;
  445. _handled = true;
  446. };
  447. /*
  448. //Move Up NumPad 8
  449. if (!isNull _object and _dikCode == 0x48) then {
  450. _object setPos [ (getPos _object select 0) + 0.5, getPos _object select 1, getPos _object select 2];
  451. _handled = true;
  452. };
  453. //Move Down NumPad 2
  454. if (!isNull _object and _dikCode == 0x50) then {
  455. _object setPos [ (getPos _object select 0) - 0.5, getPos _object select 1, getPos _object select 2];
  456. _handled = true;
  457. };
  458.  
  459. //Move Down NumPad 4
  460. if (!isNull _object and _dikCode == 0x4B) then {
  461. _object setPos [ getPos _object select 0, (getPos _object select 1) - 0.5, getPos _object select 2];
  462. _handled = true;
  463. };
  464. //Move Down NumPad 6
  465. if (!isNull _object and _dikCode == 0x4D) then {
  466. _object setPos [ getPos _object select 0, (getPos _object select 1) + 0.5, getPos _object select 2];
  467. _handled = true;
  468. };
  469. */
  470. //Rotate Left NumPad 7
  471. if (!isNull _object and _dikCode == 0x47) then {
  472. _dir = getDir _object - 1;
  473. _object setDir _dir;
  474. _handled = true;
  475. };
  476. //Rotate Right NumPad 9
  477. if (!isNull _object and _dikCode == 0x49) then {
  478. _dir = getDir _object + 1;
  479. _object setDir _dir;
  480. _handled = true;
  481. };
  482. _handled
  483. };
  484.  
  485. player_guiControlFlash = {
  486. //private["_control"];
  487. //_control = _this;
  488. if (ctrlShown _this) then {
  489. _this ctrlShow false;
  490. } else {
  491. _this ctrlShow true;
  492. };
  493. };
  494.  
  495. gear_ui_offMenu = {
  496. private["_control","_parent","_menu","_grpPos"];
  497. disableSerialization;
  498. _control = _this select 0;
  499. _parent = findDisplay 106;
  500. if (!(_this select 3)) then {
  501. for "_i" from 0 to 9 do {
  502. _menu = _parent displayCtrl (1600 + _i);
  503. _menu ctrlShow false;
  504. };
  505. _grpPos = ctrlPosition _control;
  506. _grpPos set [3,0];
  507. _control ctrlSetPosition _grpPos;
  508. _control ctrlShow false;
  509. _control ctrlCommit 0;
  510. };
  511. };
  512.  
  513.  
  514. gear_ui_init = {
  515. //private["_control","_parent","_menu","_grpPos"];
  516. disableSerialization;
  517. _parent = findDisplay 106;
  518. _control = _parent displayCtrl 6902;
  519. for "_i" from 0 to 9 do {
  520. _menu = _parent displayCtrl (1600 + _i);
  521. _menu ctrlShow false;
  522. };
  523. _grpPos = ctrlPosition _control;
  524. _grpPos set [3,0];
  525. _control ctrlSetPosition _grpPos;
  526. _control ctrlShow false;
  527. _control ctrlCommit 0;
  528. };
  529.  
  530. gear_ui_hide = {
  531. //private["_display","_BP"];
  532. disableSerialization;
  533. _display = findDisplay 106;
  534. _BP = unitBackpack player;
  535. if (ctrlShown (_display displayCtrl 159)) then {//prevent background images in backpack view
  536. for "_i" from 1006 to 1011 do {
  537. (_display displayCtrl _i) ctrlShow false;
  538. };
  539. } else {
  540. for "_i" from 1006 to 1011 do {
  541. if (!(ctrlShown (_display displayCtrl _i))) then {
  542. (_display displayCtrl _i) ctrlShow true;
  543. };
  544. };
  545. };
  546. //hide buttons if unnecessary
  547. if (isNull _BP || ((typeOf _BP) == "")) then {
  548. (_display displayCtrl 132) ctrlShow false;
  549. (_display displayCtrl 157) ctrlShow false;
  550. (_display displayCtrl 158) ctrlShow false;
  551. };
  552.  
  553. // Prevent carrying 2 rifles 'exploit'
  554. if (primaryWeapon player == "" && dayz_onBack != "" && !(dayz_onBack in MeleeWeapons)) then {
  555. ["gear"] call player_switchWeapon;
  556. };
  557.  
  558. if (primaryWeapon player != "" && (primaryWeapon player in MeleeWeapons || dayz_onBack in MeleeWeapons)) then {
  559. (_display displayCtrl 1204) ctrlShow true;
  560. } else {
  561. (_display displayCtrl 1204) ctrlShow false;
  562. };
  563.  
  564. if (DayZ_onBack != "") then {
  565. (_display displayCtrl 1208) ctrlShow true;
  566. } else {
  567. (_display displayCtrl 1208) ctrlShow false;
  568. };
  569.  
  570. for "_i" from 0 to (lbSize (_display displayCtrl 105)) - 1 do {
  571. (_display displayCtrl 105) lbSetColor [_i, [0.06, 0.05, 0.03, 1]];
  572. };
  573. };
  574.  
  575. dayz_lowHumanity = {
  576. //private["_unit","_humanity","_delay"];
  577. _unit = _this;
  578. if ((_unit distance player) < 15) then {
  579. private "_humanity";
  580. _humanity = _unit getVariable["humanity",0];
  581. dayz_heartBeat = true;
  582. if (_humanity < -3000) then {
  583. private "_delay";
  584. _delay = ((10000 + _humanity) / 5500) + 0.3;
  585. playSound "heartbeat_1";
  586. sleep _delay;
  587. };
  588. dayz_heartBeat = false;
  589. };
  590. };
  591.  
  592. dayz_meleeMagazineCheck = {
  593. //private["_meleeNum","_magType","_wpnType","_ismelee"];
  594. _wpnType = primaryWeapon player;
  595. _ismelee = (gettext (configFile >> "CfgWeapons" >> _wpnType >> "melee"));
  596. if (_ismelee == "true") then {
  597. private ["_meleeNum","_magType"];
  598. _magType = ([] + getArray (configFile >> "CfgWeapons" >> _wpnType >> "magazines")) select 0;
  599. _meleeNum = ({_x == _magType} count magazines player);
  600. if (_meleeNum < 1) then {
  601. player addMagazine _magType;
  602. };
  603. };
  604. };
  605. dayz_originalPlayer = player;
  606. };
  607.  
  608. progressLoadingScreen 0.8;
  609.  
  610. //Both
  611. BIS_fnc_selectRandom = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_selectRandom.sqf"; //Checks which actions for nearby casualty
  612. fnc_buildWeightedArray = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_buildWeightedArray.sqf"; //Checks which actions for nearby casualty
  613. zombie_initialize = compile preprocessFileLineNumbers "\z\addons\dayz_code\init\zombie_init.sqf";
  614. //object_vehicleKilled = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_vehicleKilled.sqf"; //Event handler run on damage
  615. 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
  616. object_setHit = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_setHit.sqf"; //process the hit as a NORMAL damage (useful for persistent vehicles)
  617. object_processHit = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_processHit.sqf"; //process the hit in the REVO damage system (records and sets hit)
  618. //object_delLocal = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_delLocal.sqf";
  619. //object_cargoCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_cargoCheck.sqf"; //Run by the player or server to monitor changes in cargo contents
  620. fnc_usec_damageHandler = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandler.sqf"; //Event handler run on damage
  621. // Vehicle damage fix
  622. fnc_veh_handleDam = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\veh_handleDam.sqf";
  623. fnc_veh_handleKilled = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\veh_handleKilled.sqf";
  624. fnc_veh_handleRepair = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\veh_handleRepair.sqf"; //process the hit as a NORMAL damage (useful for persistent vehicles)
  625. fnc_veh_ResetEH = compile preprocessFileLineNumbers "\z\addons\dayz_code\init\veh_ResetEH.sqf"; //Initialize vehicle
  626. fnc_veh_setFixServer = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\veh_setFixServer.sqf"; //process the hit as a NORMAL damage (useful for persistent vehicles)
  627. fnc_inString = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_inString.sqf";
  628. fnc_isInsideBuilding = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_isInsideBuilding.sqf"; //_isInside = [_unit,_building] call fnc_isInsideBuilding;
  629. dayz_zombieSpeak = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_speak.sqf"; //Used to generate random speech for a unit
  630. vehicle_getHitpoints = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_getHitpoints.sqf";
  631. local_gutObject = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_gutObject.sqf"; //Generated on the server (or local to unit) when gutting an object
  632. local_zombieDamage = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandlerZ.sqf"; //Generated by the client who created a zombie to track damage
  633. local_setFuel = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_setFuel.sqf"; //Generated when someone refuels a vehicle
  634. local_eventKill = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_eventKill.sqf"; //Generated when something is killed
  635. //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
  636. //curTimeStr = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_curTimeStr.sqf";
  637. player_medBandage = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medBandaged.sqf";
  638. player_medInject = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medInject.sqf";
  639. player_medEpi = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medEpi.sqf";
  640. player_medTransfuse = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medTransfuse.sqf";
  641. player_medMorphine = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medMorphine.sqf";
  642. player_medPainkiller = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medPainkiller.sqf";
  643. player_medAntiBiotics = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medAntibiotics.sqf";
  644. player_humanityChange = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_humanityChange.sqf";
  645. spawn_loot = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\spawn_loot.sqf";
  646. player_projectileNear = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_projectileNear.sqf";
  647. player_bloodCalc = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\bloodCalc.sqf";
  648. fn_selectRandomLocation = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_selectRandomLocation.sqf";
  649. fn_chance = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_selectRandomChance.sqf";
  650.  
  651. call compile preprocessFileLineNumbers "\z\addons\dayz_code\traps\init.sqf";
  652.  
  653. player_sumMedical = {
  654. private["_character","_wounds","_legs","_arms","_medical", "_status"];
  655. _character = _this;
  656. _wounds = [];
  657. if (_character getVariable["USEC_injured",false]) then {
  658. {
  659. _status = _character getVariable["hit_"+_x,false];
  660. if ((typeName _status == "BOOLEAN") AND {(_status)}) then {
  661. _wounds set [count _wounds,_x];
  662. };
  663. } forEach USEC_typeOfWounds;
  664. };
  665. _legs = _character getVariable ["hit_legs",0];
  666. _arms = _character getVariable ["hit_arms",0];
  667. _medical = [
  668. _character getVariable["USEC_isDead",false],
  669. _character getVariable["NORRN_unconscious", false],
  670. _character getVariable["USEC_infected",false],
  671. _character getVariable["USEC_injured",false],
  672. _character getVariable["USEC_inPain",false],
  673. _character getVariable["USEC_isCardiac",false],
  674. _character getVariable["USEC_lowBlood",false],
  675. _character getVariable["USEC_BloodQty",12000],
  676. _wounds,
  677. [_legs,_arms],
  678. _character getVariable["unconsciousTime",0],
  679. _character getVariable["blood_type",false],
  680. _character getVariable["rh_factor",false],
  681. _character getVariable["messing",[0,0,0]]
  682. ];
  683. _medical
  684. };
  685.  
  686. fn_niceSpot = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_niceSpot.sqf";
  687.  
  688. //Server Only
  689. if (isServer) then {
  690. call compile preprocessFileLineNumbers "\z\addons\dayz_server\init\server_functions.sqf";
  691. } else {
  692. eh_localCleanup = {};
  693. };
  694.  
  695. //Start Dynamic Weather
  696. execVM "\z\addons\dayz_code\system\DynamicWeatherEffects.sqf";
  697. initialized = true;
Advertisement
Add Comment
Please, Sign In to add comment