Darth_Rogue

ExileClient_object_item_construct.sqf

Jan 15th, 2016
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 3.58 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","_cantBuildNear","_cantBuildDist"];
  13. _itemClassName = _this select 0;
  14.  
  15. _cantBuildNear = [
  16.                 //Military
  17.                 "Land_Airport_Tower_F","Land_i_Barracks_V1_F","Land_i_Barracks_V2_F","Land_u_Barracks_V2_F","Land_Cargo_House_V1_F","Land_Cargo_House_V2_F","Land_Cargo_House_V3_F","Land_Cargo_HQ_V1_F",
  18.                 "Land_Cargo_HQ_V2_F","Land_Cargo_HQ_V3_F","Land_Cargo_Patrol_V1_F","Land_Cargo_Patrol_V2_F","Land_Cargo_Patrol_V3_F","Land_Cargo_Tower_V1_F","Land_Cargo_Tower_V1_No1_F","Land_Cargo_Tower_V1_No2_F",
  19.                 "Land_Cargo_Tower_V1_No3_F","Land_Cargo_Tower_V1_No4_F","Land_Cargo_Tower_V1_No5_F","Land_Cargo_Tower_V1_No6_F","Land_Cargo_Tower_V1_No7_F","Land_Cargo_Tower_V2_F","Land_Cargo_Tower_V3_F",
  20.                 "Land_Medevac_house_V1_F","Land_Medevac_HQ_V1_F","Land_HBarrierTower_F","Land_MilOffices_V1_F","Land_Dome_Big_F","Land_Dome_Small_F","Land_Research_house_V1_F","Land_Research_HQ_F"
  21.                 ];
  22. _cantBuildDist = 350;
  23.  
  24. if( isClass(configFile >> "CfgMagazines" >> _itemClassName >> "Interactions" >> "Constructing") ) then
  25. {
  26.     if (findDisplay 602 != displayNull) then
  27.     {
  28.         (findDisplay 602) closeDisplay 2;
  29.     };
  30.     try
  31.     {
  32.         if !((vehicle player) isEqualTo player) then
  33.         {
  34.             throw "ConstructionVehicleWarning";
  35.         };
  36.         _minimumDistanceToTraderZones = getNumber (missionConfigFile >> "CfgTerritories" >> "minimumDistanceToTraderZones");
  37.         if ([player, _minimumDistanceToTraderZones] call ExileClient_util_world_isTraderZoneInRange) then
  38.         {
  39.             throw "ConstructionTraderZoneWarning";
  40.         };
  41.         _minimumDistanceToSpawnZones = getNumber (missionConfigFile >> "CfgTerritories" >> "minimumDistanceToSpawnZones");
  42.         if ([player, _minimumDistanceToSpawnZones] call ExileClient_util_world_isSpawnZoneInRange) then
  43.         {
  44.             throw "ConstructionSpawnZoneWarning";
  45.         };
  46.         if ({typeOf _x in _cantBuildNear} count nearestObjects[player, _cantBuildNear, _cantBuildDist] > 0) exitWith
  47.         {
  48.             ["WHOOPS", ["You cannot build within 350m of military buildings!"]] call ExileClient_gui_notification_event_addNotification;
  49.         };
  50.         if (isOnRoad getPosATL player) exitWith
  51.         {
  52.             ["WHOOPS", ["You cannot build on a road!"]] call ExileClient_gui_notification_event_addNotification;
  53.         };
  54.         if(_itemClassName isEqualTo "Exile_Item_Flag") then
  55.         {
  56.             _maximumNumberOfTerritoriesPerPlayer = getNumber (missionConfigFile >> "CfgTerritories" >> "maximumNumberOfTerritoriesPerPlayer");
  57.             _numberOfTerritories = player call ExileClient_util_territory_getNumberOfTerritories;
  58.             if (_numberOfTerritories >= _maximumNumberOfTerritoriesPerPlayer) then
  59.             {
  60.                 throw "MaximumNumberOfTerritoriesReached";
  61.             };
  62.             call ExileClient_gui_setupTerritoryDialog_show;
  63.         }
  64.         else
  65.         {
  66.             [_itemClassName] call ExileClient_construction_beginNewObject;
  67.         };
  68.     }
  69.     catch
  70.     {
  71.        [_exception] call ExileClient_gui_notification_event_addNotification;
  72.     };
  73. };
  74. true
Advertisement
Add Comment
Please, Sign In to add comment