From ce904efef34a191b932eb247c4e5cc18e9942bb5 Mon Sep 17 00:00:00 2001 From: JoshuaNavarro Date: Tue, 13 Aug 2019 19:05:11 -0700 Subject: [PATCH] Reworked object pools to be more sorted out. Also added in ore veins! --- .../Arcade/SeasideScrambleArcade.png | Bin .../Furniture/Chairs/Oak Chair.png | Bin .../Furniture/Lamps/Oak Lamp.png | Bin .../Furniture/Storage/Oak Cabinet.png | Bin .../Furniture/Tables/Oak Table.png | Bin .../Graphics/Objects/Resources/Ore/Test.png | Bin 0 -> 530 bytes .../Resources/Ore/TestTemplate.aseprite | Bin 0 -> 856 bytes .../Objects/Furniture/FurnitureFactory.cs | 98 +++++-- .../Framework/Objects/BasicItemInformation.cs | 3 - .../InformationFiles/ResourceInformaton.cs | 49 ++++ .../Framework/Objects/ObjectManager.cs | 99 +++++++ .../Framework/Objects/ResourceManager.cs | 107 +++++++ .../Objects/Resources/OreVeins/OreVeinObj.cs | 146 ++++++++++ .../Objects/Resources/OreVeins/OreVeinTile.cs | 268 ++++++++++++++++++ GeneralMods/Revitalize/ModCore.cs | 45 +-- GeneralMods/Revitalize/Revitalize.csproj | 38 ++- 16 files changed, 803 insertions(+), 50 deletions(-) rename GeneralMods/Revitalize/Content/Graphics/{ => Objects}/Furniture/Arcade/SeasideScrambleArcade.png (100%) rename GeneralMods/Revitalize/Content/Graphics/{ => Objects}/Furniture/Chairs/Oak Chair.png (100%) rename GeneralMods/Revitalize/Content/Graphics/{ => Objects}/Furniture/Lamps/Oak Lamp.png (100%) rename GeneralMods/Revitalize/Content/Graphics/{ => Objects}/Furniture/Storage/Oak Cabinet.png (100%) rename GeneralMods/Revitalize/Content/Graphics/{ => Objects}/Furniture/Tables/Oak Table.png (100%) create mode 100644 GeneralMods/Revitalize/Content/Graphics/Objects/Resources/Ore/Test.png create mode 100644 GeneralMods/Revitalize/Content/Graphics/Objects/Resources/Ore/TestTemplate.aseprite create mode 100644 GeneralMods/Revitalize/Framework/Objects/InformationFiles/ResourceInformaton.cs create mode 100644 GeneralMods/Revitalize/Framework/Objects/ResourceManager.cs create mode 100644 GeneralMods/Revitalize/Framework/Objects/Resources/OreVeins/OreVeinObj.cs create mode 100644 GeneralMods/Revitalize/Framework/Objects/Resources/OreVeins/OreVeinTile.cs diff --git a/GeneralMods/Revitalize/Content/Graphics/Furniture/Arcade/SeasideScrambleArcade.png b/GeneralMods/Revitalize/Content/Graphics/Objects/Furniture/Arcade/SeasideScrambleArcade.png similarity index 100% rename from GeneralMods/Revitalize/Content/Graphics/Furniture/Arcade/SeasideScrambleArcade.png rename to GeneralMods/Revitalize/Content/Graphics/Objects/Furniture/Arcade/SeasideScrambleArcade.png diff --git a/GeneralMods/Revitalize/Content/Graphics/Furniture/Chairs/Oak Chair.png b/GeneralMods/Revitalize/Content/Graphics/Objects/Furniture/Chairs/Oak Chair.png similarity index 100% rename from GeneralMods/Revitalize/Content/Graphics/Furniture/Chairs/Oak Chair.png rename to GeneralMods/Revitalize/Content/Graphics/Objects/Furniture/Chairs/Oak Chair.png diff --git a/GeneralMods/Revitalize/Content/Graphics/Furniture/Lamps/Oak Lamp.png b/GeneralMods/Revitalize/Content/Graphics/Objects/Furniture/Lamps/Oak Lamp.png similarity index 100% rename from GeneralMods/Revitalize/Content/Graphics/Furniture/Lamps/Oak Lamp.png rename to GeneralMods/Revitalize/Content/Graphics/Objects/Furniture/Lamps/Oak Lamp.png diff --git a/GeneralMods/Revitalize/Content/Graphics/Furniture/Storage/Oak Cabinet.png b/GeneralMods/Revitalize/Content/Graphics/Objects/Furniture/Storage/Oak Cabinet.png similarity index 100% rename from GeneralMods/Revitalize/Content/Graphics/Furniture/Storage/Oak Cabinet.png rename to GeneralMods/Revitalize/Content/Graphics/Objects/Furniture/Storage/Oak Cabinet.png diff --git a/GeneralMods/Revitalize/Content/Graphics/Furniture/Tables/Oak Table.png b/GeneralMods/Revitalize/Content/Graphics/Objects/Furniture/Tables/Oak Table.png similarity index 100% rename from GeneralMods/Revitalize/Content/Graphics/Furniture/Tables/Oak Table.png rename to GeneralMods/Revitalize/Content/Graphics/Objects/Furniture/Tables/Oak Table.png diff --git a/GeneralMods/Revitalize/Content/Graphics/Objects/Resources/Ore/Test.png b/GeneralMods/Revitalize/Content/Graphics/Objects/Resources/Ore/Test.png new file mode 100644 index 0000000000000000000000000000000000000000..4ee166b57679e79f2ee9352d386029477dc54768 GIT binary patch literal 530 zcmV+t0`2{YP)HV{6vcl@tdMV|II%1iKoK-3NR{vg3uV;GbGQlLsi6Gp6`9<9G`bC{73C>Z~431TYh*ZT}9Z`Rs(RhQe%DR zfL5~}!AL?`3|_o^72CL1@v|9;d?AOt;$lfv)^`pr{Yl^;1n`}cPCyoQ^!5!8HlF+? z5MLe?ODfq)4S=)rbmXqptW);%$kQZY8}N%IH9`nG7}^7BMFZ2G_nX?P|GIq~3!d=h z@I7}QKLnuc=_q&7z}$g?0f1?{bd4FeZYJm&GXP=>{+_0&&x>*v5uR{hN!5s}vZn{% zU1K)SK#+%L4$g%Kz^|X`+YK-Y zVC}mzwywvoX%lx!Dw9N(3*1m=3`g^@r{@;^Z#{0`*EsDQVV(Y<-y3oG)z}wnd>3{g zued0sH2Fdf=fWdj$WiumTFpA{43HN_z<`yjy$ z!Eve;3rcS+3d%yw2qtC4grK%r)K(NxWX{CY**ra`LZOT9`oEmt#rfd*J@0#rNrXgu zC?dk52}KAwjB9z)3B}#~ZxdcYNPKGLQtB5ZrPAqt@+5!fvV=(Jtzf=f16s0`pu0p3 zMvlqA@yizQtN#MH@GT2G|Dh1H-B*CyyK6zcH4`k-OF@+;8`NqWKt<&Vu)OvyX!5e) z!N7a)>8l?giy_2&{VsU2?F?wO*}&40BCu&^2Y5}T0>}56z)BOJ+yMW&dGq;cj;0~eA)3{@@WI$HVf$0|SG<{Z>@|^tc+ig^VPjW=cWVG;n(f$Xesn*5{QeNiltiGqpNQiGZypPB31e)IrJ#oY} z!bx4AboYoWQqlgAuP;lRuX}Cw%nD2sjvZ#r`UZLIrEhx6vvmUFM0C=*ZBQAyb#~FN znfpZB3xkI5frxW9deh#z7=EX&(alWl4@+IUHayI$f7Cm=X(4O+_>AjHTBodu>MKrM zs(~|)rhfhD%N6*9j|!$rT99{|mq@8P^kVG5P(o`E<_;_RM?ZJXho4tl%vHt0Rk~2p oUiW6fYJbm0W_TnnUQ5d~v3ZYC9Xln?&AB=!>|H}L&o%D(2`Qr%#Q*>R literal 0 HcmV?d00001 diff --git a/GeneralMods/Revitalize/Framework/Factories/Objects/Furniture/FurnitureFactory.cs b/GeneralMods/Revitalize/Framework/Factories/Objects/Furniture/FurnitureFactory.cs index b756664e..37f46bc4 100644 --- a/GeneralMods/Revitalize/Framework/Factories/Objects/Furniture/FurnitureFactory.cs +++ b/GeneralMods/Revitalize/Framework/Factories/Objects/Furniture/FurnitureFactory.cs @@ -23,12 +23,26 @@ namespace Revitalize.Framework.Factories.Objects //Create portable beds??? public class FurnitureFactory { - + /// + /// The path to the chairs data on disk. + /// public static string ChairFolder = Path.Combine("Data", "Furniture", "Chairs"); + /// + /// The path to the tables data on disk. + /// public static string TablesFolder = Path.Combine("Data", "Furniture", "Tables"); + /// + /// The path to the lamps data on disk. + /// public static string LampsFolder = Path.Combine("Data", "Furniture", "Lamps"); + /// + /// The path to the storage data on disk. + /// public static string StorageFolder = Path.Combine("Data", "Furniture", "Storage"); + /// + /// Loads all furniture files. + /// public static void LoadFurnitureFiles() { LoadChairFiles(); @@ -37,24 +51,36 @@ namespace Revitalize.Framework.Factories.Objects LoadFurnitureStorageFiles(); } + /// + /// Loads all chair files. + /// private static void LoadChairFiles() { SerializeChairs(); DeserializeChairs(); } + /// + /// Loads all table files. + /// private static void LoadTableFiles() { SerializeTableFiles(); DeserializeTableFiles(); } + /// + /// Loads all lamp files. + /// private static void LoadLampFiles() { SerializeLamps(); DeserializeLamps(); } + /// + /// Loads all furniture storage files. + /// private static void LoadFurnitureStorageFiles() { SerializeFurnitureStorageFiles(); @@ -93,6 +119,9 @@ namespace Revitalize.Framework.Factories.Objects //ModCore.customObjects.Add(lamp.info.id, lamp); } + /// + /// Deserializes all lamp files for the mod. + /// private static void DeserializeLamps() { if (!Directory.Exists(Path.Combine(ModCore.ModHelper.DirectoryPath, "Content", LampsFolder))) Directory.CreateDirectory(Path.Combine(ModCore.ModHelper.DirectoryPath, "Content", LampsFolder)); @@ -144,7 +173,7 @@ namespace Revitalize.Framework.Factories.Objects } foreach (var v in objs) { - ModCore.customObjects.Add(v.Value.info.id, v.Value); + ModCore.ObjectManager.lamps.Add(v.Value.info.id, v.Value); } } @@ -255,6 +284,9 @@ namespace Revitalize.Framework.Factories.Objects ModCore.Serializer.SerializeContentFile("OakChair_0_0", bottom, Path.Combine(ChairFolder, "OakChair")); ModCore.Serializer.SerializeContentFile("OakChair", obj, Path.Combine(ChairFolder, "OakChair")); } + /// + /// Deserializes all chair files for the mod. + /// private static void DeserializeChairs() { if (!Directory.Exists(Path.Combine(ModCore.ModHelper.DirectoryPath, "Content", ChairFolder))) Directory.CreateDirectory(Path.Combine(ModCore.ModHelper.DirectoryPath, "Content", ChairFolder)); @@ -292,11 +324,14 @@ namespace Revitalize.Framework.Factories.Objects } foreach (var v in chairObjects) { - ModCore.customObjects.Add(v.Value.info.id, v.Value); + ModCore.ObjectManager.chairs.Add(v.Value.info.id, v.Value); } } } + /// + /// Creates an example table file for the mod. + /// private static void SerializeTableFiles() { TableTileComponent upperLeft = new TableTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Tables.OakTable", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Table"), typeof(TableTileComponent), Color.White), new BasicItemInformation("Oak Table", "Omegasis.Revitalize.Furniture.Tables.OakTable", "A simple wooden table to place objects on.", "Tables", Color.Brown, -300, 0, false, 350, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Table"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Table"), new Animation(0, 0, 16, 16)), Color.White, true, null, null), new TableInformation(true)); @@ -329,6 +364,9 @@ namespace Revitalize.Framework.Factories.Objects } + /// + /// Deserailzes all table files for the mod. + /// private static void DeserializeTableFiles() { if (!Directory.Exists(Path.Combine(ModCore.ModHelper.DirectoryPath, "Content", TablesFolder))) Directory.CreateDirectory(Path.Combine(ModCore.ModHelper.DirectoryPath, "Content", TablesFolder)); @@ -367,21 +405,23 @@ namespace Revitalize.Framework.Factories.Objects } foreach (var v in chairObjects) { - ModCore.customObjects.Add(v.Value.info.id, v.Value); + ModCore.ObjectManager.tables.Add(v.Value.info.id, v.Value); } } } - + /// + /// Creates an example storage file for the mod. + /// private static void SerializeFurnitureStorageFiles() { - StorageFurnitureTile upperLeft = new StorageFurnitureTile(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Storage.OakCabinet", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), typeof(TableTileComponent), Color.White), new BasicItemInformation("Oak Cabinet", "Omegasis.Revitalize.Furniture.Storage.OakCabinet", "A beautiful oak cabinet to place objects inside of.", "Storage", Color.Brown, -300, 0, false, 350, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new Animation(0, 0, 16, 16)), Color.White, false, null, null)); - StorageFurnitureTile upperRight = new StorageFurnitureTile(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Storage.OakCabinet", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), typeof(TableTileComponent), Color.White), new BasicItemInformation("Oak Cabinet", "Omegasis.Revitalize.Furniture.Storage.OakCabinet", "A beautiful oak cabinet to place objects inside of.", "Storage", Color.Brown, -300, 0, false, 350, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new Animation(16, 0, 16, 16)), Color.White, false, null, null)); - StorageFurnitureTile bottomLeft = new StorageFurnitureTile(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Storage.OakCabinet", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), typeof(TableTileComponent), Color.White), new BasicItemInformation("Oak Cabinet", "Omegasis.Revitalize.Furniture.Storage.OakCabinet", "A beautiful oak cabinet to place objects inside of.", "Storage", Color.Brown, -300, 0, false, 350, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new Animation(0, 16, 16, 16)), Color.White, false, null, null)); - StorageFurnitureTile bottomRight = new StorageFurnitureTile(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Storage.OakCabinet", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), typeof(TableTileComponent), Color.White), new BasicItemInformation("Oak Cabinet", "Omegasis.Revitalize.Furniture.Storage.OakCabinet", "A beautiful oak cabinet to place objects inside of.", "Storage", Color.Brown, -300, 0, false, 350, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new Animation(16, 16, 16, 16)), Color.White, false, null, null)); + StorageFurnitureTile upperLeft = new StorageFurnitureTile(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Storage.OakCabinet", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), typeof(StorageFurnitureTile), Color.White), new BasicItemInformation("Oak Cabinet", "Omegasis.Revitalize.Furniture.Storage.OakCabinet", "A beautiful oak cabinet to place objects inside of.", "Storage", Color.Brown, -300, 0, false, 350, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new Animation(0, 0, 16, 16)), Color.White, false, null, null)); + StorageFurnitureTile upperRight = new StorageFurnitureTile(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Storage.OakCabinet", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), typeof(StorageFurnitureTile), Color.White), new BasicItemInformation("Oak Cabinet", "Omegasis.Revitalize.Furniture.Storage.OakCabinet", "A beautiful oak cabinet to place objects inside of.", "Storage", Color.Brown, -300, 0, false, 350, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new Animation(16, 0, 16, 16)), Color.White, false, null, null)); + StorageFurnitureTile bottomLeft = new StorageFurnitureTile(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Storage.OakCabinet", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), typeof(StorageFurnitureTile), Color.White), new BasicItemInformation("Oak Cabinet", "Omegasis.Revitalize.Furniture.Storage.OakCabinet", "A beautiful oak cabinet to place objects inside of.", "Storage", Color.Brown, -300, 0, false, 350, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new Animation(0, 16, 16, 16)), Color.White, false, null, null)); + StorageFurnitureTile bottomRight = new StorageFurnitureTile(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Storage.OakCabinet", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), typeof(StorageFurnitureTile), Color.White), new BasicItemInformation("Oak Cabinet", "Omegasis.Revitalize.Furniture.Storage.OakCabinet", "A beautiful oak cabinet to place objects inside of.", "Storage", Color.Brown, -300, 0, false, 350, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new Animation(16, 16, 16, 16)), Color.White, false, null, null)); - StorageFurnitureOBJ obj = new StorageFurnitureOBJ(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Storage.OakCabinet", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), typeof(TableTileComponent), Color.White), new BasicItemInformation("Oak Cabinet", "Omegasis.Revitalize.Furniture.Storage.OakCabinet", "A beautiful oak cabinet to place objects inside of.", "Storage", Color.Brown, -300, 0, false, 350, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new Animation(16, 16, 16, 16)), Color.White, false, new InventoryManager(9), null)); + StorageFurnitureOBJ obj = new StorageFurnitureOBJ(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Storage.OakCabinet", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), typeof(StorageFurnitureTile), Color.White), new BasicItemInformation("Oak Cabinet", "Omegasis.Revitalize.Furniture.Storage.OakCabinet", "A beautiful oak cabinet to place objects inside of.", "Storage", Color.Brown, -300, 0, false, 350, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new Animation(16, 16, 16, 16)), Color.White, false, new InventoryManager(9), null)); FactoryInfo uL = new FactoryInfo(upperLeft); FactoryInfo uR = new FactoryInfo(upperRight); @@ -406,6 +446,9 @@ namespace Revitalize.Framework.Factories.Objects } + /// + /// Deserializes the furniure files for the mod. + /// private static void DeserializeFurnitureStorageFiles() { if (!Directory.Exists(Path.Combine(ModCore.ModHelper.DirectoryPath, "Content", StorageFolder))) Directory.CreateDirectory(Path.Combine(ModCore.ModHelper.DirectoryPath, "Content", StorageFolder)); @@ -444,26 +487,49 @@ namespace Revitalize.Framework.Factories.Objects } foreach (var v in chairObjects) { - ModCore.customObjects.Add(v.Value.info.id, v.Value); + ModCore.ObjectManager.furnitureStorage.Add(v.Value.info.id, v.Value); } } } - + /// + /// Gets a chair from the object manager. + /// + /// + /// public static ChairMultiTiledObject GetChair(string name) { - return (ChairMultiTiledObject)ModCore.GetObjectFromPool(name); + return (ChairMultiTiledObject)ModCore.ObjectManager.getChair(name); } + /// + /// Gets a table from the object manager. + /// + /// + /// public static TableMultiTiledObject GetTable(string name) { - return (TableMultiTiledObject)ModCore.GetObjectFromPool(name); + return (TableMultiTiledObject)ModCore.ObjectManager.getTable(name); } + + /// + /// Gets a lamp from the object manager. + /// + /// + /// public static LampMultiTiledObject GetLamp(string name) { - return (LampMultiTiledObject)ModCore.GetObjectFromPool(name); + return (LampMultiTiledObject)ModCore.ObjectManager.getLamp(name); } - + /// + /// Gets a furniture storage file for the mod. + /// + /// + /// + public static StorageFurnitureOBJ GetFurnitureStorage(string name) + { + return (StorageFurnitureOBJ)ModCore.ObjectManager.getStorageFuriture(name); + } } } diff --git a/GeneralMods/Revitalize/Framework/Objects/BasicItemInformation.cs b/GeneralMods/Revitalize/Framework/Objects/BasicItemInformation.cs index 6b56a881..e233ade3 100644 --- a/GeneralMods/Revitalize/Framework/Objects/BasicItemInformation.cs +++ b/GeneralMods/Revitalize/Framework/Objects/BasicItemInformation.cs @@ -18,7 +18,6 @@ namespace Revitalize.Framework.Objects public string categoryName; public Color categoryColor; public int price; - public Vector2 TileLocation; public int edibility; public int fragility; public bool canBeSetIndoors; @@ -46,7 +45,6 @@ namespace Revitalize.Framework.Objects this.categoryName = ""; this.categoryColor = new Color(0, 0, 0); this.price = 0; - this.TileLocation = Vector2.Zero; this.edibility = -300; this.canBeSetIndoors = false; this.canBeSetOutdoors = false; @@ -70,7 +68,6 @@ namespace Revitalize.Framework.Objects this.categoryName = categoryName; this.categoryColor = categoryColor; this.price = price; - this.TileLocation = TileLocation; this.edibility = edibility; this.canBeSetOutdoors = canBeSetOutdoors; diff --git a/GeneralMods/Revitalize/Framework/Objects/InformationFiles/ResourceInformaton.cs b/GeneralMods/Revitalize/Framework/Objects/InformationFiles/ResourceInformaton.cs new file mode 100644 index 00000000..b3b5cff4 --- /dev/null +++ b/GeneralMods/Revitalize/Framework/Objects/InformationFiles/ResourceInformaton.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using StardewValley; + +namespace Revitalize.Framework.Objects.InformationFiles +{ + /// + /// Deals with information reguarding resources. + /// + public class ResourceInformaton + { + /// + /// The item to drop. + /// + public Item droppedItem; + /// + /// The min amount to drop. + /// + public int minDropAmount; + /// + /// The max amount to drop. + /// + public int maxDropAmount; + + /// + /// Empty constructor. + /// + public ResourceInformaton() + { + + } + + /// + /// Constructor. + /// + /// The item to drop. + /// The min amount to drop. + /// The max amount to drop. + public ResourceInformaton(Item I, int Min, int Max) + { + this.droppedItem = I; + this.minDropAmount = Min; + this.maxDropAmount = Max; + } + } +} diff --git a/GeneralMods/Revitalize/Framework/Objects/ObjectManager.cs b/GeneralMods/Revitalize/Framework/Objects/ObjectManager.cs index 9bc98292..90b5bd10 100644 --- a/GeneralMods/Revitalize/Framework/Objects/ObjectManager.cs +++ b/GeneralMods/Revitalize/Framework/Objects/ObjectManager.cs @@ -9,6 +9,9 @@ using StardewValley; namespace Revitalize.Framework.Objects { + /// + /// Deals with handling all objects for the mod. + /// public class ObjectManager { /// @@ -38,6 +41,15 @@ namespace Revitalize.Framework.Objects /// All of the rugs held by this object pool. /// public Dictionary rugs; + public Dictionary furnitureStorage; + + public Dictionary generic; + /// + /// Misc. items for this mod. + /// + public Dictionary miscellaneous; + + public ResourceManager resources; /// /// Constructor. @@ -66,6 +78,12 @@ namespace Revitalize.Framework.Objects this.tables = new Dictionary(); this.lamps = new Dictionary(); this.rugs = new Dictionary(); + this.furnitureStorage = new Dictionary(); + + this.generic = new Dictionary(); + this.miscellaneous = new Dictionary(); + + this.resources = new ResourceManager(); } /// @@ -85,6 +103,7 @@ namespace Revitalize.Framework.Objects return objs[rand].getOne(); } + /// /// Gets an object from the dictionary that is passed in. /// @@ -102,6 +121,86 @@ namespace Revitalize.Framework.Objects throw new Exception("Object pool doesn't contain said object."); } } + + + public Item getObject(string objectName, Dictionary dictionary) + { + if (dictionary.ContainsKey(objectName)) + { + return dictionary[objectName].getOne(); + } + else + { + throw new Exception("Object pool doesn't contain said object."); + } + } + + /// + /// Gets a chair from the object manager. + /// + /// + /// + public ChairMultiTiledObject getChair(string name) + { + if (this.chairs.ContainsKey(name)) + { + return (ChairMultiTiledObject)this.chairs[name].getOne(); + } + else + { + throw new Exception("Object pool doesn't contain said object."); + } + } + /// + /// Gets a table from the object manager. + /// + /// + /// + public TableMultiTiledObject getTable(string name) + { + if (this.tables.ContainsKey(name)) + { + return (TableMultiTiledObject)this.tables[name].getOne(); + } + else + { + throw new Exception("Object pool doesn't contain said object."); + } + } + + /// + /// Gets a lamp from the object manager. + /// + /// + /// + public LampMultiTiledObject getLamp(string name) + { + if (this.lamps.ContainsKey(name)) + { + return (LampMultiTiledObject)this.lamps[name].getOne(); + } + else + { + throw new Exception("Object pool doesn't contain said object."); + } + } + + /// + /// Gets storage furniture from the object manager. + /// + /// + /// + public StorageFurnitureOBJ getStorageFuriture(string name) + { + if (this.furnitureStorage.ContainsKey(name)) + { + return (StorageFurnitureOBJ)this.furnitureStorage[name].getOne(); + } + else + { + throw new Exception("Object pool doesn't contain said object."); + } + } /// /// Adds a new object manager to the master pool of managers. diff --git a/GeneralMods/Revitalize/Framework/Objects/ResourceManager.cs b/GeneralMods/Revitalize/Framework/Objects/ResourceManager.cs new file mode 100644 index 00000000..a0f3a89f --- /dev/null +++ b/GeneralMods/Revitalize/Framework/Objects/ResourceManager.cs @@ -0,0 +1,107 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using Revitalize.Framework.Objects.Resources.OreVeins; +using Revitalize.Framework.Utilities; +using StardewValley; +using StardustCore.Animations; +using StardustCore.UIUtilities; + +namespace Revitalize.Framework.Objects +{ + public class ResourceManager + { + /// + /// A static reference to the resource manager for quicker access. + /// + public static ResourceManager self; + + /// + /// A list of all of the ores held by the resource manager. + /// + public Dictionary ores; + + /// + /// Constructor. + /// + public ResourceManager() + { + self = this; + this.ores = new Dictionary(); + this.loadOreVeins(); + } + + /// + /// Loads in all of the ore veins for the game. + /// + private void loadOreVeins() + { + //The pancake ore. + + + OreVeinObj testOre = new OreVeinObj(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Resources.Ore.Test", TextureManager.GetTexture(ModCore.Manifest, "Resources.Ore", "Test"), typeof(OreVeinTile), Color.White), new BasicItemInformation("Test Ore Vein", "Omegasis.Revitalize.Resources.Ore.Test", "A ore vein that is used for testing purposes.", "Revitalize.Ore", Color.Black, -300, 0, false, 350, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Resources.Ore", "Test"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Resources.Ore", "Test"), new Animation(0, 0, 16, 16)), Color.White, false, null, null)); + testOre.addComponent(new Vector2(0, 0), new OreVeinTile(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Resources.Ore.Test", TextureManager.GetTexture(ModCore.Manifest, "Resources.Ore", "Test"), typeof(OreVeinTile), Color.White), new BasicItemInformation("Test Ore Vein", "Omegasis.Revitalize.Resources.Ore.Test", "A ore vein that is used for testing purposes.", "Revitalize.Ore", Color.Black, -300, 0, false, 350, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Resources.Ore", "Test"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Resources.Ore", "Test"), new Animation(0, 0, 16, 16)), Color.White, false, null, null), new InformationFiles.ResourceInformaton(new StardewValley.Object(211, 1), 1, 10))); + this.ores.Add("Test",testOre); + } + + /// + /// Spawns an ore vein at the given location if possible. + /// + /// + public bool spawnOreVein(string name,GameLocation Location, Vector2 TilePosition) + { + if (this.ores.ContainsKey(name)) + { + OreVeinObj spawn; + this.ores.TryGetValue(name, out spawn); + if (spawn != null) + { + spawn = (OreVeinObj)spawn.getOne(); + bool spawnable = this.canResourceBeSpawnedHere(spawn, Location, TilePosition); + if (spawnable) + { + spawn.placementAction(Location, (int)TilePosition.X, (int)TilePosition.Y); + ModCore.log("This works!"); + } + else + { + ModCore.log("Can't spawn ore: " + name + "at tile location: " + TilePosition); + } + return spawnable; + } + ModCore.log("Key doesn't exist. Weird."); + return false; + } + else + { + throw new Exception("The ore dictionary doesn't contain they key for resource: " + name); + } + } + /// + /// Spawns an orevein at the tile position at the same location as the player. + /// + /// + /// + /// + public bool spawnOreVein(string name, Vector2 TilePosition) + { + return this.spawnOreVein(name, Game1.player.currentLocation, TilePosition); + } + + /// + /// Checks to see if a resource can be spawned here. + /// + /// + /// + /// + /// + public bool canResourceBeSpawnedHere(StardewValley.Object OBJ,GameLocation Location, Vector2 TilePosition) + { + return OBJ.canBePlacedHere(Location, TilePosition); + } + + } +} diff --git a/GeneralMods/Revitalize/Framework/Objects/Resources/OreVeins/OreVeinObj.cs b/GeneralMods/Revitalize/Framework/Objects/Resources/OreVeins/OreVeinObj.cs new file mode 100644 index 00000000..59d74088 --- /dev/null +++ b/GeneralMods/Revitalize/Framework/Objects/Resources/OreVeins/OreVeinObj.cs @@ -0,0 +1,146 @@ +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 PyTK.CustomElementHandler; +using StardewValley; + +namespace Revitalize.Framework.Objects.Resources.OreVeins +{ + public class OreVeinObj:MultiTiledObject + { + public OreVeinObj() : base() + { + + } + + public OreVeinObj(CustomObjectData PyTKData, BasicItemInformation Info) : base(PyTKData, Info) + { + + } + + public OreVeinObj(CustomObjectData PyTKData, BasicItemInformation Info, Vector2 TilePosition) : base(PyTKData, Info, TilePosition) + { + + } + + public OreVeinObj(CustomObjectData PyTKData, BasicItemInformation Info, Vector2 TilePosition, Dictionary Objects) : base(PyTKData, Info, TilePosition, Objects) + { + + + } + + public override void rotate() + { + base.rotate(); + } + + public override Item getOne() + { + Dictionary objs = new Dictionary(); + foreach (var pair in this.objects) + { + objs.Add(pair.Key, (MultiTiledComponent)pair.Value.getOne()); + } + + + return new OreVeinObj(this.data, this.info, this.TileLocation, objs); + } + + + public override ICustomObject recreate(Dictionary additionalSaveData, object replacement) + { + OreVeinObj obj = (OreVeinObj)Revitalize.ModCore.Serializer.DeserializeGUID(additionalSaveData["GUID"]); + if (obj == null) + { + return null; + } + + Dictionary guids = new Dictionary(); + + foreach (KeyValuePair pair in obj.childrenGuids) + { + guids.Add(pair.Key, pair.Value); + } + + foreach (KeyValuePair pair in guids) + { + obj.childrenGuids.Remove(pair.Key); + //Revitalize.ModCore.log("DESERIALIZE: " + pair.Value.ToString()); + OreVeinTile component = Revitalize.ModCore.Serializer.DeserializeGUID(pair.Value.ToString()); + component.InitNetFields(); + + obj.addComponent(pair.Key, component); + + + } + obj.InitNetFields(); + + if (!Revitalize.ModCore.ObjectGroups.ContainsKey(additionalSaveData["GUID"])) + { + Revitalize.ModCore.ObjectGroups.Add(additionalSaveData["GUID"], obj); + return obj; + } + else + { + return Revitalize.ModCore.ObjectGroups[additionalSaveData["GUID"]]; + } + + + } + + + public override bool canBePlacedHere(GameLocation l, Vector2 tile) + { + return base.canBePlacedHere(l, tile); + } + + public override void drawPlacementBounds(SpriteBatch spriteBatch, GameLocation location) + { + foreach (KeyValuePair pair in this.objects) + { + if (!this.isPlaceable()) + return; + int x = Game1.getOldMouseX() + Game1.viewport.X + (int)((pair.Value as MultiTiledComponent).offsetKey.X * Game1.tileSize); + int y = Game1.getOldMouseY() + Game1.viewport.Y + (int)((pair.Value as MultiTiledComponent).offsetKey.Y * Game1.tileSize); + if ((double)Game1.mouseCursorTransparency == 0.0) + { + x = ((int)Game1.player.GetGrabTile().X + (int)((pair.Value as MultiTiledComponent).offsetKey.X)) * 64; + y = ((int)Game1.player.GetGrabTile().Y + (int)((pair.Value as MultiTiledComponent).offsetKey.Y)) * 64; + } + if (Game1.player.GetGrabTile().Equals(Game1.player.getTileLocation()) && (double)Game1.mouseCursorTransparency == 0.0) + { + Vector2 translatedVector2 = Utility.getTranslatedVector2(Game1.player.GetGrabTile(), Game1.player.FacingDirection, 1f); + translatedVector2 += (pair.Value as MultiTiledComponent).offsetKey; + x = (int)translatedVector2.X * 64; + y = (int)translatedVector2.Y * 64; + } + bool flag = (pair.Value as MultiTiledComponent).canBePlacedHere(location, new Vector2(x / Game1.tileSize, y / Game1.tileSize)); + spriteBatch.Draw(Game1.mouseCursors, new Vector2((float)(x / 64 * 64 - Game1.viewport.X), (float)(y / 64 * 64 - Game1.viewport.Y)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(flag ? 194 : 210, 388, 16, 16)), Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.01f); + + + (pair.Value as MultiTiledComponent).draw(spriteBatch, x / Game1.tileSize, y / Game1.tileSize, 0.5f); + //break; + //this.draw(spriteBatch, x / 64, y / 64, 0.5f); + } + } + + public override void pickUp() + { + return; //Don't pick up ore veins! + bool canPickUp = this.removeAndAddToPlayersInventory(); + if (canPickUp) + { + foreach (KeyValuePair pair in this.objects) + { + (pair.Value as OreVeinTile).removeFromLocation((pair.Value as OreVeinTile).location, pair.Key); + } + this.location = null; + } + + } + } +} diff --git a/GeneralMods/Revitalize/Framework/Objects/Resources/OreVeins/OreVeinTile.cs b/GeneralMods/Revitalize/Framework/Objects/Resources/OreVeins/OreVeinTile.cs new file mode 100644 index 00000000..ac49ccbf --- /dev/null +++ b/GeneralMods/Revitalize/Framework/Objects/Resources/OreVeins/OreVeinTile.cs @@ -0,0 +1,268 @@ +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 Microsoft.Xna.Framework.Input; +using PyTK.CustomElementHandler; +using Revitalize.Framework.Objects.InformationFiles; +using Revitalize.Framework.Utilities.Serialization; +using StardewValley; + +namespace Revitalize.Framework.Objects.Resources.OreVeins +{ + public class OreVeinTile:MultiTiledComponent + { + /// + /// Deals with information tied to the resource itself. + /// + public ResourceInformaton resourceInfo; + + public OreVeinTile() : base() + { + + } + + public OreVeinTile(CustomObjectData PyTKData, BasicItemInformation Info,ResourceInformaton Resource) : base(PyTKData, Info) + { + this.health = 3; + this.resourceInfo = Resource; + } + + public OreVeinTile(CustomObjectData PyTKData, BasicItemInformation Info, Vector2 TileLocation,ResourceInformaton Resource) : base(PyTKData, Info, TileLocation) + { + + this.health = 3; + this.resourceInfo = Resource; + } + + + public override bool performObjectDropInAction(Item dropInItem, bool probe, Farmer who) + { + return false; //this.pickUpItem()==PickUpState.DoNothing; + //return base.performObjectDropInAction(dropInItem, probe, who); + } + + public override bool performDropDownAction(Farmer who) + { + return base.performDropDownAction(who); + } + + //Checks for any sort of interaction IF and only IF there is a held object on this tile. + public override bool checkForAction(Farmer who, bool justCheckingForActivity = false) + { + MouseState mState = Mouse.GetState(); + KeyboardState keyboardState = Game1.GetKeyboardState(); + + if (mState.RightButton == ButtonState.Pressed && (!keyboardState.IsKeyDown(Keys.LeftShift) || !keyboardState.IsKeyDown(Keys.RightShift))) + { + return this.rightClicked(who); + } + + if (mState.RightButton == ButtonState.Pressed && (keyboardState.IsKeyDown(Keys.LeftShift) || keyboardState.IsKeyDown(Keys.RightShift))) + return this.shiftRightClicked(who); + + + //return base.checkForAction(who, justCheckingForActivity); + + if (justCheckingForActivity) + return true; + + return true; + + //return this.clicked(who); + //return false; + } + + public override bool performToolAction(Tool t, GameLocation location) + { + + if(t is StardewValley.Tools.Pickaxe) + { + ModCore.log("Hit the ore vein with a pickaxe!"); + this.damage((t as StardewValley.Tools.Pickaxe).UpgradeLevel+1); + if (this.location != null) + { + this.location.playSound("hammer"); + ModCore.log("Ore has this much health left: "+this.health); + } + return false; + } + else + { + return false; + } + + //return base.performToolAction(t, location); + } + + public override bool onExplosion(Farmer who, GameLocation location) + { + this.destoryVein(); + return true; + //return base.onExplosion(who, location); + } + + public void damage(int amount) + { + if (amount <= 0) return; + else + { + this.health -= amount; + if (this.health <= 0) + { + this.destoryVein(); + } + } + } + + public void destoryVein() + { + int amount = Game1.random.Next(this.resourceInfo.minDropAmount, this.resourceInfo.maxDropAmount); + Item newItem = this.resourceInfo.droppedItem.getOne(); + for(int i = 0; i < amount; i++) + { + Game1.createItemDebris(newItem, this.TileLocation*Game1.tileSize, Game1.random.Next(0, 3), this.location); + } + if (this.location != null) + { + this.location.playSound("stoneCrack"); + this.location.removeObject(this.TileLocation, false); + } + } + + public override bool performUseAction(GameLocation location) + { + return base.performUseAction(location); + } + + /// + /// Gets called when there is no actively held item on the tile. + /// + /// + /// + public override bool clicked(Farmer who) + { + + return false; + } + + public override bool rightClicked(Farmer who) + { + return false; + } + + + public override bool shiftRightClicked(Farmer who) + { + return base.shiftRightClicked(who); + } + + + public override Item getOne() + { + OreVeinTile component = new OreVeinTile(this.data, this.info,this.resourceInfo); + component.containerObject = this.containerObject; + component.offsetKey = this.offsetKey; + 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 + + + + Vector2 offsetKey = new Vector2(Convert.ToInt32(additionalSaveData["offsetKeyX"]), Convert.ToInt32(additionalSaveData["offsetKeyY"])); + OreVeinTile self = Revitalize.ModCore.Serializer.DeserializeGUID(additionalSaveData["GUID"]); + if (self == null) + { + return null; + } + + if (!Revitalize.ModCore.ObjectGroups.ContainsKey(additionalSaveData["ParentGUID"])) + { + //Get new container + OreVeinObj obj = (OreVeinObj)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"], 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; + + //throw new Exception("Why am I trying to recreate an ore vein?"); + } + + public override Dictionary getAdditionalSaveData() + { + Dictionary saveData = base.getAdditionalSaveData(); + Revitalize.ModCore.Serializer.SerializeGUID(this.containerObject.childrenGuids[this.offsetKey].ToString(), this); + + return saveData; + + } + + /// 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 == 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.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?!?!?!?!"); + } + + else + { + //Log.AsyncC("Animation Manager is working!"); + float addedDepth = 0; + + + if (Revitalize.ModCore.playerInfo.sittingInfo.SittingObject == this.containerObject && this.info.facingDirection == Enums.Direction.Up) + { + addedDepth += (this.containerObject.Height - 1) - ((int)(this.offsetKey.Y)); + if (this.info.ignoreBoundingBox) addedDepth += 1.5f; + } + else if (this.info.ignoreBoundingBox) + { + 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); + try + { + this.animationManager.tickAnimation(); + // Log.AsyncC("Tick animation"); + } + catch (Exception err) + { + ModCore.ModMonitor.Log(err.ToString()); + } + if (this.heldObject.Value != null) SpriteBatchUtilities.Draw(spriteBatch, this, this.heldObject.Value, alpha, addedDepth); + } + } + + + } +} diff --git a/GeneralMods/Revitalize/ModCore.cs b/GeneralMods/Revitalize/ModCore.cs index 79e80a57..95eba6ab 100644 --- a/GeneralMods/Revitalize/ModCore.cs +++ b/GeneralMods/Revitalize/ModCore.cs @@ -142,6 +142,7 @@ namespace Revitalize // HorseRace Minigame/Betting? // // Locations: + -Make extra bus stop sign that travels between new towns/locations. // -Small Island Home? // -New town inspired by FOMT;Mineral Town/The Valley HM DS // @@ -171,8 +172,15 @@ namespace Revitalize public static IMonitor ModMonitor; public static IManifest Manifest; - public static Dictionary customObjects; + /// + /// Keeps track of custom objects. REPLACE THIS WITH RESOUCE MANAGER. + /// + //public static Dictionary customObjects; + public static ObjectManager ObjectManager; + /// + /// Keeps track of all of the extra object groups. + /// public static Dictionary ObjectGroups; public static PlayerInfo playerInfo; @@ -198,9 +206,11 @@ namespace Revitalize playerInfo = new PlayerInfo(); TextureManager.AddTextureManager(Manifest, "Furniture"); - TextureManager.GetTextureManager(Manifest, "Furniture").searchForTextures(ModHelper, this.ModManifest, Path.Combine("Content", "Graphics", "Furniture")); + TextureManager.GetTextureManager(Manifest, "Furniture").searchForTextures(ModHelper, this.ModManifest, Path.Combine("Content", "Graphics", "Objects","Furniture")); TextureManager.AddTextureManager(Manifest, "InventoryMenu"); 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.addTexture("Furniture","Oak Chair", new Texture2DExtended(this.Helper, this.ModManifest, Path.Combine("Content","Graphics","Furniture", "Chairs", "Oak Chair.png"))); //Framework.Graphics.TextureManager.TextureManagers.Add("Furniture", new TextureManager(this.Helper.DirectoryPath, Path.Combine("Content", "Graphics", "Furniture"))); @@ -211,9 +221,10 @@ namespace Revitalize //TextureManager.addTexture("Furniture", "Oak Table", new Texture2DExtended(this.Helper, this.ModManifest, Path.Combine("Content", "Graphics", "Furniture", "Tables", "Oak Table.png"))); //TextureManager.addTexture("Furniture", "Oak Lamp", new Texture2DExtended(this.Helper, this.ModManifest, Path.Combine("Content", "Graphics", "Furniture", "Lamps", "Oak Lamp.png"))); - customObjects = new Dictionary(); - ObjectGroups = new Dictionary(); + //customObjects = new Dictionary(); + ObjectGroups = new Dictionary(); + ObjectManager = new ObjectManager(); Serializer = new Serializer(); ObjectsToDraw = new Dictionary(); @@ -269,7 +280,7 @@ namespace Revitalize [bigObject] = 1 }, new KeyValuePair(new Furniture(3, Vector2.Zero), 1), new StatCost(100, 50, 0, 0)); - customObjects.Add("Omegasis.BigTiledTest", bigObject); + ObjectManager.miscellaneous.Add("Omegasis.BigTiledTest", bigObject); Framework.Objects.Furniture.RugTileComponent rug1 = new RugTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Basic.Rugs.TestRug", TextureManager.GetTexture(Manifest, "Furniture", "Oak Chair"), typeof(RugTileComponent), Color.White), new BasicItemInformation("Rug Tile", "Omegasis.Revitalize.Furniture.Basic.Rugs.TestRug", "A rug tile", "Rug", Color.Brown, -300, 0, false, 100, Vector2.Zero, true, true, TextureManager.GetTexture(Manifest, "Furniture", "Oak Chair"), new AnimationManager(TextureManager.GetExtendedTexture(Manifest, "Furniture", "Oak Chair"), new Animation(new Rectangle(0, 0, 16, 16))), Color.White, true, null, null)); @@ -278,7 +289,7 @@ namespace Revitalize rug.addComponent(new Vector2(0, 0), rug1); - customObjects.Add("Omegasis.Revitalize.Furniture.Rugs.RugTest", rug); + ObjectManager.miscellaneous.Add("Omegasis.Revitalize.Furniture.Rugs.RugTest", rug); @@ -311,7 +322,7 @@ namespace Revitalize sscCabinet.addComponent(new Vector2(0, 1), ssc2); - customObjects.Add("Omegasis.Revitalize.Furniture.Arcade.SeasideScramble", sscCabinet); + ObjectManager.miscellaneous.Add("Omegasis.Revitalize.Furniture.Arcade.SeasideScramble", sscCabinet); ModCore.log("Added in SSC!"); } @@ -362,19 +373,22 @@ namespace Revitalize //Game1.player.addItemToInventory(GetObjectFromPool("Omegasis.Revitalize.Furniture.Chairs.OakChair")); //Game1.player.addItemToInventory(GetObjectFromPool("Omegasis.Revitalize.Furniture.Rugs.RugTest")); //Game1.player.addItemToInventory(GetObjectFromPool("Omegasis.Revitalize.Furniture.Tables.OakTable")); - Game1.player.addItemToInventory(GetObjectFromPool("Omegasis.Revitalize.Furniture.Lamps.OakLamp")); + Game1.player.addItemToInventory(ObjectManager.getLamp("Omegasis.Revitalize.Furniture.Lamps.OakLamp")); - Game1.player.addItemToInventory(GetObjectFromPool("Omegasis.Revitalize.Furniture.Arcade.SeasideScramble")); - Game1.player.addItemToInventory(GetObjectFromPool("Omegasis.Revitalize.Furniture.Storage.OakCabinet")); + //Game1.player.addItemToInventory(ObjectManager.getObject("Omegasis.Revitalize.Furniture.Arcade.SeasideScramble",ObjectManager.miscellaneous)); + //Game1.player.addItemToInventory(ObjectManager.getStorageFuriture("Omegasis.Revitalize.Furniture.Storage.OakCabinet")); /* StardewValley.Tools.Axe axe = new StardewValley.Tools.Axe(); Serializer.Serialize(Path.Combine(this.Helper.DirectoryPath, "AXE.json"), axe); axe =(StardewValley.Tools.Axe)Serializer.Deserialize(Path.Combine(this.Helper.DirectoryPath, "AXE.json"),typeof(StardewValley.Tools.Axe)); //Game1.player.addItemToInventory(axe); */ + //Game1.player.addItemToInventory(ObjectManager.resources.ores["Test"].getOne()); + ObjectManager.resources.spawnOreVein("Test", new Vector2(4, 4)); } + /* public static Item GetObjectFromPool(string objName) { if (customObjects.ContainsKey(objName)) @@ -387,16 +401,15 @@ namespace Revitalize throw new Exception("Object Key name not found: " + objName); } } + */ - + /// + ///Logs information to the console. + /// + /// public static void log(object message) { ModMonitor.Log(message.ToString()); } - - public static string generatePlaceholderString() - { - return "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048"; - } } } diff --git a/GeneralMods/Revitalize/Revitalize.csproj b/GeneralMods/Revitalize/Revitalize.csproj index 9ab71dfe..ceaf2c71 100644 --- a/GeneralMods/Revitalize/Revitalize.csproj +++ b/GeneralMods/Revitalize/Revitalize.csproj @@ -124,9 +124,13 @@ + + + + @@ -147,6 +151,7 @@ + Always @@ -159,21 +164,6 @@ - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - Always @@ -192,6 +182,24 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + Always