From 0f5eb5b60bc8d027beb97ea381899fe92bd28a6e Mon Sep 17 00:00:00 2001 From: JoshuaNavarro Date: Mon, 9 Sep 2019 16:07:39 -0700 Subject: [PATCH] Added in sand as a resource and made the sandbox generate sand. --- .../Graphics/Items/Resources/Misc/Sand.png | Bin 0 -> 259 bytes .../Framework/Objects/ObjectManager.cs | 10 +++--- .../Framework/Objects/ResourceManager.cs | 32 ++++++++++++++++++ GeneralMods/Revitalize/ModCore.cs | 2 ++ GeneralMods/Revitalize/Revitalize.csproj | 3 ++ 5 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 GeneralMods/Revitalize/Content/Graphics/Items/Resources/Misc/Sand.png 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 0000000000000000000000000000000000000000..88d9065bc61288bc88a4fbd45f5197d3d5f989ed GIT binary patch literal 259 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|_IkQFhFJ6_ zCrGgN>`>XJ=kcrm%y+*T?V-A1jx*BI^|jf6pl$E%zK13)oYT4I>|G;Kw|75x`eP;u zHU;asz5$ZUW#YsoGQ1DnY>8=1VmQN=Sm_GZvz`CFa0zQ0cY@j9s(SG}0lRPmrP)~v zbUClL@ZGc9!#~}*PjuN@?n(a+FLIBFo0#~1TQX1ecG={L-yiH^9^T769$<1is%!Bq xzG6nBzc16C{s*a5?oJGDzb=r&*dA)E%D}LEZ4rlIy&cG#44$rjF6*2Ung9fxUBCbU literal 0 HcmV?d00001 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