Advertisement
skotracker

ExileClient_construction_beginNewObject

Apr 19th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 3.10 KB | None | 0 0
  1. /**
  2.  * ExileClient_construction_beginExistingObject
  3.  *
  4.  * Edited for Exile by _sinworks
  5.  *
  6.  * Exile Mod
  7.  * www.exilemod.com
  8.  * © 2015 Exile Mod Team
  9.  *
  10.  * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
  11.  * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
  12.  */
  13.  
  14. private["_kitClassName","_previewObjectClassName"];
  15. _kitClassName = _this select 0;
  16. _count = 0;
  17. if (_kitClassName == "Exile_Item_Flag") then {
  18.     _playerUID = getPlayerUID player;
  19.     {
  20.     _flag = _x;
  21.     _buildRights = _flag getVariable ["ExileTerritoryBuildRights", []];
  22.         if(_playerUID in _buildRights)then
  23.         {
  24.             _count = _count + 1;
  25.         };
  26.     } forEach (allMissionObjects "Exile_Construction_Flag_Static");
  27. };
  28. if (_count > 2) then {
  29.     ["ErrorTitleAndText", ["Error", "You are already in the maximum amount of territories, Please leave one to create a new one"]] call ExileClient_gui_toaster_addTemplateToast;
  30. }
  31. else
  32. {
  33.     ExileClientConstructionConfig = ("getText(_x >> 'kitMagazine') == _kitClassName" configClasses(configFile >> "CfgConstruction")) select 0;
  34.     _previewObjectClassName = getText(ExileClientConstructionConfig >> "previewObject");
  35.     ExileClientConstructionSnapToObjectClassNames = (ExileClientConstructionConfig >> "SnapObjects") call Bis_fnc_getCfgSubClasses;
  36.     ExileClientConstructionProcess = 1;
  37.     ExileClientConstructionOffset = [0, 5, 0];
  38.     ExileClientConstructionPosition = [0, 0, 0];
  39.     ExileClientConstructionRotation = 0;
  40.     ExileClientConstructionPitch = 0;
  41.     ExileClientConstructionBank = 0;
  42.     ExileClientConstructionVectorMode = false;
  43.     ExileClientConstructionKitClassName = _kitClassName;
  44.     ExileClientConstructionObjectDisplayName = getText(configFile >> "CfgVehicles" >> _previewObjectClassName >> "displayName");
  45.     if (ExileClientPlayerIsInCombat) then
  46.     {
  47.         ["ErrorTitleAndText", ["Construction aborted!", "You cannot build during a combat."]] call ExileClient_gui_toaster_addTemplateToast;
  48.     }
  49.     else
  50.     {
  51.         ExileClientConstructionMode = 1;
  52.         ExileClientConstructionIsInSelectSnapObjectMode = true;
  53.         ExileClientConstructionSupportSnapMode = count(ExileClientConstructionSnapToObjectClassNames) > 0;
  54.         ExileClientConstructionCurrentSnapToObject = objNull;
  55.         ExileClientConstructionPosition = [getPosATL player, ExileClientConstructionOffset select 1, getDir player] call ExileClient_util_math_getPositionInDirection;
  56.         ExileClientConstructionPosition set[2, ExileClientConstructionOffset select 2];
  57.         {
  58.             player reveal _x;
  59.         }
  60.         forEach (player nearObjects  ["Exile_Construction_Abstract_Static", 20]);
  61.         if((count _this) < 2 )then
  62.         {
  63.             ["buildConstructionRequest", [_previewObjectClassName,ExileClientConstructionPosition]] call ExileClient_system_network_send;
  64.         }
  65.         else
  66.         {
  67.             ["buildTerritoryRequest", [_previewObjectClassName, (ASLtoAGL (ATLtoASL ExileClientConstructionPosition)),_this select 1,_this select 2]] call ExileClient_system_network_send;
  68.         };
  69.     };
  70. };
  71. true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement