XEH_postinit.sqf 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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_r2_charge_pack_x10_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_clearAllJammers", {
  62. _this call rd501_fnc_clearAllJammers
  63. }] call CBA_fnc_addEventHandler;
  64. ["rd501_jammerServerPFH", {
  65. [{
  66. _this call rd501_fnc_jammersServerPFH
  67. }, 1] call CBA_fnc_addPerFrameHandler;
  68. }] call CBA_fnc_addEventHandler;
  69. // Grenade Deployables
  70. ["ace_firedPlayer", {
  71. params["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"];
  72. if (isNull _projectile) then {
  73. _projectile = nearestObject [_unit, _ammo];
  74. };
  75. private _config = configFile >> "CfgAmmo" >> _ammo;
  76. if (getNumber (_config >> "rd501_grenade_deployable") == 1) then {
  77. private _deployable = getText (_config >> "rd501_grenade_deployable_object");
  78. private _ttl = getNumber (_config >> "rd501_grenade_deployable_timeToLive");
  79. if(isNil "_ttl") then {
  80. _ttl = -1;
  81. };
  82. [
  83. {
  84. params["_projectile", "_deployable"];
  85. private _speed = vectorMagnitude (velocity _projectile);
  86. !(isNil "_projectile") && (alive _projectile) && _speed <= 0.1
  87. },
  88. {
  89. params["_projectile", "_deployable", "_timeToLive"];
  90. private _position = getPosATL _projectile;
  91. private _deployed = createVehicle [_deployable, _position, [], 0, "CAN_COLLIDE"];
  92. _deployed setPosATL _position;
  93. deleteVehicle _projectile;
  94. if(_timeToLive > 0) then {
  95. [
  96. {
  97. params["_deployed"];
  98. deleteVehicle _deployed;
  99. },
  100. [_deployed],
  101. _timeToLive
  102. ] call CBA_fnc_waitAndExecute;
  103. };
  104. },
  105. [_projectile, _deployable, _ttl, _magazine, _unit],
  106. 10,
  107. {
  108. params["", "", "", "_magazine", "_unit"];
  109. systemChat "Something went wrong with your order, we apologise for the inconvenience.";
  110. systemChat "Please file all complaints with Mirror at the Aux Office.";
  111. [
  112. {
  113. params["_unit", "_mag"];
  114. _unit addItem _mag;
  115. systemChat "We've attached a complementary replacement if you had any inventory space.";
  116. },
  117. [_unit, _magazine],
  118. 2
  119. ] call CBA_fnc_waitAndExecute;
  120. }
  121. ] call CBA_fnc_waitUntilAndExecute;
  122. };
  123. }] call CBA_fnc_addEventHandler;
  124. // Prevent Dismount on all Zeus Placed Items
  125. {
  126. private _idx = _x addEventHandler ["CuratorObjectPlaced", {
  127. params ["_curator","_entity"];
  128. if(!(_entity isKindOf "Man") && (side _entity) == east) then {
  129. _entity allowCrewInImmobile true;
  130. _entity setVehicleLock "LOCKED";
  131. };
  132. }];
  133. _x setVariable ["rd501_curator_dismount_disable_index", _idx, false];
  134. } forEach allCurators;