Advertisement
Brenner650

ExileClient_object_item_construct.sqf

Dec 30th, 2021
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.91 KB | None | 0 0
  1. **
  2. * ExileClient_object_item_construct
  3. *
  4. * Exile Mod
  5. * www.exilemod.com
  6. * © 2015 Exile Mod Team
  7. *
  8. * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
  9. * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
  10. */
  11.  
  12. private["_itemClassName", "_minimumDistanceToTraderZones", "_minimumDistanceToSpawnZones", "_maximumNumberOfTerritoriesPerPlayer", "_numberOfTerritories"];
  13. _itemClassName = _this select 0;
  14. if !(_itemClassName in (magazines player)) exitWith {false};
  15. if( isClass(configFile >> "CfgMagazines" >> _itemClassName >> "Interactions" >> "Constructing") ) then
  16. {
  17. if (findDisplay 602 != displayNull) then
  18. {
  19. (findDisplay 602) closeDisplay 2;
  20. };
  21. /* PREVENT BUILDING NEAR CERTAIN TYPES OF BUILDING */
  22. _cantBuildNear = [
  23. //"Land_Dome_Big_F",
  24. //"Land_Dome_Small_F",
  25. "Land_Barracks_ruins_F",
  26. "Land_Barracks_01_camo_F",
  27. //"Land_Mil_Barracks", //CUP
  28. //"Land_Mil_Barracks_i", //CUP
  29. //"Land_Mil_Barracks_L", //CUP
  30. //"Land_Mil_ControlTower", //CUP
  31. //"Land_Mil_ControlTower_dam", //CUP
  32. //"Land_Mil_Guardhouse", //CUP
  33. //"Land_Mil_House", //CUP
  34. //"Land_Mil_House_dam", //CUP
  35. "Land_i_Barracks_V1_F", //Disabled in EBM
  36. "Land_i_Barracks_V1_dam_F",
  37. "Land_i_Barracks_V2_F",
  38. "Land_i_Barracks_V2_dam_F",
  39. "Land_u_Barracks_V2_F",
  40. "Land_Hospital_main_F",
  41. "Land_Hospital_side1_F",
  42. "Land_Hospital_side2_F",
  43. "Land_MilOffices_V1_F",
  44. //"Land_Hangar_F",
  45. //"Land_Ss_Hanger",
  46. "Land_Airport_Tower_F", //Disabled in EBM
  47. "Land_Airport_02_controlTower_F",
  48. "Land_Cargo_House_V1_F",
  49. "Land_Cargo_House_V2_F", //Disabled in EBM
  50. "Land_Cargo_House_V3_F",
  51. "Land_Cargo_HQ_V1_F",
  52. "Land_Cargo_HQ_V2_F",
  53. "Land_Cargo_HQ_V3_F",
  54. "Land_Cargo_Patrol_V1_F",
  55. "Land_Cargo_Patrol_V2_F", //Disabled in EBM
  56. "Land_Cargo_Tower_V1_F",
  57. "Land_Cargo_Tower_V1_No1_F",
  58. "Land_Cargo_Tower_V1_No2_F",
  59. "Land_Cargo_Tower_V1_No3_F",
  60. "Land_Cargo_Tower_V1_No4_F",
  61. "Land_Cargo_Tower_V1_No5_F",
  62. "Land_Cargo_Tower_V1_No6_F",
  63. "Land_Cargo_Tower_V1_No7_F",
  64. "Land_Cargo_Tower_V2_F", //Disabled in EBM
  65. "Land_Cargo_Tower_V3_F",
  66. "Land_Radar_F"
  67. //"Land_Vez" //CUP
  68. ];
  69. _cantBuildDist = 200;
  70. // Disabled this for now. Use defined locations below to prevent building.
  71. /*if ({typeOf _x in _cantBuildNear} count nearestObjects[player, _cantBuildNear, _cantBuildDist] > 0) then
  72. {
  73. throw "Building near military is disallowed on this server.";
  74. };*/
  75. if ({typeOf _x in _cantBuildNear} count nearestObjects[player, _cantBuildNear, _cantBuildDist] > 0 && !(player call ExileClient_util_world_isInTerritory)) then
  76. {
  77. throw "Building near military is disallowed on this server.";
  78. };
  79. /* PREVENT BUILDING NEAR CERTAIN TYPES OF BUILDING */
  80. try
  81. {
  82. if !((vehicle player) isEqualTo player) then
  83. {
  84. throw "You cannot build while in a vehicle.";
  85. };
  86. _minimumDistanceToTraderZones = getNumber (missionConfigFile >> "CfgTerritories" >> "minimumDistanceToTraderZones");
  87. if ([player, _minimumDistanceToTraderZones] call ExileClient_util_world_isTraderZoneInRange) then
  88. {
  89. throw "You are too close to a safe zone.";
  90. };
  91. if (player call ExileClient_util_world_isInNonConstructionZone) then
  92. {
  93. throw "Building is disallowed here on this server.";
  94. };
  95. if (player call ExileClient_util_world_isInConcreteMixerZone) then
  96. {
  97. throw "You are too close to a concrete mixer zone.";
  98. };
  99. _minimumDistanceToSpawnZones = getNumber (missionConfigFile >> "CfgTerritories" >> "minimumDistanceToSpawnZones");
  100. if ([player, _minimumDistanceToSpawnZones] call ExileClient_util_world_isSpawnZoneInRange) then
  101. {
  102. throw "You are too close to a spawn zone.";
  103. };
  104. if(_itemClassName isEqualTo "Exile_Item_Flag") then
  105. {
  106. _maximumNumberOfTerritoriesPerPlayer = getNumber (missionConfigFile >> "CfgTerritories" >> "maximumNumberOfTerritoriesPerPlayer");
  107. _numberOfTerritories = player call ExileClient_util_territory_getNumberOfTerritories;
  108. if (_numberOfTerritories >= _maximumNumberOfTerritoriesPerPlayer) then
  109. {
  110. throw "You have reached the maximum number of territories you can own.";
  111. };
  112. call ExileClient_gui_setupTerritoryDialog_show;
  113. }
  114.  
  115. else
  116. {
  117. [_itemClassName] call ExileClient_construction_beginNewObject;
  118. };
  119. }
  120. catch
  121. {
  122. ["ErrorTitleAndText", ["Construction aborted!", _exception]] call ExileClient_gui_toaster_addTemplateToast;
  123. };
  124. };
  125. true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement