예제 #1
0
        public PlasteelHighCapTank() : base("PlasteelHighCapTank", "Plasteel Ultra Capacity Tank", "Lightweight tank with high oxygen capacity")
        {
            OnFinishedPatching += () =>
            {
                Main.AddSubstitution(this.TechType, TechType.PlasteelTank);
                Main.AddSubstitution(this.TechType, TechType.HighCapacityTank);
                Main.AddModTechType(this.TechType);
                Reflection.AddCompoundTech(this.TechType, new List <TechType>()
                {
                    TechType.PlasteelTank,
                    TechType.HighCapacityTank
                });
                CoroutineHost.StartCoroutine(PostPatchSetup());

                UnderwaterMotorPatches.AddSpeedModifier(this.TechType, -0.10625f);
                Main.AddCustomOxyExclusion(this.TechType, true, true);
                Main.AddCustomOxyTank(this.TechType, -1f, icon);
            };
        }
        public HighCapacityBooster(string classId = "HighCapacityBooster",
            string friendlyName = "High Capacity Booster Tank",
            string description = "Booster tank with increased oxygen capacity.") : base(classId, friendlyName, description)
        {
            //CoroutineHost.StartCoroutine(PostPatchSetup());
            OnFinishedPatching += () =>
            {
                Main.AddModTechType(this.TechType);
                if (Substitutions != null && Substitutions.Count > 0)
                {
                    foreach (var tt in Substitutions)
                        Main.AddSubstitution(this.TechType, tt);
                }
                if (CompoundUnlocks != null && CompoundUnlocks.Count > 0)
                {
                    Reflection.AddCompoundTech(this.TechType, CompoundUnlocks);
                }

                Main.AddCustomOxyExclusion(this.TechType, true, true);
                Main.AddCustomOxyTank(this.TechType, -1f, icon);
            };
        }
예제 #3
0
        protected virtual IEnumerator PostPatchSetup()
        {
            bool bWaiting = true;

            while (bWaiting)
            {
                if (icon == null || icon == SpriteManager.defaultSprite)
                {
                    icon = SpriteManager.Get(TechType.HighCapacityTank);
                }
                else
                {
                    bWaiting = false;
                }

                yield return(new WaitForSecondsRealtime(0.5f));
            }

            CoroutineTask <GameObject> task = CraftData.GetPrefabForTechTypeAsync(TechType.HighCapacityTank);

            yield return(task);

            var highCapPrefab = task.GetResult();

            if (highCapPrefab != null)
            {
                highCapTank = GameObject.Instantiate(highCapPrefab);
                ModPrefabCache.AddPrefab(highCapTank, false); // This doesn't actually do any caching, but it does disable the prefab without "disabling" it - the prefab doesn't show up in the world [as with SetActive(false)] but it can still be instantiated.
            }
            else
            {
                Log.LogError($"Failed getting prefab for HighCapacityTank");
            }

            Main.AddCustomOxyExclusion(this.TechType, true, true);
            Main.AddCustomOxyTank(this.TechType, -1f, icon);
        }