public static void Postfix()
        {
            if (uGUI_BuilderMenu.IsOpen() || !Input.GetMouseButton(2) || Builder.isPlacing)
            {
                return;
            }
            if (!Targeting.GetTarget(Player.main.gameObject, 200f, out var result, out _))
            {
                return;
            }
            if (!Targeting.GetRoot(result, out var techType, out var gameObject)
#if SN1
                || !CraftData.IsBuildableTech(techType)
#elif BZ
                || !TechData.GetBuildable(techType)
#endif
                )
            {
                return;
            }
#if SN1
            if (Builder.Begin(gameObject))
            {
                ErrorMessage.AddMessage($"Placing new {techType}");
            }
            else
            {
                Builder.End();
            }
#elif BZ
            CoroutineHost.StartCoroutine(Builder.BeginAsync(techType));
            ErrorMessage.AddMessage($"Placing new {techType}");
#endif
        }
Ejemplo n.º 2
0
        internal static void CreateAllowedTechTypes()
        {
            if (!(AllTechTypes?.Count <= 0))
            {
                return;
            }
            var items = Enum.GetValues(typeof(TechType));

            foreach (TechType techType in items)
            {
                if (BlackList.Contains(techType) || CraftData.IsBuildableTech(techType))
                {
                    continue;
                }
                AllTechTypes.Add(techType);
            }
        }
 public static void Postfix()
 {
     if (!uGUI_BuilderMenu.IsOpen() && Input.GetMouseButton(2) && !Builder.isPlacing)
     {
         if (Targeting.GetTarget(Player.main.gameObject, 200f, out GameObject result, out _))
         {
             if (Targeting.GetRoot(result, out TechType techType, out GameObject gameObject) && CraftData.IsBuildableTech(techType))
             {
                 if (Builder.Begin(gameObject))
                 {
                     ErrorMessage.AddMessage($"Placing new {techType}");
                 }
                 else
                 {
                     Builder.End();
                 }
             }
         }
     }
 }