Exemple #1
0
        ////////////////

        public ColorCartridgePaintRecipe(BetterPaintMod mymod, ColorCartridgeItem myitem) : base(mymod)
        {
            this.AddTile(ModContent.TileType <PaintMixerTile>());

            if (mymod.Config.PaintRecipeGels > 0)
            {
                this.AddIngredient(ItemID.Gel, mymod.Config.PaintRecipeGels);
            }
            if (mymod.Config.PaintRecipePaints > 0)
            {
                this.AddRecipeGroup("ModHelpers:Paints", mymod.Config.PaintRecipePaints);
            }

            this.SetResult(myitem, 1);
        }
Exemple #2
0
        public override void OnCraft(Item item)
        {
            var mymod = (BetterPaintMod)this.mod;

            int item2Idx = ItemHelpers.CreateItem(Main.LocalPlayer.position, item.type, 1, ColorCartridgeItem.Width, ColorCartridgeItem.Height);

            var mycart1 = (ColorCartridgeItem)item.modItem;
            var mycart2 = (ColorCartridgeItem)Main.item[item2Idx].modItem;

            float volume = (this.First.Quantity + this.Second.Quantity) / 2f;
            float shift  = this.Second.Quantity / (this.First.Quantity + this.Second.Quantity);

            Color mix = Color.Lerp(this.First.MyColor, this.Second.MyColor, shift);

            mycart1.SetPaint(mix, volume);
            mycart2.SetPaint(mix, volume);

            this.First  = null;
            this.Second = null;
        }
Exemple #3
0
        ////////////////

        public override int ConsumeItem(int itemType, int numRequired)
        {
            var inv      = Main.LocalPlayer.inventory;
            int cartType = ModContent.ItemType <ColorCartridgeItem>();

            if (itemType != cartType)                   // Won't be invoked, but future-proofing won't hurt
            {
                return(base.ConsumeItem(itemType, numRequired));
            }

            for (int i = 0; i < inv.Length; i++)
            {
                if (inv[i] == null || inv[i].IsAir)
                {
                    continue;
                }
                if (inv[i].type != cartType)
                {
                    continue;
                }

                if (this.First == null)
                {
                    this.First = (ColorCartridgeItem)inv[i].modItem;
                    continue;
                }
                if (this.Second == null)
                {
                    this.Second = (ColorCartridgeItem)inv[i].modItem;
                }
                break;
            }

            if (this.First != null && this.Second == null)
            {
                this.First = null;
            }

            return(base.ConsumeItem(itemType, numRequired));
        }
Exemple #4
0
        public override void ModifyTooltips(List <TooltipLine> tooltips)
        {
            if (!this.IsInitialized)
            {
                return;
            }

            var   mymod   = (BetterPaintMod)this.mod;
            float percent = this.Quantity / mymod.Config.PaintCartridgeCapacity;

            var tip1 = new TooltipLine(this.mod, "BetterPaint: Color Indicator", "Color value: " + PaintBlasterHelpers.ColorString(this.MyColor))
            {
                overrideColor = this.MyColor
            };
            var tip2 = new TooltipLine(this.mod, "BetterPaint: Capacity", "Capacity: " + (int)(percent * 100) + "%")
            {
                overrideColor = ColorCartridgeItem.GetCapacityColor(percent)
            };

            tooltips.Add(tip1);
            tooltips.Add(tip2);
        }
Exemple #5
0
 public ColorCartridgeBlendRecipe(BetterPaintMod mymod, ColorCartridgeItem myitem) : base(mymod)
 {
     this.AddTile(ModContent.TileType <PaintMixerTile>());
     this.AddIngredient(myitem, 2);
     this.SetResult(myitem, 1);
 }