Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- **
- * ExileClient_object_item_construct
- *
- * Exile Mod
- * www.exilemod.com
- * © 2015 Exile Mod Team
- *
- * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
- * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
- */
- private["_itemClassName", "_minimumDistanceToTraderZones", "_minimumDistanceToSpawnZones", "_maximumNumberOfTerritoriesPerPlayer", "_numberOfTerritories"];
- _itemClassName = _this select 0;
- if !(_itemClassName in (magazines player)) exitWith {false};
- if( isClass(configFile >> "CfgMagazines" >> _itemClassName >> "Interactions" >> "Constructing") ) then
- {
- if (findDisplay 602 != displayNull) then
- {
- (findDisplay 602) closeDisplay 2;
- };
- /* PREVENT BUILDING NEAR CERTAIN TYPES OF BUILDING */
- _cantBuildNear = [
- //"Land_Dome_Big_F",
- //"Land_Dome_Small_F",
- "Land_Barracks_ruins_F",
- "Land_Barracks_01_camo_F",
- //"Land_Mil_Barracks", //CUP
- //"Land_Mil_Barracks_i", //CUP
- //"Land_Mil_Barracks_L", //CUP
- //"Land_Mil_ControlTower", //CUP
- //"Land_Mil_ControlTower_dam", //CUP
- //"Land_Mil_Guardhouse", //CUP
- //"Land_Mil_House", //CUP
- //"Land_Mil_House_dam", //CUP
- "Land_i_Barracks_V1_F", //Disabled in EBM
- "Land_i_Barracks_V1_dam_F",
- "Land_i_Barracks_V2_F",
- "Land_i_Barracks_V2_dam_F",
- "Land_u_Barracks_V2_F",
- "Land_Hospital_main_F",
- "Land_Hospital_side1_F",
- "Land_Hospital_side2_F",
- "Land_MilOffices_V1_F",
- //"Land_Hangar_F",
- //"Land_Ss_Hanger",
- "Land_Airport_Tower_F", //Disabled in EBM
- "Land_Airport_02_controlTower_F",
- "Land_Cargo_House_V1_F",
- "Land_Cargo_House_V2_F", //Disabled in EBM
- "Land_Cargo_House_V3_F",
- "Land_Cargo_HQ_V1_F",
- "Land_Cargo_HQ_V2_F",
- "Land_Cargo_HQ_V3_F",
- "Land_Cargo_Patrol_V1_F",
- "Land_Cargo_Patrol_V2_F", //Disabled in EBM
- "Land_Cargo_Tower_V1_F",
- "Land_Cargo_Tower_V1_No1_F",
- "Land_Cargo_Tower_V1_No2_F",
- "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", //Disabled in EBM
- "Land_Cargo_Tower_V3_F",
- "Land_Radar_F"
- //"Land_Vez" //CUP
- ];
- _cantBuildDist = 200;
- // Disabled this for now. Use defined locations below to prevent building.
- /*if ({typeOf _x in _cantBuildNear} count nearestObjects[player, _cantBuildNear, _cantBuildDist] > 0) then
- {
- throw "Building near military is disallowed on this server.";
- };*/
- if ({typeOf _x in _cantBuildNear} count nearestObjects[player, _cantBuildNear, _cantBuildDist] > 0 && !(player call ExileClient_util_world_isInTerritory)) then
- {
- throw "Building near military is disallowed on this server.";
- };
- /* PREVENT BUILDING NEAR CERTAIN TYPES OF BUILDING */
- try
- {
- if !((vehicle player) isEqualTo player) then
- {
- throw "You cannot build while in a vehicle.";
- };
- _minimumDistanceToTraderZones = getNumber (missionConfigFile >> "CfgTerritories" >> "minimumDistanceToTraderZones");
- if ([player, _minimumDistanceToTraderZones] call ExileClient_util_world_isTraderZoneInRange) then
- {
- throw "You are too close to a safe zone.";
- };
- if (player call ExileClient_util_world_isInNonConstructionZone) then
- {
- throw "Building is disallowed here on this server.";
- };
- if (player call ExileClient_util_world_isInConcreteMixerZone) then
- {
- throw "You are too close to a concrete mixer zone.";
- };
- _minimumDistanceToSpawnZones = getNumber (missionConfigFile >> "CfgTerritories" >> "minimumDistanceToSpawnZones");
- if ([player, _minimumDistanceToSpawnZones] call ExileClient_util_world_isSpawnZoneInRange) then
- {
- throw "You are too close to a spawn zone.";
- };
- if(_itemClassName isEqualTo "Exile_Item_Flag") then
- {
- _maximumNumberOfTerritoriesPerPlayer = getNumber (missionConfigFile >> "CfgTerritories" >> "maximumNumberOfTerritoriesPerPlayer");
- _numberOfTerritories = player call ExileClient_util_territory_getNumberOfTerritories;
- if (_numberOfTerritories >= _maximumNumberOfTerritoriesPerPlayer) then
- {
- throw "You have reached the maximum number of territories you can own.";
- };
- call ExileClient_gui_setupTerritoryDialog_show;
- }
- else
- {
- [_itemClassName] call ExileClient_construction_beginNewObject;
- };
- }
- catch
- {
- ["ErrorTitleAndText", ["Construction aborted!", _exception]] call ExileClient_gui_toaster_addTemplateToast;
- };
- };
- true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement