diff --git a/GeneralMods/Revitalize/Framework/Configs/ConfigManager.cs b/GeneralMods/Revitalize/Framework/Configs/ConfigManager.cs index e00f08dd..29e52c18 100644 --- a/GeneralMods/Revitalize/Framework/Configs/ConfigManager.cs +++ b/GeneralMods/Revitalize/Framework/Configs/ConfigManager.cs @@ -18,6 +18,7 @@ namespace Revitalize.Framework.Configs public Shops_BlacksmithConfig shops_blacksmithConfig; public FurnitureConfig furnitureConfig; + public ObjectsConfig objectsConfig; /// /// The config file to be used for machines. @@ -30,6 +31,7 @@ namespace Revitalize.Framework.Configs this.shops_blacksmithConfig = Shops_BlacksmithConfig.InitializeConfig(); this.furnitureConfig = FurnitureConfig.InitializeConfig(); this.machinesConfig = GlobalMachineConfig.InitializeConfig(); + this.objectsConfig = ObjectsConfig.InitializeConfig(); } } } diff --git a/GeneralMods/Revitalize/Framework/Configs/GlobalMachineConfig.cs b/GeneralMods/Revitalize/Framework/Configs/GlobalMachineConfig.cs index cd68e7af..3c674f7b 100644 --- a/GeneralMods/Revitalize/Framework/Configs/GlobalMachineConfig.cs +++ b/GeneralMods/Revitalize/Framework/Configs/GlobalMachineConfig.cs @@ -9,10 +9,8 @@ namespace Revitalize.Framework.Configs { public class GlobalMachineConfig { - public bool doMachinesConsumeEnergy; - public double solarPanelNonSunnyDayEnergyMultiplier; public double solarPanelNightEnergyGenerationMultiplier; public bool showMachineNotificationBubble_InventoryFull; diff --git a/GeneralMods/Revitalize/Framework/Configs/ObjectsConfig.cs b/GeneralMods/Revitalize/Framework/Configs/ObjectsConfig.cs new file mode 100644 index 00000000..8fedcf3c --- /dev/null +++ b/GeneralMods/Revitalize/Framework/Configs/ObjectsConfig.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Revitalize.Framework.Configs +{ + public class ObjectsConfig + { + public bool showDyedColorName; + public ObjectsConfig() + { + this.showDyedColorName = true; + } + + public static ObjectsConfig InitializeConfig() + { + if (File.Exists(Path.Combine(ModCore.ModHelper.DirectoryPath, "Configs", "ObjectsConfig.json"))) + return ModCore.ModHelper.Data.ReadJsonFile(Path.Combine("Configs", "ObjectsConfig.json")); + else + { + ObjectsConfig Config = new ObjectsConfig(); + ModCore.ModHelper.Data.WriteJsonFile(Path.Combine("Configs", "ObjectsConfig.json"), Config); + return Config; + } + } + + } +} diff --git a/GeneralMods/Revitalize/Framework/Enums/Enums.cs b/GeneralMods/Revitalize/Framework/Enums/Enums.cs index dcc95fcb..4e6573b0 100644 --- a/GeneralMods/Revitalize/Framework/Enums/Enums.cs +++ b/GeneralMods/Revitalize/Framework/Enums/Enums.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Microsoft.Xna.Framework; namespace Revitalize.Framework { diff --git a/GeneralMods/Revitalize/Framework/Illuminate/ColorsList.cs b/GeneralMods/Revitalize/Framework/Illuminate/ColorsList.cs new file mode 100644 index 00000000..7a80a54f --- /dev/null +++ b/GeneralMods/Revitalize/Framework/Illuminate/ColorsList.cs @@ -0,0 +1,298 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; + +namespace Revitalize.Framework.Illuminate +{ + public class ColorsList + { + public static NamedColor AliceBlue = new NamedColor("Alice Blue", new Color(15, 7, 0, 255).Invert()); + + public static NamedColor AntiqueWhite = new NamedColor("Antique White", 5, 20, 40, 255); + + public static NamedColor Aqua = new NamedColor("Aqua", 255, 0, 0, 255); + + public static NamedColor Aquamarine = new NamedColor("Aquamarine", 128, 0, 43, 255); + + /// A whiteish sort of color witha hint of blue + public static NamedColor Azure = new NamedColor("Azure", 15, 0, 0, 255); + + public static NamedColor Beige = new NamedColor("Beige", 10, 10, 35, 255); + + public static NamedColor Bisque = new NamedColor("Bisque", 0, 27, 59, 255); + + public static NamedColor Black = new NamedColor("Black", 255, 255, 255, 255); + + public static NamedColor BlanchedAlmond = new NamedColor("Blanched Almond", 0, 20, 40, 255); + + public static NamedColor Blue = new NamedColor("Blue", 255, 255, 0, 255); + + public static NamedColor BlueViolet = new NamedColor("Blue Violet", 117, 212, 29, 255); + + public static NamedColor Brown = new NamedColor("Brown", 90, 213, 213, 255); + + public static NamedColor BurlyWood = new NamedColor("Burly Wood", 33, 71, 120, 255); + + public static NamedColor CadetBlue = new NamedColor("Cadet Blue", 160, 97, 95, 255); + + public static NamedColor Chartreuse = new NamedColor("Chartreuse", 128, 0, 255, 255); + + public static NamedColor Chocolate = new NamedColor("Chocolate", 45, 150, 225, 255); + + public static NamedColor Coral = new NamedColor("Coral", 0, 128, 175, 255); + + public static NamedColor CornflowerBlue = new NamedColor("Cornflower Blue", 155, 106, 18, 255); + + /// A yellowish color. + public static NamedColor Cornsilk = new NamedColor("Cornsilk", 0, 7, 35, 255); + + public static NamedColor Crimson = new NamedColor("Crimson", 35, 235, 195, 255); + + public static NamedColor Cyan = new NamedColor("Cyan",255, 0, 0, 255); + + public static NamedColor DarkBlue = new NamedColor("Dark Blue", 255, 255, 116, 255); + + public static NamedColor DarkCyan = new NamedColor("Dark Cyan", 255, 114, 114, 255); + + public static NamedColor DarkGoldenRod = new NamedColor("Dark Goldenrod", 71, 121, 244, 255); + + public static NamedColor DarkGray = new NamedColor("Dark Gray", 86, 86, 86, 255); + + public static NamedColor DarkGreen = new NamedColor("Dark Green", 255, 155, 255, 255); + + public static NamedColor DarkKhaki = new NamedColor("Dark Khaki", 66, 72, 148, 255); + + public static NamedColor DarkMagenta = new NamedColor("Dark Magenta", 116, 255, 116, 255); + + public static NamedColor DarkOliveGreen = new NamedColor("Dark Olive Green", 170, 148, 208, 255); + + public static NamedColor DarkOrange = new NamedColor("Dark Orange", 0, 115, 255, 255); + + public static NamedColor DarkOrchid = new NamedColor("Dark Orchid", 102, 105, 51, 255); + + public static NamedColor DarkRed = new NamedColor("Dark Red", 116, 255, 255, 255); + + public static NamedColor DarkSalmon = new NamedColor("Dark Salmon", 22, 105, 133, 255); + + public static NamedColor DarkSeaGreen = new NamedColor("Dark Sea Green", 112, 67, 112, 255); + + public static NamedColor DarkSlateBlue = new NamedColor("Dark Slate Blue", 183, 194, 116, 255); + + public static NamedColor DarkSlateGray = new NamedColor("Dark Slate Gray", 208, 176, 176, 255); + + public static NamedColor DarkTurquoise = new NamedColor("Dark Turquoise", 255, 49, 46, 255); + + public static NamedColor DarkViolet = new NamedColor("Dark Violet", 107, 255, 44, 255); + + public static NamedColor DeepPink = new NamedColor("Deep Pink", 0, 235, 108, 255); + + public static NamedColor DeepSkyBlue = new NamedColor("Deep Sky Blue", 255, 64, 0, 255); + + public static NamedColor DimGray = new NamedColor("Dim Gray", 150, 150, 150, 255); + + public static NamedColor DodgerBlue = new NamedColor("Dodger Blue", 225, 111, 0, 255); + + public static NamedColor FireBrick = new NamedColor("FireBrick",77, 221, 221, 255); + + public static NamedColor FloralWhite = new NamedColor("Floral White", 0, 5, 15, 255); + + public static NamedColor ForestGreen = new NamedColor("Forest Green", 221, 116, 221, 255); + + public static NamedColor Fuchsia = new NamedColor("Fuchsia", 0, 255, 0, 255); + + /// More of a white-ish color + public static NamedColor Gainsboro = new NamedColor("Gainsboro", 35, 35, 35, 255); + + public static NamedColor GhostWhite = new NamedColor("Ghost White", 7, 7, 0); + + public static NamedColor Gold = new NamedColor("Gold", 0, 40, 255, 255); + + public static NamedColor GoldenRod = new NamedColor("Golden Rod", 37, 90, 223, 255); + + public static NamedColor Gray = new NamedColor("Gray", 127, 127, 127, 255); + + public static NamedColor Green = new NamedColor("Green", 255, 127, 255, 255); + + public static NamedColor GreenYellow = new NamedColor("Green Yellow", 82, 0, 208, 255); + + public static NamedColor HoneyDew = new NamedColor("Honey Dew", 15, 0, 15, 255); + + public static NamedColor HotPink = new NamedColor("Hot Pink", 0, 140, 75, 255); + + public static NamedColor IndianRed = new NamedColor("Indian Red", 40, 163, 163, 255); + + public static NamedColor Indigo = new NamedColor("Indigo", 180, 255, 125, 255); + + public static NamedColor Ivory = new NamedColor("Ivory", 0, 0, 15, 255); + + public static NamedColor Khaki = new NamedColor("Khaki", 15, 25, 115, 255); + + public static NamedColor Lavender = new NamedColor("Lavender", 25, 25, 5, 255); + + public static NamedColor LavenderBlush = new NamedColor("Lavender Blush", 0, 15, 10, 255); + + public static NamedColor LawnGreen = new NamedColor("Lawn Green", 131, 3, 255, 255); + + public static NamedColor LemonChiffron = new NamedColor("Lemon Chiffron", 0, 5, 50, 255); + + public static NamedColor LightBlue = new NamedColor("Light Blue",82, 39, 25, 255); + + public static NamedColor LightCoral = new NamedColor("Light Coral", 15, 127, 127, 255); + + public static NamedColor LightCyan = new NamedColor("Light Cyan", 31, 0, 0, 255); + + public static NamedColor LightGoldenRodYellow = new NamedColor("Light Goldenrod Yellow", 5, 5, 45, 255); + + public static NamedColor LightGray = new NamedColor("Light Gray", 44, 44, 44, 255); + + public static NamedColor LightGreen = new NamedColor("Light Green", 111, 17, 111, 255); + + public static NamedColor LightPink = new NamedColor("Light Pink", 0, 73, 62, 255); + + public static NamedColor LightSalmon = new NamedColor("Light Salmon", 0, 95, 133, 255); + + public static NamedColor LightSeaGreen = new NamedColor("Ligh tSea Green", 223, 77, 85, 255); + + public static NamedColor LightSkyBlue = new NamedColor("Light Sky Blue", 120, 49, 5, 255); + + public static NamedColor LightSlateGray = new NamedColor("Light Slate Gray", 146, 119, 102, 255); + + public static NamedColor LightSteelBlue = new NamedColor("Light Steel Blue", 79, 59, 33, 255); + + public static NamedColor LightYellow = new NamedColor("Light Yellow", 0, 0, 31, 255); + + public static NamedColor Lime = new NamedColor("Lime", 255, 0, 255, 255); + + public static NamedColor LimeGreen = new NamedColor("Lime Green", 105, 50, 105, 255); + + public static NamedColor Linen = new NamedColor("Linen", 5, 15, 25, 255); + + public static NamedColor Magenta = new NamedColor("Magenta", 0, 255, 0, 255); + + public static NamedColor Maroon = new NamedColor("Maroon", 127, 255, 255, 0); + + public static NamedColor MediumAquaMarine = new NamedColor("Medium Aqua Marine", 153, 50, 85, 255); + + public static NamedColor MediumBlue = new NamedColor("Medium Blue",255, 255, 50, 255); + + public static NamedColor MediumOrchid = new NamedColor("Medium Orchid", 69, 170, 44, 255); + + public static NamedColor MediumPurple = new NamedColor("Medium Purple", 108, 143, 36, 255); + + public static NamedColor MediumSeaGreen = new NamedColor("Medium Sea Green", 195, 78, 142, 255); + + public static NamedColor MediumSlateBlue = new NamedColor("Medium Slate Blue", 132, 151, 17, 255); + + public static NamedColor MediumSpringGreen = new NamedColor("Medium Spring Green", 255, 5, 101, 255); + + public static NamedColor MediumTurquoise = new NamedColor("Medium Turquoise", 183, 46, 51, 255); + + public static NamedColor MediumVioletRed = new NamedColor("Medium Violet Red", 46, 234, 122, 255); + + public static NamedColor MidnightBlue = new NamedColor("Midnight Blue", 230, 230, 143, 255); + + public static NamedColor MintCream = new NamedColor("Mint Cream", 10, 0, 5, 255); + + public static NamedColor MistyRose = new NamedColor("Misty Rose", 0, 27, 30, 255); + + public static NamedColor Moccasin = new NamedColor("Moccasin", 0, 33, 82, 255); + + public static NamedColor NavajoWhite = new NamedColor("Navajo White", 0, 33, 82, 255); + + public static NamedColor Navy = new NamedColor("Navy", 255, 255, 127, 255); + + public static NamedColor OldLace = new NamedColor("Old Lace", 2, 10, 25, 255); + + public static NamedColor Olive = new NamedColor("Olive", 127, 127, 255, 255); + + public static NamedColor OliveDrab = new NamedColor("Olive Drab", 148, 113, 220, 255); + + public static NamedColor Orange = new NamedColor("Orange", 0, 90, 255, 255); + + public static NamedColor OrangeRed = new NamedColor("Orange Red", 0, 186, 255, 255); + + public static NamedColor Orchid = new NamedColor("Orchid", 37, 143, 41, 255); + + public static NamedColor PaleGoldenRod = new NamedColor("Pale Golden Rod", 17, 23, 85, 255); + + public static NamedColor PaleGreen = new NamedColor("Pale Green", 103, 4, 103, 255); + + public static NamedColor PaleTurquoise = new NamedColor("Pale Turquoise", 80, 17, 17, 255); + + public static NamedColor PaleVioletRed = new NamedColor("Pale Violet Red", 36, 143, 108, 255); + + public static NamedColor PapayaWhip = new NamedColor("Papaya Whip", 0, 16, 42, 255); + + public static NamedColor PeachPuff = new NamedColor("Peach Puff", 0, 37, 70, 255); + + public static NamedColor Peru = new NamedColor("Peru", 50, 122, 192, 255); + + public static NamedColor Pink = new NamedColor("Pink", 0, 63, 52, 255); + + public static NamedColor Plum = new NamedColor("Plum", 34, 95, 34, 255); + + public static NamedColor PowderBlue = new NamedColor("Powder Blue", 79, 31, 25, 255); + + public static NamedColor Purple = new NamedColor("Purple", 127, 255, 127, 255); + + public static NamedColor RebeccaPurple = new NamedColor("Rebecca Purple", 153, 104, 102, 255); + + public static NamedColor Red = new NamedColor("Red", 0, 255, 255, 255); + + public static NamedColor RosyBrown = new NamedColor("Rosy Brown", 67, 112, 112, 255); + + public static NamedColor RoyalBlue = new NamedColor("Royal Blue", 190, 150, 30, 255); + + public static NamedColor SaddleBrown = new NamedColor("Saddle Brown", 115, 186, 231, 255); + + public static NamedColor Salmon = new NamedColor("Salmon", 5, 127, 141, 255); + + public static NamedColor SandyBrown = new NamedColor("Sandy Brown", 11, 91, 159, 255); + + public static NamedColor SeaGreen = new NamedColor("Sea Green", 209, 116, 168, 255); + + public static NamedColor SeaShell = new NamedColor("Sea Shell", 0, 10, 17, 255); + + public static NamedColor Sienna = new NamedColor("Sienna", 95, 173, 210, 255); + + public static NamedColor Silver = new NamedColor("Silver", 63, 63, 63, 255); + + public static NamedColor SkyBlue = new NamedColor("Sky Blue", 120, 49, 20, 255); + + public static NamedColor SlateBlue = new NamedColor("Slate Blue", 149, 165, 50, 255); + + public static NamedColor SlateGray = new NamedColor("Slate Gray", 143, 127, 111, 255); + + public static NamedColor Snow = new NamedColor("Snow", 0, 5, 5, 255); + + public static NamedColor SpringGreen = new NamedColor("Spring Green", 255, 0, 128, 255); + + public static NamedColor SteelBlue = new NamedColor("Steel Blue", 185, 125, 75, 255); + + public static NamedColor Tan = new NamedColor("Tan", 45, 75, 115, 255); + + public static NamedColor Teal = new NamedColor("Teal", 255, 127, 127, 255); + + public static NamedColor Thistle = new NamedColor("Thistle", 39, 64, 39, 255); + + public static NamedColor Tomato = new NamedColor("Tomato", 0, 156, 184, 255); + + public static NamedColor Turquoise = new NamedColor("Turquoise", 191, 31, 47, 255); + + public static NamedColor Violet = new NamedColor("Violet", 17, 125, 17, 255); + + public static NamedColor Wheat = new NamedColor("Wheat", 10, 33, 76, 255); + + public static NamedColor White = new NamedColor("White", 0, 0, 0, 255); + + public static NamedColor WhiteSmoke = new NamedColor("White Smoke", 10, 10, 10, 255); + + public static NamedColor Yellow = new NamedColor("Yellow", 0, 0, 255); + + public static NamedColor YellowGreen = new NamedColor("Yellow Green", 101, 50, 205, 255); + + } +} diff --git a/GeneralMods/Revitalize/Framework/Illuminate/NamedColor.cs b/GeneralMods/Revitalize/Framework/Illuminate/NamedColor.cs new file mode 100644 index 00000000..22d737e7 --- /dev/null +++ b/GeneralMods/Revitalize/Framework/Illuminate/NamedColor.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; + +namespace Revitalize.Framework.Illuminate +{ + public class NamedColor + { + public string name; + public Color color; + + public NamedColor() + { + + } + + public NamedColor(string Name, Color Color) + { + this.name = Name; + this.color = Color; + } + + public NamedColor(Color Color) + { + this.name = ""; + this.color = Color; + } + + public NamedColor(string Name, int r, int g, int b, int a = 255) + { + this.name = Name; + this.color = new Color(r, g, b, a); + } + + public Color getColor() + { + return this.color; + } + + public Color getInvertedColor() + { + return this.color.Invert(); + } + } +} diff --git a/GeneralMods/Revitalize/Framework/Objects/BasicItemInformation.cs b/GeneralMods/Revitalize/Framework/Objects/BasicItemInformation.cs index b43599b6..122d956e 100644 --- a/GeneralMods/Revitalize/Framework/Objects/BasicItemInformation.cs +++ b/GeneralMods/Revitalize/Framework/Objects/BasicItemInformation.cs @@ -218,10 +218,20 @@ namespace Revitalize.Framework.Objects private Color _drawColor; - public Color drawColor + public Color DrawColor { get { + if (this._dyedColor != null) + { + if (this._dyedColor.color != null) + { + if (this._dyedColor.color.A != 0) + { + return new Color(this._drawColor.R * this._dyedColor.color.R, this._drawColor.G * this._dyedColor.color.G, this._drawColor.B * this._dyedColor.color.B, 255); + } + } + } return this._drawColor; } set @@ -332,6 +342,21 @@ namespace Revitalize.Framework.Objects } } + private NamedColor _dyedColor; + public NamedColor DyedColor { + + get + { + return this._dyedColor; + } + set + { + this._dyedColor = value; + this.requiresUpdate = true; + } + + } + [JsonIgnore] public bool requiresUpdate; public BasicItemInformation() @@ -347,7 +372,7 @@ namespace Revitalize.Framework.Objects this.animationManager = new AnimationManager(); this.drawPosition = Vector2.Zero; - this.drawColor = Color.White; + this.DrawColor = Color.White; this.inventory = new InventoryManager(); this.lightManager = new LightManager(); @@ -358,7 +383,7 @@ namespace Revitalize.Framework.Objects this._alwaysDrawAbovePlayer = false; } - public BasicItemInformation(string name, string id, string description, string categoryName, Color categoryColor,int edibility, int fragility, bool isLamp, int price, bool canBeSetOutdoors, bool canBeSetIndoors, Texture2D texture, AnimationManager animationManager, Color drawColor, bool ignoreBoundingBox, InventoryManager Inventory, LightManager Lights,Energy.EnergyManager EnergyManager=null,bool AlwaysDrawAbovePlayer=false) + public BasicItemInformation(string name, string id, string description, string categoryName, Color categoryColor,int edibility, int fragility, bool isLamp, int price, bool canBeSetOutdoors, bool canBeSetIndoors, Texture2D texture, AnimationManager animationManager, Color drawColor, bool ignoreBoundingBox, InventoryManager Inventory, LightManager Lights,Energy.EnergyManager EnergyManager=null,bool AlwaysDrawAbovePlayer=false,NamedColor DyedColor=null) { this.name = name; this.id = id; @@ -381,7 +406,7 @@ namespace Revitalize.Framework.Objects } this.drawPosition = Vector2.Zero; - this.drawColor = drawColor; + this.DrawColor = drawColor; this.ignoreBoundingBox = ignoreBoundingBox; this.inventory = Inventory ?? new InventoryManager(); this.lightManager = Lights ?? new LightManager(); @@ -390,6 +415,8 @@ namespace Revitalize.Framework.Objects this.EnergyManager = EnergyManager ?? new Energy.EnergyManager(); this.AlwaysDrawAbovePlayer = AlwaysDrawAbovePlayer; + + } /// @@ -407,7 +434,7 @@ namespace Revitalize.Framework.Objects /// public BasicItemInformation Copy() { - return new BasicItemInformation(this.name, this.id,this.description, this.categoryName, this.categoryColor, this.edibility, this.fragility, this.isLamp, this.price, this.canBeSetOutdoors, this.canBeSetIndoors, this.animationManager.getTexture(), this.animationManager, this.drawColor, this.ignoreBoundingBox, this._inventory.Copy(), this._lightManager.Copy(),this._energyManager.Copy(),this.AlwaysDrawAbovePlayer); + return new BasicItemInformation(this.name, this.id,this.description, this.categoryName, this.categoryColor, this.edibility, this.fragility, this.isLamp, this.price, this.canBeSetOutdoors, this.canBeSetIndoors, this.animationManager.getTexture(), this.animationManager, this.DrawColor, this.ignoreBoundingBox, this._inventory.Copy(), this._lightManager.Copy(),this._energyManager.Copy(),this.AlwaysDrawAbovePlayer); } public bool requiresSyncUpdate() @@ -449,6 +476,32 @@ namespace Revitalize.Framework.Objects this._lightManager.requiresUpdate = false; this._energyManager.requiresUpdate = false; } + + /// + /// Gets the name attached to the dyed color. + /// + /// + public string getDyedColorName() + { + if (this.DyedColor == null) + { + return ""; + } + if (this.DyedColor.color == null) + { + return ""; + } + if (this.DyedColor.color.A == 0) + { + return ""; + } + else + { + return this._dyedColor.name; + } + } + + } } diff --git a/GeneralMods/Revitalize/Framework/Objects/CraftingTables/CraftingTableTile.cs b/GeneralMods/Revitalize/Framework/Objects/CraftingTables/CraftingTableTile.cs index 7b7a239d..d917b346 100644 --- a/GeneralMods/Revitalize/Framework/Objects/CraftingTables/CraftingTableTile.cs +++ b/GeneralMods/Revitalize/Framework/Objects/CraftingTables/CraftingTableTile.cs @@ -220,7 +220,7 @@ namespace Revitalize.Framework.Objects.CraftingTables if (this.animationManager.getExtendedTexture() == null) ModCore.ModMonitor.Log("Tex Extended is null???"); - spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(y * Game1.tileSize) / 10000f)); + spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(y * Game1.tileSize) / 10000f)); // Log.AsyncG("ANIMATION IS NULL?!?!?!?!"); } @@ -240,7 +240,7 @@ namespace Revitalize.Framework.Objects.CraftingTables { addedDepth += 1.0f; } - this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.Flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((y + addedDepth) * Game1.tileSize) / 10000f) + .00001f); + this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.Flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((y + addedDepth) * Game1.tileSize) / 10000f) + .00001f); try { this.animationManager.tickAnimation(); diff --git a/GeneralMods/Revitalize/Framework/Objects/CustomObject.cs b/GeneralMods/Revitalize/Framework/Objects/CustomObject.cs index 1ff0100d..8b56fa99 100644 --- a/GeneralMods/Revitalize/Framework/Objects/CustomObject.cs +++ b/GeneralMods/Revitalize/Framework/Objects/CustomObject.cs @@ -10,6 +10,7 @@ using StardewValley; using StardewValley.Objects; using Revitalize.Framework.Utilities; using Revitalize.Framework.Energy; +using Revitalize.Framework.Illuminate; namespace Revitalize.Framework.Objects { @@ -499,7 +500,7 @@ namespace Revitalize.Framework.Objects this.updateInfo(); if (x <= -1) { - spriteBatch.Draw(this.info.animationManager.getTexture(), Game1.GlobalToLocal(Game1.viewport, this.info.drawPosition), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(this.TileLocation.Y * Game1.tileSize) / 10000f)); + spriteBatch.Draw(this.info.animationManager.getTexture(), Game1.GlobalToLocal(Game1.viewport, this.info.drawPosition), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(this.TileLocation.Y * Game1.tileSize) / 10000f)); } else { @@ -509,7 +510,7 @@ namespace Revitalize.Framework.Objects if (this.animationManager.getExtendedTexture() == null) ModCore.ModMonitor.Log("Tex Extended is null???"); - spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(this.TileLocation.Y * Game1.tileSize) / 10000f)); + spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(this.TileLocation.Y * Game1.tileSize) / 10000f)); // Log.AsyncG("ANIMATION IS NULL?!?!?!?!"); } @@ -519,7 +520,7 @@ namespace Revitalize.Framework.Objects int addedDepth = 0; if (this.info.ignoreBoundingBox) addedDepth++; if (Revitalize.ModCore.playerInfo.sittingInfo.SittingObject == this) addedDepth++; - this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((this.TileLocation.Y + addedDepth) * Game1.tileSize) / 10000f)); + this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((this.TileLocation.Y + addedDepth) * Game1.tileSize) / 10000f)); try { this.animationManager.tickAnimation(); @@ -546,7 +547,7 @@ namespace Revitalize.Framework.Objects if (this.animationManager.getExtendedTexture() == null) ModCore.ModMonitor.Log("Tex Extended is null???"); - spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(xNonTile), yNonTile)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.Flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, layerDepth)); + spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(xNonTile), yNonTile)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.Flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, layerDepth)); // Log.AsyncG("ANIMATION IS NULL?!?!?!?!"); } @@ -556,7 +557,7 @@ namespace Revitalize.Framework.Objects int addedDepth = 0; if (this.info.ignoreBoundingBox) addedDepth++; if (Revitalize.ModCore.playerInfo.sittingInfo.SittingObject == this) addedDepth++; - this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(xNonTile), yNonTile)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.Flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, layerDepth)); + this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(xNonTile), yNonTile)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.Flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, layerDepth)); try { this.animationManager.tickAnimation(); @@ -586,7 +587,7 @@ namespace Revitalize.Framework.Objects float num = this.Quality < 4 ? 0.0f : (float)((Math.Cos((double)Game1.currentGameTime.TotalGameTime.Milliseconds * Math.PI / 512.0) + 1.0) * 0.0500000007450581); spriteBatch.Draw(Game1.mouseCursors, location + new Vector2(12f, (float)(Game1.tileSize - 12) + num), new Microsoft.Xna.Framework.Rectangle?(this.Quality < 4 ? new Microsoft.Xna.Framework.Rectangle(338 + (this.Quality - 1) * 8, 400, 8, 8) : new Microsoft.Xna.Framework.Rectangle(346, 392, 8, 8)), Color.White * transparency, 0.0f, new Vector2(4f, 4f), (float)(3.0 * (double)scaleSize * (1.0 + (double)num)), SpriteEffects.None, layerDepth); } - spriteBatch.Draw(this.displayTexture, location + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * transparency, 0f, new Vector2((float)(this.animationManager.currentAnimation.sourceRectangle.Width / 2), (float)(this.animationManager.currentAnimation.sourceRectangle.Height)), scaleSize * 4f, SpriteEffects.None, layerDepth); + spriteBatch.Draw(this.displayTexture, location + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * transparency, 0f, new Vector2((float)(this.animationManager.currentAnimation.sourceRectangle.Width / 2), (float)(this.animationManager.currentAnimation.sourceRectangle.Height)), scaleSize * 4f, SpriteEffects.None, layerDepth); } /// What happens when the object is drawn when held by a player. @@ -600,11 +601,11 @@ namespace Revitalize.Framework.Objects if (this.displayTexture == null) Revitalize.ModCore.log("Display texture is null"); if (f.ActiveObject.bigCraftable.Value) { - spriteBatch.Draw(this.displayTexture, objectPosition, this.animationManager.currentAnimation.sourceRectangle, this.info.drawColor, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, Math.Max(0f, (float)(f.getStandingY() + 2) / 10000f)); + spriteBatch.Draw(this.displayTexture, objectPosition, this.animationManager.currentAnimation.sourceRectangle, this.info.DrawColor, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, Math.Max(0f, (float)(f.getStandingY() + 2) / 10000f)); return; } - spriteBatch.Draw(this.displayTexture, objectPosition, this.animationManager.currentAnimation.sourceRectangle, this.info.drawColor, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, Math.Max(0f, (float)(f.getStandingY() + 2) / 10000f)); + spriteBatch.Draw(this.displayTexture, objectPosition, this.animationManager.currentAnimation.sourceRectangle, this.info.DrawColor, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, Math.Max(0f, (float)(f.getStandingY() + 2) / 10000f)); if (f.ActiveObject != null && f.ActiveObject.Name.Contains("=")) { spriteBatch.Draw(this.displayTexture, objectPosition + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), this.animationManager.currentAnimation.sourceRectangle, Color.White, 0f, new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), (float)Game1.pixelZoom + Math.Abs(Game1.starCropShimmerPause) / 8f, SpriteEffects.None, Math.Max(0f, (float)(f.getStandingY() + 2) / 10000f)); @@ -631,7 +632,7 @@ namespace Revitalize.Framework.Objects } if (this.displayTexture == null) Revitalize.ModCore.log("Display texture is null"); - spriteBatch.Draw(this.displayTexture, objectPosition, this.animationManager.currentAnimation.sourceRectangle, this.info.drawColor, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None,Depth); + spriteBatch.Draw(this.displayTexture, objectPosition, this.animationManager.currentAnimation.sourceRectangle, this.info.DrawColor, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None,Depth); //base.drawWhenHeld(spriteBatch, objectPosition, f); } @@ -663,6 +664,10 @@ namespace Revitalize.Framework.Objects public string getDisplayNameFromStringsFile(string objectID) { + if (ModCore.Configs.objectsConfig.showDyedColorName) + { + return this.info.getDyedColorName() + this.info.name; + } //Load in a file that has all object names referenced here or something. return this.info.name; } @@ -701,6 +706,20 @@ namespace Revitalize.Framework.Objects } } + /// + /// + /// + /// + public virtual void dyeColor(NamedColor DyeColor) + { + this.info.DyedColor = DyeColor; + } + + public virtual void eraseDye() + { + this.info.DyedColor = new NamedColor("", new Color(0, 0, 0, 0)); + } + //~~~~~~~~~~~~~~~~~~~~~~~~~// // PyTk Functions // //~~~~~~~~~~~~~~~~~~~~~~~~~// diff --git a/GeneralMods/Revitalize/Framework/Objects/Extras/ArcadeCabinetTile.cs b/GeneralMods/Revitalize/Framework/Objects/Extras/ArcadeCabinetTile.cs index 737c032b..3e1d3cb8 100644 --- a/GeneralMods/Revitalize/Framework/Objects/Extras/ArcadeCabinetTile.cs +++ b/GeneralMods/Revitalize/Framework/Objects/Extras/ArcadeCabinetTile.cs @@ -277,7 +277,7 @@ namespace Revitalize.Framework.Objects.Extras if (this.animationManager.getExtendedTexture() == null) ModCore.ModMonitor.Log("Tex Extended is null???"); - spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(y * Game1.tileSize) / 10000f)); + spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(y * Game1.tileSize) / 10000f)); // Log.AsyncG("ANIMATION IS NULL?!?!?!?!"); } @@ -296,7 +296,7 @@ namespace Revitalize.Framework.Objects.Extras { addedDepth += 1.0f; } - this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((y + addedDepth) * Game1.tileSize) / 10000f) + .00001f); + this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((y + addedDepth) * Game1.tileSize) / 10000f) + .00001f); try { this.animationManager.tickAnimation(); diff --git a/GeneralMods/Revitalize/Framework/Objects/Extras/TrashCanTile.cs b/GeneralMods/Revitalize/Framework/Objects/Extras/TrashCanTile.cs index 2363542e..48c37583 100644 --- a/GeneralMods/Revitalize/Framework/Objects/Extras/TrashCanTile.cs +++ b/GeneralMods/Revitalize/Framework/Objects/Extras/TrashCanTile.cs @@ -304,7 +304,7 @@ namespace Revitalize.Framework.Objects.Extras if (this.animationManager.getExtendedTexture() == null) ModCore.ModMonitor.Log("Tex Extended is null???"); - spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(y * Game1.tileSize) / 10000f)); + spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(y * Game1.tileSize) / 10000f)); // Log.AsyncG("ANIMATION IS NULL?!?!?!?!"); } @@ -324,7 +324,7 @@ namespace Revitalize.Framework.Objects.Extras { addedDepth += 1.0f; } - this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.Flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((y + addedDepth) * Game1.tileSize) / 10000f) + .00001f); + this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.Flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((y + addedDepth) * Game1.tileSize) / 10000f) + .00001f); try { this.animationManager.tickAnimation(); diff --git a/GeneralMods/Revitalize/Framework/Objects/Furniture/ChairTileComponent.cs b/GeneralMods/Revitalize/Framework/Objects/Furniture/ChairTileComponent.cs index c58afba3..93e2581e 100644 --- a/GeneralMods/Revitalize/Framework/Objects/Furniture/ChairTileComponent.cs +++ b/GeneralMods/Revitalize/Framework/Objects/Furniture/ChairTileComponent.cs @@ -267,7 +267,7 @@ namespace Revitalize.Framework.Objects.Furniture if (this.animationManager.getExtendedTexture() == null) ModCore.ModMonitor.Log("Tex Extended is null???"); - spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(y * Game1.tileSize) / 10000f)); + spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(y * Game1.tileSize) / 10000f)); // Log.AsyncG("ANIMATION IS NULL?!?!?!?!"); if (this.framesUntilNextRotation > 0) this.framesUntilNextRotation--; @@ -290,7 +290,7 @@ namespace Revitalize.Framework.Objects.Furniture { addedDepth += 1.0f; } - this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((y + addedDepth) * Game1.tileSize) / 10000f) + .00001f); + this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((y + addedDepth) * Game1.tileSize) / 10000f) + .00001f); if (this.framesUntilNextRotation > 0) this.framesUntilNextRotation--; if (this.framesUntilNextRotation < 0) this.framesUntilNextRotation = 0; diff --git a/GeneralMods/Revitalize/Framework/Objects/Furniture/LampTileComponent.cs b/GeneralMods/Revitalize/Framework/Objects/Furniture/LampTileComponent.cs index f3a2072a..809b45cf 100644 --- a/GeneralMods/Revitalize/Framework/Objects/Furniture/LampTileComponent.cs +++ b/GeneralMods/Revitalize/Framework/Objects/Furniture/LampTileComponent.cs @@ -200,7 +200,7 @@ namespace Revitalize.Framework.Objects.Furniture if (this.animationManager.getExtendedTexture() == null) ModCore.ModMonitor.Log("Tex Extended is null???"); - spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(y * Game1.tileSize) / 10000f)); + spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(y * Game1.tileSize) / 10000f)); // Log.AsyncG("ANIMATION IS NULL?!?!?!?!"); } @@ -225,7 +225,7 @@ namespace Revitalize.Framework.Objects.Furniture { addedDepth += 5f; } - this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((yDepth + addedDepth) * Game1.tileSize) / 10000f) + .00001f); + this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((yDepth + addedDepth) * Game1.tileSize) / 10000f) + .00001f); try { this.animationManager.tickAnimation(); diff --git a/GeneralMods/Revitalize/Framework/Objects/Furniture/RugTileComponent.cs b/GeneralMods/Revitalize/Framework/Objects/Furniture/RugTileComponent.cs index 04cc22df..405aeedf 100644 --- a/GeneralMods/Revitalize/Framework/Objects/Furniture/RugTileComponent.cs +++ b/GeneralMods/Revitalize/Framework/Objects/Furniture/RugTileComponent.cs @@ -116,7 +116,7 @@ namespace Revitalize.Framework.Objects.Furniture if (this.animationManager.getExtendedTexture() == null) ModCore.ModMonitor.Log("Tex Extended is null???"); - spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(y * Game1.tileSize) / 10000f)); + spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(y * Game1.tileSize) / 10000f)); // Log.AsyncG("ANIMATION IS NULL?!?!?!?!"); } @@ -124,7 +124,7 @@ namespace Revitalize.Framework.Objects.Furniture { //Log.AsyncC("Animation Manager is working!"); float addedDepth = 0; - this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, 0.0001f)); + this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, 0.0001f)); try { this.animationManager.tickAnimation(); diff --git a/GeneralMods/Revitalize/Framework/Objects/Furniture/StorageFurnitureTile.cs b/GeneralMods/Revitalize/Framework/Objects/Furniture/StorageFurnitureTile.cs index 157d5a6e..96175166 100644 --- a/GeneralMods/Revitalize/Framework/Objects/Furniture/StorageFurnitureTile.cs +++ b/GeneralMods/Revitalize/Framework/Objects/Furniture/StorageFurnitureTile.cs @@ -173,7 +173,7 @@ namespace Revitalize.Framework.Objects.Furniture if (this.animationManager.getExtendedTexture() == null) ModCore.ModMonitor.Log("Tex Extended is null???"); - spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(y * Game1.tileSize) / 10000f)); + spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(y * Game1.tileSize) / 10000f)); // Log.AsyncG("ANIMATION IS NULL?!?!?!?!"); } @@ -192,7 +192,7 @@ namespace Revitalize.Framework.Objects.Furniture { addedDepth += 1.0f; } - this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((y + addedDepth) * Game1.tileSize) / 10000f) + .00001f); + this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((y + addedDepth) * Game1.tileSize) / 10000f) + .00001f); try { this.animationManager.tickAnimation(); diff --git a/GeneralMods/Revitalize/Framework/Objects/Furniture/TableTileComponent.cs b/GeneralMods/Revitalize/Framework/Objects/Furniture/TableTileComponent.cs index 142f1461..b58fdcd0 100644 --- a/GeneralMods/Revitalize/Framework/Objects/Furniture/TableTileComponent.cs +++ b/GeneralMods/Revitalize/Framework/Objects/Furniture/TableTileComponent.cs @@ -361,7 +361,7 @@ namespace Revitalize.Framework.Objects.Furniture if (this.animationManager.getExtendedTexture() == null) ModCore.ModMonitor.Log("Tex Extended is null???"); - spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(y * Game1.tileSize) / 10000f)); + spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(y * Game1.tileSize) / 10000f)); // Log.AsyncG("ANIMATION IS NULL?!?!?!?!"); } @@ -380,7 +380,7 @@ namespace Revitalize.Framework.Objects.Furniture { addedDepth += 1.0f; } - this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((y + addedDepth) * Game1.tileSize) / 10000f) + .00001f); + this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((y + addedDepth) * Game1.tileSize) / 10000f) + .00001f); try { this.animationManager.tickAnimation(); diff --git a/GeneralMods/Revitalize/Framework/Objects/Items/Resources/Dye.cs b/GeneralMods/Revitalize/Framework/Objects/Items/Resources/Dye.cs new file mode 100644 index 00000000..2a29043d --- /dev/null +++ b/GeneralMods/Revitalize/Framework/Objects/Items/Resources/Dye.cs @@ -0,0 +1,278 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Newtonsoft.Json; +using PyTK.CustomElementHandler; +using Revitalize.Framework.Illuminate; +using StardewValley; + +namespace Revitalize.Framework.Objects.Items.Resources +{ + public class Dye: CustomObject, ISaveElement + { + + public NamedColor dyeColor; + [JsonIgnore] + public virtual string ItemInfo + { + get + { + return Revitalize.ModCore.Serializer.ToJSONString(this.info) + "<" + this.guid + "<" + ModCore.Serializer.ToJSONString(this.data)+"<"+ModCore.Serializer.ToJSONString(this.dyeColor); + } + set + { + if (string.IsNullOrEmpty(value)) return; + string[] data = value.Split('<'); + string infoString = data[0]; + string guidString = data[1]; + string pytkData = data[2]; + string dyeColorStr = data[3]; + + this.info = (BasicItemInformation)Revitalize.ModCore.Serializer.DeserializeFromJSONString(infoString, typeof(BasicItemInformation)); + this.data = ModCore.Serializer.DeserializeFromJSONString(pytkData); + Guid oldGuid = this.guid; + this.guid = Guid.Parse(guidString); + if (ModCore.CustomObjects.ContainsKey(this.guid)) + { + //ModCore.log("Update item with guid: " + this.guid); + ModCore.CustomObjects[this.guid] = this; + } + else + { + //ModCore.log("Add in new guid: " + this.guid); + ModCore.CustomObjects.Add(this.guid, this); + } + + if (ModCore.CustomObjects.ContainsKey(oldGuid) && ModCore.CustomObjects.ContainsKey(this.guid)) + { + if (ModCore.CustomObjects[oldGuid] == ModCore.CustomObjects[this.guid] && oldGuid != this.guid) + { + //ModCore.CustomObjects.Remove(oldGuid); + } + } + this.dyeColor = ModCore.Serializer.DeserializeFromJSONString(dyeColorStr); + } + } + + public Dye() { } + + public Dye(CustomObjectData PyTKData, BasicItemInformation info,NamedColor Color ,int Stack = 1) : base(PyTKData, info) + { + this.Stack = Stack; + this.Price = info.price; + } + + public Dye(CustomObjectData PyTKData, BasicItemInformation info,NamedColor Color ,Vector2 TileLocation, int Stack = 1) : base(PyTKData, info, TileLocation) + { + this.Stack = Stack; + this.Price = info.price; + } + + public override bool checkForAction(Farmer who, bool justCheckingForActivity = false) + { + //ModCore.log("Checking for a clicky click???"); + return base.checkForAction(who, justCheckingForActivity); + } + + public override bool clicked(Farmer who) + { + //ModCore.log("Clicked a multiTiledComponent!"); + return true; + //return base.clicked(who); + } + + public override bool rightClicked(Farmer who) + { + if (this.location == null) + this.location = Game1.player.currentLocation; + + //ModCore.playerInfo.sittingInfo.sit(this, Vector2.Zero); + + return true; + } + + + + public override void performRemoveAction(Vector2 tileLocation, GameLocation environment) + { + this.location = null; + base.performRemoveAction(this.TileLocation, environment); + } + + public virtual void removeFromLocation(GameLocation location, Vector2 offset) + { + this.cleanUpLights(); + location.removeObject(this.TileLocation, false); + this.location = null; + //this.performRemoveAction(this.TileLocation,location); + } + + public virtual void cleanUpLights() + { + if (this.info.lightManager != null) this.info.lightManager.removeForCleanUp(this.location); + } + + public override void drawPlacementBounds(SpriteBatch spriteBatch, GameLocation location) + { + //Do nothing because this shouldn't be placeable anywhere. + } + + /// Places an object down. + public override bool placementAction(GameLocation location, int x, int y, Farmer who = null) + { + /* + this.updateDrawPosition(x, y); + this.location = location; + + if (this.location == null) this.location = Game1.player.currentLocation; + this.TileLocation = new Vector2((int)(x / Game1.tileSize), (int)(y / Game1.tileSize)); + //ModCore.log("TileLocation: " + this.TileLocation); + /* + return base.placementAction(location, x, y, who); + + //this.updateLightManager(); + + this.performDropDownAction(who); + location.objects.Add(this.TileLocation, this); + */ + //return true; + return false; + } + + + + + public override Item getOne() + { + Ore component = new Ore(this.data, this.info.Copy(), this.TileLocation); + component.Stack = 1; + return component; + } + + + public override ICustomObject recreate(Dictionary additionalSaveData, object replacement) + { + //instead of using this.offsetkey.x use get additional save data function and store offset key there + + Ore self = Revitalize.ModCore.Serializer.DeserializeGUID(additionalSaveData["GUID"]); + if (self == null) + { + return null; + } + + /* + if (!Revitalize.ModCore.ObjectGroups.ContainsKey(additionalSaveData["ParentGUID"])) + { + //Get new container + MultiTiledObject obj = (MultiTiledObject)Revitalize.ModCore.Serializer.DeserializeGUID(additionalSaveData["ParentGUID"]); + self.containerObject = obj; + obj.addComponent(offsetKey, self); + //Revitalize.ModCore.log("ADD IN AN OBJECT!!!!"); + Revitalize.ModCore.ObjectGroups.Add(additionalSaveData["ParentGUID"], (MultiTiledObject)obj); + } + else + { + self.containerObject = Revitalize.ModCore.ObjectGroups[additionalSaveData["ParentGUID"]]; + Revitalize.ModCore.ObjectGroups[additionalSaveData["GUID"]].addComponent(offsetKey, self); + //Revitalize.ModCore.log("READD AN OBJECT!!!!"); + } + */ + return (ICustomObject)self; + } + + public override Dictionary getAdditionalSaveData() + { + Dictionary saveData = base.getAdditionalSaveData(); + saveData.Add("GUID", this.guid.ToString()); + Revitalize.ModCore.Serializer.SerializeGUID(this.guid.ToString(), this); + + return saveData; + + } + + protected string recreateParentId(string id) + { + StringBuilder b = new StringBuilder(); + string[] splits = id.Split('.'); + for (int i = 0; i < splits.Length - 1; i++) + { + b.Append(splits[i]); + if (i == splits.Length - 2) continue; + b.Append("."); + } + return b.ToString(); + } + + public override int sellToStorePrice() + { + return this.Price; + } + + public override int salePrice() + { + return this.Price * 2; + } + /// What happens when the object is drawn at a tile location. + public override void draw(SpriteBatch spriteBatch, int x, int y, float alpha = 1f) + { + if (this.info.ignoreBoundingBox == true) + { + x *= -1; + y *= -1; + } + + if (this.info == null) + { + Revitalize.ModCore.log("info is null"); + if (this.syncObject == null) Revitalize.ModCore.log("DEAD SYNC"); + } + if (this.animationManager == null) Revitalize.ModCore.log("Animation Manager Null"); + if (this.displayTexture == null) Revitalize.ModCore.log("Display texture is null"); + + //The actual planter box being drawn. + if (this.animationManager == null) + { + if (this.animationManager.getExtendedTexture() == null) + ModCore.ModMonitor.Log("Tex Extended is null???"); + + spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.dyeColor.color * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(y * Game1.tileSize) / 10000f)); + // Log.AsyncG("ANIMATION IS NULL?!?!?!?!"); + } + + else + { + //Log.AsyncC("Animation Manager is working!"); + float addedDepth = 0; + this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.dyeColor.color * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((y + addedDepth) * Game1.tileSize) / 10000f) + .00001f); + try + { + this.animationManager.tickAnimation(); + // Log.AsyncC("Tick animation"); + } + catch (Exception err) + { + ModCore.ModMonitor.Log(err.ToString()); + } + } + + // spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)((double)tileLocation.X * (double)Game1.tileSize + (((double)tileLocation.X * 11.0 + (double)tileLocation.Y * 7.0) % 10.0 - 5.0)) + (float)(Game1.tileSize / 2), (float)((double)tileLocation.Y * (double)Game1.tileSize + (((double)tileLocation.Y * 11.0 + (double)tileLocation.X * 7.0) % 10.0 - 5.0)) + (float)(Game1.tileSize / 2))), new Rectangle?(new Rectangle((int)((double)tileLocation.X * 51.0 + (double)tileLocation.Y * 77.0) % 3 * 16, 128 + this.whichForageCrop * 16, 16, 16)), Color.White, 0.0f, new Vector2(8f, 8f), (float)Game1.pixelZoom, SpriteEffects.None, (float)(((double)tileLocation.Y * (double)Game1.tileSize + (double)(Game1.tileSize / 2) + (((double)tileLocation.Y * 11.0 + (double)tileLocation.X * 7.0) % 10.0 - 5.0)) / 10000.0)); + + } + + public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, bool drawStackNumber, Color c, bool drawShadow) + { + if (drawStackNumber && this.maximumStackSize() > 1 && ((double)scaleSize > 0.3 && this.Stack != int.MaxValue) && this.Stack > 1) + Utility.drawTinyDigits(this.Stack, spriteBatch, location + new Vector2((float)(Game1.tileSize - Utility.getWidthOfTinyDigitString(this.Stack, 3f * scaleSize)) + 3f * scaleSize, (float)((double)Game1.tileSize - 18.0 * (double)scaleSize + 2.0)), 3f * scaleSize, 1f, Color.White); + if (drawStackNumber && this.Quality > 0) + { + float num = this.Quality < 4 ? 0.0f : (float)((Math.Cos((double)Game1.currentGameTime.TotalGameTime.Milliseconds * Math.PI / 512.0) + 1.0) * 0.0500000007450581); + spriteBatch.Draw(Game1.mouseCursors, location + new Vector2(12f, (float)(Game1.tileSize - 12) + num), new Microsoft.Xna.Framework.Rectangle?(this.Quality < 4 ? new Microsoft.Xna.Framework.Rectangle(338 + (this.Quality - 1) * 8, 400, 8, 8) : new Microsoft.Xna.Framework.Rectangle(346, 392, 8, 8)), Color.White * transparency, 0.0f, new Vector2(4f, 4f), (float)(3.0 * (double)scaleSize * (1.0 + (double)num)), SpriteEffects.None, layerDepth); + } + spriteBatch.Draw(this.displayTexture, location + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * transparency, 0f, new Vector2((float)(this.animationManager.currentAnimation.sourceRectangle.Width / 2), (float)(this.animationManager.currentAnimation.sourceRectangle.Height)), scaleSize * 4f, SpriteEffects.None, layerDepth); + } + } +} diff --git a/GeneralMods/Revitalize/Framework/Objects/Items/Resources/Ore.cs b/GeneralMods/Revitalize/Framework/Objects/Items/Resources/Ore.cs index 02646e2b..a0dd7b45 100644 --- a/GeneralMods/Revitalize/Framework/Objects/Items/Resources/Ore.cs +++ b/GeneralMods/Revitalize/Framework/Objects/Items/Resources/Ore.cs @@ -193,7 +193,7 @@ namespace Revitalize.Framework.Objects.Items.Resources if (this.animationManager.getExtendedTexture() == null) ModCore.ModMonitor.Log("Tex Extended is null???"); - spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(y * Game1.tileSize) / 10000f)); + spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(y * Game1.tileSize) / 10000f)); // Log.AsyncG("ANIMATION IS NULL?!?!?!?!"); } @@ -201,7 +201,7 @@ namespace Revitalize.Framework.Objects.Items.Resources { //Log.AsyncC("Animation Manager is working!"); float addedDepth = 0; - this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((y + addedDepth) * Game1.tileSize) / 10000f) + .00001f); + this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((y + addedDepth) * Game1.tileSize) / 10000f) + .00001f); try { this.animationManager.tickAnimation(); @@ -226,7 +226,7 @@ namespace Revitalize.Framework.Objects.Items.Resources float num = this.Quality < 4 ? 0.0f : (float)((Math.Cos((double)Game1.currentGameTime.TotalGameTime.Milliseconds * Math.PI / 512.0) + 1.0) * 0.0500000007450581); spriteBatch.Draw(Game1.mouseCursors, location + new Vector2(12f, (float)(Game1.tileSize - 12) + num), new Microsoft.Xna.Framework.Rectangle?(this.Quality < 4 ? new Microsoft.Xna.Framework.Rectangle(338 + (this.Quality - 1) * 8, 400, 8, 8) : new Microsoft.Xna.Framework.Rectangle(346, 392, 8, 8)), Color.White * transparency, 0.0f, new Vector2(4f, 4f), (float)(3.0 * (double)scaleSize * (1.0 + (double)num)), SpriteEffects.None, layerDepth); } - spriteBatch.Draw(this.displayTexture, location + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * transparency, 0f, new Vector2((float)(this.animationManager.currentAnimation.sourceRectangle.Width / 2), (float)(this.animationManager.currentAnimation.sourceRectangle.Height)), scaleSize * 4f, SpriteEffects.None, layerDepth); + spriteBatch.Draw(this.displayTexture, location + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * transparency, 0f, new Vector2((float)(this.animationManager.currentAnimation.sourceRectangle.Width / 2), (float)(this.animationManager.currentAnimation.sourceRectangle.Height)), scaleSize * 4f, SpriteEffects.None, layerDepth); } } diff --git a/GeneralMods/Revitalize/Framework/Objects/Machines/EnergyGeneration/SolarPanel.cs b/GeneralMods/Revitalize/Framework/Objects/Machines/EnergyGeneration/SolarPanel.cs index 4e6ea0dd..dda7195f 100644 --- a/GeneralMods/Revitalize/Framework/Objects/Machines/EnergyGeneration/SolarPanel.cs +++ b/GeneralMods/Revitalize/Framework/Objects/Machines/EnergyGeneration/SolarPanel.cs @@ -124,7 +124,7 @@ namespace Revitalize.Framework.Objects.Machines.EnergyGeneration if (this.animationManager.getExtendedTexture() == null) ModCore.ModMonitor.Log("Tex Extended is null???"); - spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(y * Game1.tileSize) / 10000f)); + spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(y * Game1.tileSize) / 10000f)); // Log.AsyncG("ANIMATION IS NULL?!?!?!?!"); } @@ -143,7 +143,7 @@ namespace Revitalize.Framework.Objects.Machines.EnergyGeneration { addedDepth += 1.0f; } - this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((y + addedDepth) * Game1.tileSize) / 10000f) + .00001f); + this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((y + addedDepth) * Game1.tileSize) / 10000f) + .00001f); try { this.animationManager.tickAnimation(); diff --git a/GeneralMods/Revitalize/Framework/Objects/Machines/Machine.cs b/GeneralMods/Revitalize/Framework/Objects/Machines/Machine.cs index b6ce9009..7f9f4221 100644 --- a/GeneralMods/Revitalize/Framework/Objects/Machines/Machine.cs +++ b/GeneralMods/Revitalize/Framework/Objects/Machines/Machine.cs @@ -383,7 +383,7 @@ namespace Revitalize.Framework.Objects.Machines if (this.animationManager.getExtendedTexture() == null) ModCore.ModMonitor.Log("Tex Extended is null???"); - spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(y * Game1.tileSize) / 10000f)); + spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(y * Game1.tileSize) / 10000f)); // Log.AsyncG("ANIMATION IS NULL?!?!?!?!"); } @@ -402,7 +402,7 @@ namespace Revitalize.Framework.Objects.Machines { addedDepth += 1.0f; } - this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((y + addedDepth) * Game1.tileSize) / 10000f) + .00001f); + this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((y + addedDepth) * Game1.tileSize) / 10000f) + .00001f); this.drawStatusBubble(spriteBatch, x, y, alpha); try diff --git a/GeneralMods/Revitalize/Framework/Objects/Machines/Wire.cs b/GeneralMods/Revitalize/Framework/Objects/Machines/Wire.cs index fc6bb1cd..c5d34565 100644 --- a/GeneralMods/Revitalize/Framework/Objects/Machines/Wire.cs +++ b/GeneralMods/Revitalize/Framework/Objects/Machines/Wire.cs @@ -104,7 +104,7 @@ namespace Revitalize.Framework.Objects.Machines if (this.animationManager.getExtendedTexture() == null) ModCore.ModMonitor.Log("Tex Extended is null???"); - spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(y * Game1.tileSize) / 10000f)); + spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(y * Game1.tileSize) / 10000f)); // Log.AsyncG("ANIMATION IS NULL?!?!?!?!"); } @@ -120,7 +120,7 @@ namespace Revitalize.Framework.Objects.Machines if (this.info.ignoreBoundingBox) addedDepth += 1.5f; } //this.determineWireOrientation(); - this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((y + addedDepth) * Game1.tileSize) / 10000f) + .00001f); + this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((y + addedDepth) * Game1.tileSize) / 10000f) + .00001f); try { this.animationManager.tickAnimation(); diff --git a/GeneralMods/Revitalize/Framework/Objects/MultiTiledComponent.cs b/GeneralMods/Revitalize/Framework/Objects/MultiTiledComponent.cs index f785f52e..76fe0eaf 100644 --- a/GeneralMods/Revitalize/Framework/Objects/MultiTiledComponent.cs +++ b/GeneralMods/Revitalize/Framework/Objects/MultiTiledComponent.cs @@ -248,7 +248,7 @@ namespace Revitalize.Framework.Objects } - spriteBatch.Draw(this.displayTexture, location, new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * transparency, 0f, new Vector2((float)(this.animationManager.currentAnimation.sourceRectangle.Width / 2), (float)(this.animationManager.currentAnimation.sourceRectangle.Height)), scaleSize, SpriteEffects.None, layerDepth); + spriteBatch.Draw(this.displayTexture, location, new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * transparency, 0f, new Vector2((float)(this.animationManager.currentAnimation.sourceRectangle.Width / 2), (float)(this.animationManager.currentAnimation.sourceRectangle.Height)), scaleSize, SpriteEffects.None, layerDepth); } public override Item getOne() @@ -369,7 +369,7 @@ namespace Revitalize.Framework.Objects if (this.animationManager.getExtendedTexture() == null) ModCore.ModMonitor.Log("Tex Extended is null???"); - spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(y * Game1.tileSize) / 10000f)); + spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(y * Game1.tileSize) / 10000f)); // Log.AsyncG("ANIMATION IS NULL?!?!?!?!"); } @@ -388,7 +388,7 @@ namespace Revitalize.Framework.Objects { addedDepth += 1.0f; } - this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((y + addedDepth) * Game1.tileSize) / 10000f)+.00001f); + this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((y + addedDepth) * Game1.tileSize) / 10000f)+.00001f); try { this.animationManager.tickAnimation(); @@ -413,7 +413,7 @@ namespace Revitalize.Framework.Objects } if (this.displayTexture == null) Revitalize.ModCore.log("Display texture is null"); - spriteBatch.Draw(this.displayTexture, objectPosition, this.animationManager.currentAnimation.sourceRectangle, this.info.drawColor, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, Depth); + spriteBatch.Draw(this.displayTexture, objectPosition, this.animationManager.currentAnimation.sourceRectangle, this.info.DrawColor, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, Depth); //base.drawWhenHeld(spriteBatch, objectPosition, f); } diff --git a/GeneralMods/Revitalize/Framework/Objects/MultiTiledObject.cs b/GeneralMods/Revitalize/Framework/Objects/MultiTiledObject.cs index f081be7a..f44faf2e 100644 --- a/GeneralMods/Revitalize/Framework/Objects/MultiTiledObject.cs +++ b/GeneralMods/Revitalize/Framework/Objects/MultiTiledObject.cs @@ -6,6 +6,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Newtonsoft.Json; using PyTK.CustomElementHandler; +using Revitalize.Framework.Illuminate; using Revitalize.Framework.Utilities; using StardewValley; using StardewValley.Objects; @@ -569,5 +570,27 @@ namespace Revitalize.Framework.Objects } } + + /// + /// + /// + /// + public override void dyeColor(NamedColor DyeColor) + { + foreach (KeyValuePair pair in this.objects) + { + (pair.Value as CustomObject).dyeColor(DyeColor); + } + this.info.DyedColor = DyeColor; + } + + public override void eraseDye() + { + foreach (KeyValuePair pair in this.objects) + { + (pair.Value as CustomObject).eraseDye(); + } + this.info.DyedColor = new NamedColor("", new Color(0, 0, 0, 0)); + } } } diff --git a/GeneralMods/Revitalize/Framework/Objects/Resources/OreVeins/OreVeinTile.cs b/GeneralMods/Revitalize/Framework/Objects/Resources/OreVeins/OreVeinTile.cs index 47d7fcdd..ba4a9492 100644 --- a/GeneralMods/Revitalize/Framework/Objects/Resources/OreVeins/OreVeinTile.cs +++ b/GeneralMods/Revitalize/Framework/Objects/Resources/OreVeins/OreVeinTile.cs @@ -423,7 +423,7 @@ namespace Revitalize.Framework.Objects.Resources.OreVeins if (this.animationManager.getExtendedTexture() == null) ModCore.ModMonitor.Log("Tex Extended is null???"); - spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize)+this.info.shakeTimerOffset(), (y * Game1.tileSize)+this.info.shakeTimerOffset())), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(y * Game1.tileSize) / 10000f)); + spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize)+this.info.shakeTimerOffset(), (y * Game1.tileSize)+this.info.shakeTimerOffset())), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(y * Game1.tileSize) / 10000f)); // Log.AsyncG("ANIMATION IS NULL?!?!?!?!"); } @@ -442,7 +442,7 @@ namespace Revitalize.Framework.Objects.Resources.OreVeins { addedDepth += 1.0f; } - this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize)+this.info.shakeTimerOffset(), (y * Game1.tileSize)+this.info.shakeTimerOffset())), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((y + addedDepth) * Game1.tileSize) / 10000f) + .00001f); + this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize)+this.info.shakeTimerOffset(), (y * Game1.tileSize)+this.info.shakeTimerOffset())), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((y + addedDepth) * Game1.tileSize) / 10000f) + .00001f); try { this.animationManager.tickAnimation(); diff --git a/GeneralMods/Revitalize/ModCore.cs b/GeneralMods/Revitalize/ModCore.cs index 2a393ef0..eddebc23 100644 --- a/GeneralMods/Revitalize/ModCore.cs +++ b/GeneralMods/Revitalize/ModCore.cs @@ -32,6 +32,7 @@ using Revitalize.Framework.Objects.CraftingTables; using Revitalize.Framework.Objects.Items.Tools; using StardewValley.Tools; using Revitalize.Framework.Menus.Machines; +using Revitalize.Framework.Objects.Machines; namespace Revitalize { @@ -40,10 +41,7 @@ namespace Revitalize // -Chair tops cut off objects // -load content MUST be enabled for the table to be placed?????? // TODO: - /* Add in crafting menu. - * Add in crafting table. - * - * + /* // -Make this mod able to load content packs for easier future modding // // -Multiple Lights On Object @@ -57,7 +55,7 @@ namespace Revitalize // -dressers/other storage containers (Done!) // -fun interactables // -Arcade machines - // -More crafting tables + // -More crafting tables (done) // -Baths (see chairs but swimming) // // -Machines @@ -95,7 +93,7 @@ namespace Revitalize // -Calcinator (oil+stone: produces titanum?) // -Materials // -Tin/Bronze/Alluminum/Silver?Platinum/Etc (all but platinum: may add in at a later date) - -titanium + -titanium (d0ne) -Alloys! -Brass (done) -Electrum (done) @@ -552,7 +550,9 @@ namespace Revitalize Game1.player.addItemToInventoryBool(ObjectManager.GetItem("Workbench")); - + + MultiTiledObject batteryBin =(MultiTiledObject) ModCore.ObjectManager.GetItem("BatteryBin", 1); + batteryBin.dyeColor(Framework.Illuminate.ColorsList.Lime); //PickaxeExtended pick = new PickaxeExtended(new BasicItemInformation("My First Pickaxe", "Omegasis.Revitalize.Items.Tools.MyFirstPickaxe", "A testing pickaxe. Does it work?", "Tool", Color.SlateGray, 0, 0, false, 500, false, false, TextureManager.GetTexture(Manifest, "Tools", "Pickaxe"), new AnimationManager(TextureManager.GetExtendedTexture(Manifest, "Tools", "Pickaxe"), new Animation(0, 0, 16, 16)), Color.White, true, null, null),2,TextureManager.GetExtendedTexture(Manifest,"Tools","TestingPickaxeWorking")); Game1.player.addItemsByMenuIfNecessary(new List() @@ -567,7 +567,7 @@ namespace Revitalize new StardewValley.Object(Vector2.Zero,(int)Enums.SDVBigCraftable.Furnace,false), ModCore.ObjectManager.GetItem("Lighthouse",1), ModCore.ObjectManager.GetItem("CopperWire"), - ModCore.ObjectManager.GetItem("BatteryBin",1) + batteryBin }); } diff --git a/GeneralMods/Revitalize/Revitalize.csproj b/GeneralMods/Revitalize/Revitalize.csproj index 87ff03a3..d354aedd 100644 --- a/GeneralMods/Revitalize/Revitalize.csproj +++ b/GeneralMods/Revitalize/Revitalize.csproj @@ -56,6 +56,7 @@ + @@ -81,8 +82,10 @@ + + @@ -149,6 +152,7 @@ +