XEH_postinit.sqf 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. #include "config_macros.hpp"
  2. //Run the jumppack script
  3. [] spawn {
  4. [] spawn compile preprocessFileLineNumbers 'macro_mod_script_path\jumppack\jumppack.sqf';
  5. sleep 0.5;
  6. call compile preprocessFileLineNumbers 'macro_mod_script_path\jumppack\jumppack_effects.sqf';
  7. };
  8. // Add nightvision event handler
  9. call macro_fnc_name(nightvision);
  10. #define QWEAP_NOFAM(name) macro_quote(macro_new_weapon_nofam(name))
  11. #define QWEAP_LAUNCH(name) macro_quote(macro_new_weapon(launcher,name))
  12. // Drone Recharge
  13. RD501_DRONE_BATTERY = "RD501_10mw_x30_mag";
  14. //Force Walk
  15. RD501_FORCE_WALK_WEAPONS = [macro_quote(macro_new_weapon_nofam(z1000))];
  16. ["weapon", macro_fnc_name(heavyWeaponHandlePlayerWeaponChanged)] call CBA_fnc_addPlayerEventHandler;
  17. //Auto Reload On Equip
  18. RD501_AUTO_RELOAD_ON_EQUIP = [QWEAP_NOFAM(z1000),QWEAP_LAUNCH(rps1)];
  19. ["weapon", macro_fnc_name(reloadWeaponOnFirstSelected)] call CBA_fnc_addPlayerEventHandler;
  20. // Magclamp
  21. call macro_fnc_name(magclamp);
  22. // Check every second for if the Loading Screen is still up and forcibly end it.
  23. _fnc_endLoadingScreen = {
  24. params ["_args", "_handle"];
  25. systemChat format["Ending LoadingScreen [Handle %1]", _handle];
  26. endLoadingScreen;
  27. _stillLoading = call BIS_fnc_isLoading;
  28. if(!_stillLoading) exitWith {
  29. [_handle] call CBA_fnc_removePerFrameHandler;
  30. };
  31. };
  32. [_fnc_endLoadingScreen, 5, []] call CBA_fnc_addPerFrameHandler;
  33. // Flip Backpack
  34. rd501_flip_vehicle_validBackpacks = ["RD501_JLTS_Clone_Flip_backpack"];
  35. ["rd501_external_reload", { _this call rd501_fnc_onReloadExternalHandler }, []] call CBA_fnc_addEventHandlerArgs;
  36. // Fortify Tool Adjustments
  37. call macro_fnc_name(fortify_tool);
  38. // Medical CCP Building
  39. rd501_medical_ccp_building = "Land_Medevac_house_V1_F";
  40. rd501_medical_ccp_classes = ["Land_Medevac_house_V1_F"];
  41. rd501_medical_ccp_stitchDurationSeconds = 10;
  42. rd501_medical_ccp_bandageDurationSeconds = 10;
  43. ["rd501_medical_ccp_incrementStitch",{
  44. _this call rd501_fnc_incrementStitchProgress
  45. }] call CBA_fnc_addEventHandler;
  46. ["rd501_medical_ccp_incrementBandage",{
  47. _this call rd501_fnc_incrementBandageProgress
  48. }] call CBA_fnc_addEventHandler;
  49. ["rd501_medical_ccp_deployCCPLocal", {
  50. _this call rd501_fnc_deployCCPLocal;
  51. }] call CBA_fnc_addEventHandler;
  52. ["rd501_medical_ccp_deployCCPServer", {
  53. _this call rd501_fnc_deployCCPServer;
  54. }] call CBA_fnc_addEventHandler;
  55. // Surrender stun
  56. call macro_fnc_name(stun);
  57. // Jammers
  58. ["rd501_addJammerLocal", {
  59. _this call rd501_fnc_addJammerLocal
  60. }] call CBA_fnc_addEventHandler;
  61. ["rd501_jammerServerPFH", {
  62. [{
  63. _this call rd501_fnc_jammersServerPFH
  64. }, 1] call CBA_fnc_addPerFrameHandler;
  65. }] call CBA_fnc_addEventHandler;
  66. // Grenade Deployables
  67. ["ace_firedPlayer", {
  68. params["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"];
  69. if (isNull _projectile) then {
  70. _projectile = nearestObject [_unit, _ammo];
  71. };
  72. private _config = configFile >> "CfgAmmo" >> _ammo;
  73. if (getNumber (_config >> "rd501_grenade_deployable") == 1) then {
  74. private _deployable = getText (_config >> "rd501_grenade_deployable_object");
  75. private _ttl = getNumber (_config >> "rd501_grenade_deployable_timeToLive");
  76. if(isNil "_ttl") then {
  77. _ttl = -1;
  78. };
  79. [
  80. {
  81. params["_projectile", "_deployable"];
  82. private _speed = vectorMagnitude (velocity _projectile);
  83. !(isNil "_projectile") && (alive _projectile) && _speed <= 0.1
  84. },
  85. {
  86. params["_projectile", "_deployable", "_timeToLive"];
  87. private _position = getPosATL _projectile;
  88. private _deployed = createVehicle [_deployable, _position, [], 0, "CAN_COLLIDE"];
  89. _deployed setPosATL _position;
  90. deleteVehicle _projectile;
  91. if(_timeToLive > 0) then {
  92. [
  93. {
  94. params["_deployed"];
  95. deleteVehicle _deployed;
  96. },
  97. [_deployed],
  98. _timeToLive
  99. ] call CBA_fnc_waitAndExecute;
  100. };
  101. },
  102. [_projectile, _deployable, _ttl, _magazine, _unit],
  103. 10,
  104. {
  105. params["", "", "", "_magazine", "_unit"];
  106. systemChat "Something went wrong with your order, we apologise for the inconvenience.";
  107. systemChat "Please file all complaints with Mirror at the Aux Office.";
  108. [
  109. {
  110. params["_unit", "_mag"];
  111. _unit addItem _mag;
  112. systemChat "We've attached a complementary replacement if you had any inventory space.";
  113. },
  114. [_unit, _magazine],
  115. 2
  116. ] call CBA_fnc_waitAndExecute;
  117. }
  118. ] call CBA_fnc_waitUntilAndExecute;
  119. };
  120. }] call CBA_fnc_addEventHandler;
  121. // Prevent Dismount on all Zeus Placed Items
  122. {
  123. private _idx = _x addEventHandler ["CuratorObjectPlaced", {
  124. params ["_curator","_entity"];
  125. if!(_entity isKindOf "Man" && side _entity == east) then {
  126. _entity allowCrewInImmobile true;
  127. _entity setVehicleLock "LOCKED";
  128. };
  129. }];
  130. _x setVariable ["rd501_curator_dismount_disable_index", _idx, false];
  131. } forEach allCurators;