diff --git a/GeneralMods/Revitalize/Content/Graphics/Items/Resources/Misc/Sand.png b/GeneralMods/Revitalize/Content/Graphics/Items/Resources/Misc/Sand.png new file mode 100644 index 00000000..88d9065b Binary files /dev/null and b/GeneralMods/Revitalize/Content/Graphics/Items/Resources/Misc/Sand.png differ diff --git a/GeneralMods/Revitalize/Framework/Objects/ObjectManager.cs b/GeneralMods/Revitalize/Framework/Objects/ObjectManager.cs index 481ae93a..6b6e67be 100644 --- a/GeneralMods/Revitalize/Framework/Objects/ObjectManager.cs +++ b/GeneralMods/Revitalize/Framework/Objects/ObjectManager.cs @@ -107,7 +107,7 @@ namespace Revitalize.Framework.Objects /// public void loadInItems() { - this.resources.loadInItems(); + this.resources.loadInItems(); //Must be first. this.loadInCraftingTables(); this.loadInMachines(); this.loadInTools(); @@ -154,22 +154,22 @@ namespace Revitalize.Framework.Objects MultiTiledObject sandBox = new MultiTiledObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.Sandbox", TextureManager.GetTexture(ModCore.Manifest, "Machines", "Sandbox"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("Sandbox", "Omegasis.Revitalize.Objects.Machines.Sandbox", "A sandbox which slowly produces sand. Unfortunately you can't sit in this one.", "Machine", Color.SteelBlue, -300, 0, false, 750, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "Sandbox"), new AnimationManager(), Color.White, true, new InventoryManager(36), null, null)); Machine sandBox_0_0 = new Machine(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.Sandbox", TextureManager.GetTexture(ModCore.Manifest, "Machines", "Sandbox"), typeof(Machine), Color.White, true), new BasicItemInformation("Sandbox", "Omegasis.Revitalize.Objects.Machines.Sandbox", "A sandbox which slowly produces sand. Unfortunately you can't sit in this one.", "Machine", Color.SteelBlue, -300, 0, false, 750, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "Sandbox"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "Sandbox"),new Animation(0,0,16,16)), Color.White, false, new InventoryManager(36), null, null), new List() { - new InformationFiles.ResourceInformation(new StardewValley.Object((int)Enums.SDVObject.Clay,1),1,1,1,1,1,1,0,0,0,0) + new InformationFiles.ResourceInformation(this.resources.getResource("Sand",1),1,1,1,1,1,1,0,0,0,0) }, 0, 10, true); Machine sandBox_1_0 = new Machine(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.Sandbox", TextureManager.GetTexture(ModCore.Manifest, "Machines", "Sandbox"), typeof(Machine), Color.White, true), new BasicItemInformation("Sandbox", "Omegasis.Revitalize.Objects.Machines.Sandbox", "A sandbox which slowly produces sand. Unfortunately you can't sit in this one.", "Machine", Color.SteelBlue, -300, 0, false, 750, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "Sandbox"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "Sandbox"), new Animation(16, 0, 16, 16)), Color.White, false, new InventoryManager(36), null, null), new List() { - new InformationFiles.ResourceInformation(new StardewValley.Object((int)Enums.SDVObject.Clay,1),1,1,1,1,1,1,0,0,0,0) + new InformationFiles.ResourceInformation(this.resources.getResource("Sand",1),1,1,1,1,1,1,0,0,0,0) }, 0, 10, false); Machine sandBox_0_1 = new Machine(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.Sandbox", TextureManager.GetTexture(ModCore.Manifest, "Machines", "Sandbox"), typeof(Machine), Color.White, true), new BasicItemInformation("Sandbox", "Omegasis.Revitalize.Objects.Machines.Sandbox", "A sandbox which slowly produces sand. Unfortunately you can't sit in this one.", "Machine", Color.SteelBlue, -300, 0, false, 750, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "Sandbox"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "Sandbox"), new Animation(0, 16, 16, 16)), Color.White, false, new InventoryManager(36), null, null), new List() { - new InformationFiles.ResourceInformation(new StardewValley.Object((int)Enums.SDVObject.Clay,1),1,1,1,1,1,1,0,0,0,0) + new InformationFiles.ResourceInformation(this.resources.getResource("Sand",1),1,1,1,1,1,1,0,0,0,0) }, 0, 10, false); Machine sandBox_1_1 = new Machine(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.Sandbox", TextureManager.GetTexture(ModCore.Manifest, "Machines", "Sandbox"), typeof(Machine), Color.White, true), new BasicItemInformation("Sandbox", "Omegasis.Revitalize.Objects.Machines.Sandbox", "A sandbox which slowly produces sand. Unfortunately you can't sit in this one.", "Machine", Color.SteelBlue, -300, 0, false, 750, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "Sandbox"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "Sandbox"), new Animation(16, 16, 16, 16)), Color.White, false, new InventoryManager(36), null, null), new List() { - new InformationFiles.ResourceInformation(new StardewValley.Object((int)Enums.SDVObject.Clay,1),1,1,1,1,1,1,0,0,0,0) + new InformationFiles.ResourceInformation(this.resources.getResource("Sand",1),1,1,1,1,1,1,0,0,0,0) }, 0, 10, false); diff --git a/GeneralMods/Revitalize/Framework/Objects/ResourceManager.cs b/GeneralMods/Revitalize/Framework/Objects/ResourceManager.cs index fb0b0412..eed1164b 100644 --- a/GeneralMods/Revitalize/Framework/Objects/ResourceManager.cs +++ b/GeneralMods/Revitalize/Framework/Objects/ResourceManager.cs @@ -30,6 +30,7 @@ namespace Revitalize.Framework.Objects public Dictionary oreVeins; public Dictionary oreResourceInformationTable; public Dictionary ores; + public Dictionary resources; /// /// A list of all visited floors on the current visit to the mines. @@ -46,6 +47,7 @@ namespace Revitalize.Framework.Objects this.oreResourceInformationTable = new Dictionary(); this.ores = new Dictionary(); this.visitedFloors = new List(); + this.resources = new Dictionary(); } @@ -54,6 +56,7 @@ namespace Revitalize.Framework.Objects public void loadInItems() { this.loadInOreItems(); + this.loadInResourceItems(); this.serializeOreVeins(); this.loadOreVeins(); } @@ -304,6 +307,12 @@ namespace Revitalize.Framework.Objects ModCore.ObjectManager.AddItem("SteelIngot", steelIngot); } + private void loadInResourceItems() + { + CustomObject sand=new CustomObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Items.Resources.Misc.Sand", TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Misc", "Sand"), typeof(CustomObject), Color.White, true), new BasicItemInformation("Sand", "Omegasis.Revitalize.Items.Resources.Misc.Sand", "Sand which is made from tiny rocks and can be used for smelting. Also unfun to have inside of swimwear.", "Resource", Color.Brown, -300, 0, false, 2, false, false, TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Misc", "Sand"), new AnimationManager(), Color.White, true, null, null)); + this.resources.Add("Sand", sand); + } + /// /// Gets an ore from the list of stored ores in this mod. /// @@ -324,6 +333,29 @@ namespace Revitalize.Framework.Objects } } + /// + /// Get a resource from the resource maanger. + /// + /// + /// + /// + public CustomObject getResource(string name, int Stack=1) + { + Ore o = this.getOre(name, Stack); + if (o != null) return o; + + if (this.resources.ContainsKey(name)) + { + CustomObject obj = (CustomObject)this.resources[name].getOne(); + obj.Stack = Stack; + return obj; + } + else + { + return null; + } + } + public OreResourceInformation getOreResourceInfo(string id) { if (this.oreVeins.ContainsKey(id)) diff --git a/GeneralMods/Revitalize/ModCore.cs b/GeneralMods/Revitalize/ModCore.cs index b9b5ad2d..327ebb03 100644 --- a/GeneralMods/Revitalize/ModCore.cs +++ b/GeneralMods/Revitalize/ModCore.cs @@ -300,6 +300,8 @@ namespace Revitalize TextureManager.GetTextureManager(Manifest, "InventoryMenu").searchForTextures(ModHelper, this.ModManifest, Path.Combine("Content", "Graphics", "Menus", "InventoryMenu")); TextureManager.AddTextureManager(Manifest, "Resources.Ore"); TextureManager.GetTextureManager(Manifest, "Resources.Ore").searchForTextures(ModHelper, this.ModManifest, Path.Combine("Content", "Graphics", "Objects", "Resources", "Ore")); + TextureManager.AddTextureManager(Manifest, "Items.Resources.Misc"); + TextureManager.GetTextureManager(Manifest, "Items.Resources.Misc").searchForTextures(ModHelper, this.ModManifest, Path.Combine("Content", "Graphics", "Items", "Resources", "Misc")); TextureManager.AddTextureManager(Manifest, "Items.Resources.Ore"); TextureManager.GetTextureManager(Manifest, "Items.Resources.Ore").searchForTextures(ModHelper, this.ModManifest, Path.Combine("Content", "Graphics", "Items", "Resources", "Ore")); TextureManager.AddTextureManager(Manifest, "Tools"); diff --git a/GeneralMods/Revitalize/Revitalize.csproj b/GeneralMods/Revitalize/Revitalize.csproj index aef4baaa..00ee0937 100644 --- a/GeneralMods/Revitalize/Revitalize.csproj +++ b/GeneralMods/Revitalize/Revitalize.csproj @@ -201,6 +201,9 @@ + + PreserveNewest + PreserveNewest