diff --git a/GeneralMods/Revitalize/Framework/Factories/Objects/Furniture/ChairFactoryInfo.cs b/GeneralMods/Revitalize/Framework/Factories/Objects/Furniture/ChairFactoryInfo.cs new file mode 100644 index 00000000..581a5601 --- /dev/null +++ b/GeneralMods/Revitalize/Framework/Factories/Objects/Furniture/ChairFactoryInfo.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Revitalize.Framework.Objects; +using Revitalize.Framework.Objects.Furniture; +using Revitalize.Framework.Objects.InformationFiles.Furniture; + +namespace Revitalize.Framework.Factories.Objects.Furniture +{ + public class ChairFactoryInfo + { + public ChairInformation chairInfo; + public BasicItemInformation itemInfo; + + public ChairFactoryInfo() + { + + } + + public ChairFactoryInfo(ChairMultiTiledObject chair) + { + this.chairInfo = null; + this.itemInfo = chair.info; + } + + public ChairFactoryInfo(ChairTileComponent chair) + { + this.chairInfo = chair.furnitureInfo; + this.itemInfo = chair.info; + } + + } +} diff --git a/GeneralMods/Revitalize/Framework/Factories/Objects/FurnitureFactory.cs b/GeneralMods/Revitalize/Framework/Factories/Objects/FurnitureFactory.cs new file mode 100644 index 00000000..17c75c9a --- /dev/null +++ b/GeneralMods/Revitalize/Framework/Factories/Objects/FurnitureFactory.cs @@ -0,0 +1,170 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using Revitalize.Framework.Factories.Objects.Furniture; +using Revitalize.Framework.Graphics; +using Revitalize.Framework.Graphics.Animations; +using Revitalize.Framework.Illuminate; +using Revitalize.Framework.Objects; +using Revitalize.Framework.Objects.Furniture; + +namespace Revitalize.Framework.Factories.Objects +{ + public class FurnitureFactory + { + public static string ChairFolder = Path.Combine("Objects", "Furniture", "Chairs"); + + + public static void LoadChairFiles() + { + SerializeChairs(); + DeserializeChairs(); + } + public static void SerializeChairs() + { + Framework.Objects.Furniture.ChairTileComponent chairTop = new Framework.Objects.Furniture.ChairTileComponent(new BasicItemInformation("Oak Chair", "A basic wooden chair", "Chairs", Color.Brown, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.Revitalize.Furniture.Chairs.OakChair", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", Framework.Graphics.TextureManager.TextureManagers["Furniture"].getTexture("Oak Chair").texture, Color.White, 0, true, typeof(Framework.Objects.Furniture.ChairTileComponent), null, new AnimationManager(TextureManager.TextureManagers["Furniture"].getTexture("Oak Chair"), new Animation(new Rectangle(0, 0, 16, 16)), new Dictionary>() { + { "Default_" + (int)Framework.Enums.Direction.Down , new List() + { + new Animation(new Rectangle(0,0,16,16)) + } + }, + { "Sitting_" + (int)Framework.Enums.Direction.Down , new List() + { + new Animation(new Rectangle(0,0,16,16)) + } + }, + { "Default_" + (int)Framework.Enums.Direction.Right , new List() + { + new Animation(new Rectangle(16,0,16,16)) + } + }, + { "Sitting_" + (int)Framework.Enums.Direction.Right , new List() + { + new Animation(new Rectangle(16,0,16,16)) + } + }, + { "Default_" + (int)Framework.Enums.Direction.Up , new List() + { + new Animation(new Rectangle(32,0,16,16)) + } + }, + { "Sitting_" + (int)Framework.Enums.Direction.Up , new List() + { + new Animation(new Rectangle(32,32,16,32)) + } + }, + { "Default_" + (int)Framework.Enums.Direction.Left , new List() + { + new Animation(new Rectangle(48,0,16,16)) + } + }, + { "Sitting_" + (int)Framework.Enums.Direction.Left , new List() + { + new Animation(new Rectangle(48,0,16,16)) + } + } + }, "Default_" + (int)Framework.Enums.Direction.Down), Color.White, true, new Framework.Utilities.InventoryManager(), new LightManager()), new Framework.Objects.InformationFiles.Furniture.ChairInformation(false)); + Framework.Objects.Furniture.ChairTileComponent chairBottom = new Framework.Objects.Furniture.ChairTileComponent(new BasicItemInformation("Oak Chair", "A basic wooden chair", "Chairs", Color.Brown, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.Revitalize.Furniture.Chairs.OakChair", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", Framework.Graphics.TextureManager.TextureManagers["Furniture"].getTexture("Oak Chair").texture, Color.White, 0, true, typeof(Framework.Objects.Furniture.ChairTileComponent), null, new AnimationManager(TextureManager.TextureManagers["Furniture"].getTexture("Oak Chair"), new Animation(new Rectangle(0, 16, 16, 16)), new Dictionary>() { + { "Default_" + (int)Framework.Enums.Direction.Down , new List() + { + new Animation(new Rectangle(0,16,16,16)) + } + }, + { "Sitting_" + (int)Framework.Enums.Direction.Down , new List() + { + new Animation(new Rectangle(0,16,16,16)) + } + }, + { "Default_" + (int)Framework.Enums.Direction.Right , new List() + { + new Animation(new Rectangle(16,16,16,16)) + } + }, + { "Sitting_" + (int)Framework.Enums.Direction.Right , new List() + { + new Animation(new Rectangle(16,16,16,16)) + } + }, + { "Default_" + (int)Framework.Enums.Direction.Up , new List() + { + new Animation(new Rectangle(32,16,16,16)) + } + }, + { "Sitting_" + (int)Framework.Enums.Direction.Up , new List() + { + new Animation(new Rectangle(48,32,16,32)) + } + }, + { "Default_" + (int)Framework.Enums.Direction.Left , new List() + { + new Animation(new Rectangle(48,16,16,16)) + } + }, + { "Sitting" + (int)Framework.Enums.Direction.Left , new List() + { + new Animation(new Rectangle(48,16,16,16)) + } + } + }, "Default_" + (int)Framework.Enums.Direction.Down), Color.White, false, new Framework.Utilities.InventoryManager(), new LightManager()), new Framework.Objects.InformationFiles.Furniture.ChairInformation(true)); + Framework.Objects.Furniture.ChairMultiTiledObject oakChair = new Framework.Objects.Furniture.ChairMultiTiledObject(new BasicItemInformation("Oak Chair", "A wood chair you can place anywhere.", "Chair", Color.White, -300, 0, true, 100, Vector2.Zero, true, true, "Omegasis.Revitalize.Furniture.Chairs.OakChair", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", TextureManager.TextureManagers["Furniture"].getTexture("Oak Chair").texture, Color.White, 0, true, typeof(Revitalize.Framework.Objects.Furniture.ChairMultiTiledObject), null, new AnimationManager(), Color.White, false, new Framework.Utilities.InventoryManager(), new LightManager())); + + ChairFactoryInfo top = new ChairFactoryInfo(chairTop); + ChairFactoryInfo bottom = new ChairFactoryInfo(chairBottom); + ChairFactoryInfo obj = new ChairFactoryInfo(oakChair); + + + ModCore.Serializer.SerializeContentFile("OakChair_0_-1", top, ChairFolder); + ModCore.Serializer.SerializeContentFile("OakChair_0_0", bottom, ChairFolder); + ModCore.Serializer.SerializeContentFile("OakChair", obj, ChairFolder); + } + public static void DeserializeChairs() + { + if (!Directory.Exists(Path.Combine(ModCore.ModHelper.DirectoryPath, "Content", ChairFolder))) Directory.CreateDirectory(Path.Combine(ModCore.ModHelper.DirectoryPath, "Content", ChairFolder)); + string[] files = Directory.GetFiles(Path.Combine(ModCore.ModHelper.DirectoryPath, "Content", ChairFolder)); + + Dictionary chairObjects = new Dictionary(); + + //Deserialize container. + foreach (string file in files) + { + if ((Path.GetFileName(file)).Contains("_")==true) continue; + else + { + chairObjects.Add(Path.GetFileNameWithoutExtension(file), new ChairMultiTiledObject(ModCore.Serializer.DeserializeContentFile(file).itemInfo)); + } + } + //Deseralize components + foreach (string file in files) + { + if ((Path.GetFileName(file)).Contains("_")==false) continue; + else + { + + string[] splits = Path.GetFileNameWithoutExtension(file).Split('_'); + string name = splits[0]; + Vector2 offset = new Vector2(Convert.ToInt32(splits[1]), Convert.ToInt32(splits[2])); + ChairFactoryInfo info = ModCore.Serializer.DeserializeContentFile(file); + chairObjects[name].addComponent(offset, new ChairTileComponent(info.itemInfo, info.chairInfo)); + } + } + foreach (var v in chairObjects) + { + ModCore.customObjects.Add(v.Value.info.id, v.Value); + } + } + + public static ChairMultiTiledObject GetChair(string name) + { + + return (ChairMultiTiledObject)ModCore.GetObjectFromPool(name); + + + } + + + } +} diff --git a/GeneralMods/Revitalize/Framework/Objects/CustomObject.cs b/GeneralMods/Revitalize/Framework/Objects/CustomObject.cs index 4d7459e4..55f5ce90 100644 --- a/GeneralMods/Revitalize/Framework/Objects/CustomObject.cs +++ b/GeneralMods/Revitalize/Framework/Objects/CustomObject.cs @@ -19,7 +19,13 @@ namespace Revitalize.Framework.Objects /// A custom object template. public class CustomObject : PySObject { - public string id; + public string id + { + get + { + return this.info.id; + } + } public BasicItemInformation info; diff --git a/GeneralMods/Revitalize/Framework/Utilities/Serialization/Converters/ItemCoverter.cs b/GeneralMods/Revitalize/Framework/Utilities/Serialization/Converters/ItemCoverter.cs index 3ad55edd..b32a093f 100644 --- a/GeneralMods/Revitalize/Framework/Utilities/Serialization/Converters/ItemCoverter.cs +++ b/GeneralMods/Revitalize/Framework/Utilities/Serialization/Converters/ItemCoverter.cs @@ -142,7 +142,7 @@ namespace Revitalize.Framework.Utilities.Serialization.Converters public override bool CanConvert(Type objectType) { - return IsSameOrSubclass(typeof(StardewValley.Item),objectType); + return this.IsSameOrSubclass(typeof(StardewValley.Item),objectType); } /// diff --git a/GeneralMods/Revitalize/Framework/Utilities/Serialization/Serialization.cs b/GeneralMods/Revitalize/Framework/Utilities/Serialization/Serialization.cs index dd99a092..e05e484a 100644 --- a/GeneralMods/Revitalize/Framework/Utilities/Serialization/Serialization.cs +++ b/GeneralMods/Revitalize/Framework/Utilities/Serialization/Serialization.cs @@ -47,7 +47,7 @@ namespace Revitalize.Framework.Utilities //this.addConverter(new Framework.Utilities.Serialization.Converters.NetFieldConverter()); //this.addConverter(new Framework.Utilities.Serialization.Converters.Vector2Converter()); - gatherAllFilesForCleanup(); + this.gatherAllFilesForCleanup(); this.settings = new JsonSerializerSettings(); foreach(JsonConverter converter in this.serializer.Converters) @@ -65,6 +65,7 @@ namespace Revitalize.Framework.Utilities /// private void gatherAllFilesForCleanup() { + if (!Directory.Exists(Path.Combine(Revitalize.ModCore.ModHelper.DirectoryPath, "SaveData"))) Directory.CreateDirectory(Path.Combine(Revitalize.ModCore.ModHelper.DirectoryPath, "SaveData")); this.filesToDelete.Clear(); string[] directories = Directory.GetDirectories(Path.Combine(Revitalize.ModCore.ModHelper.DirectoryPath, "SaveData")); foreach (string playerData in directories) @@ -95,19 +96,19 @@ namespace Revitalize.Framework.Utilities /// public void afterLoad() { - deleteAllUnusedFiles(); - removeNullObjects(); + this.deleteAllUnusedFiles(); + this.removeNullObjects(); } public void returnToTitle() { - gatherAllFilesForCleanup(); + this.gatherAllFilesForCleanup(); } private void removeNullObjects() { List removalList = new List(); - foreach(Item I in Game1.player.items) + foreach(Item I in Game1.player.Items) { if (I == null) continue; if (I.DisplayName.Contains("Revitalize.Framework") && (I is Chest)) @@ -118,7 +119,7 @@ namespace Revitalize.Framework.Utilities } foreach(Item I in removalList) { - Game1.player.items.Remove(I); + Game1.player.Items.Remove(I); } } @@ -228,9 +229,9 @@ namespace Revitalize.Framework.Utilities /// public void SerializeGUID(string fileName,object obj) { - string path = Path.Combine(Revitalize.ModCore.ModHelper.DirectoryPath, "SaveData", Game1.player.name + "_" + Game1.player.uniqueMultiplayerID, "SavedObjectInformation", fileName + ".json"); + string path = Path.Combine(Revitalize.ModCore.ModHelper.DirectoryPath, "SaveData", Game1.player.Name + "_" + Game1.player.UniqueMultiplayerID, "SavedObjectInformation", fileName + ".json"); Directory.CreateDirectory(Path.GetDirectoryName(path)); - Serialize(path, obj); + this.Serialize(path, obj); } /// @@ -241,9 +242,9 @@ namespace Revitalize.Framework.Utilities /// A data structure object deserialize from a json string in a file. public object DeserializeGUID(string fileName,Type T) { - string path=Path.Combine(Revitalize.ModCore.ModHelper.DirectoryPath, "SaveData", Game1.player.name + "_" + Game1.player.uniqueMultiplayerID, "SavedObjectInformation", fileName + ".json"); - removeFileFromDeletion((Game1.player.name + "_" + Game1.player.uniqueMultiplayerID), path); - return Deserialize(path, T); + string path=Path.Combine(Revitalize.ModCore.ModHelper.DirectoryPath, "SaveData", Game1.player.Name + "_" + Game1.player.UniqueMultiplayerID, "SavedObjectInformation", fileName + ".json"); + this.removeFileFromDeletion((Game1.player.Name + "_" + Game1.player.UniqueMultiplayerID), path); + return this.Deserialize(path, T); } /// @@ -254,12 +255,12 @@ namespace Revitalize.Framework.Utilities /// A data structure object deserialize from a json string in a file. public T DeserializeGUID(string fileName) { - string path = Path.Combine(Revitalize.ModCore.ModHelper.DirectoryPath, "SaveData", Game1.player.name + "_" + Game1.player.uniqueMultiplayerID, "SavedObjectInformation", fileName + ".json"); - removeFileFromDeletion((Game1.player.name + "_" + Game1.player.uniqueMultiplayerID),path); + string path = Path.Combine(Revitalize.ModCore.ModHelper.DirectoryPath, "SaveData", Game1.player.Name + "_" + Game1.player.UniqueMultiplayerID, "SavedObjectInformation", fileName + ".json"); + this.removeFileFromDeletion((Game1.player.Name + "_" + Game1.player.UniqueMultiplayerID),path); if (File.Exists(path)) { - return Deserialize(path); + return this.Deserialize(path); } else { @@ -299,5 +300,28 @@ namespace Revitalize.Framework.Utilities return JsonConvert.DeserializeObject(info, T, this.settings); } + + + public T DeserializeContentFile(string pathToFile) + { + if (File.Exists(pathToFile)) + { + + return this.Deserialize(pathToFile); + } + else + { + return default(T); + } + } + + public void SerializeContentFile(string fileName, object obj,string extensionFolder) + { + string path = Path.Combine(Revitalize.ModCore.ModHelper.DirectoryPath, "Content", extensionFolder,fileName+ ".json"); + Directory.CreateDirectory(Path.GetDirectoryName(path)); + if (File.Exists(path)) return; + this.Serialize(path, obj); + } + } } diff --git a/GeneralMods/Revitalize/ModCore.cs b/GeneralMods/Revitalize/ModCore.cs index 9e924701..c8a97e36 100644 --- a/GeneralMods/Revitalize/ModCore.cs +++ b/GeneralMods/Revitalize/ModCore.cs @@ -7,6 +7,7 @@ using PyTK.Types; using Revitalize.Framework; using Revitalize.Framework.Crafting; using Revitalize.Framework.Environment; +using Revitalize.Framework.Factories.Objects; using Revitalize.Framework.Graphics; using Revitalize.Framework.Graphics.Animations; using Revitalize.Framework.Illuminate; @@ -37,6 +38,12 @@ namespace Revitalize // -Furnace // -Seed Maker // -Stone Quarry + // -Mayo Maker + // -Cheese Maker + // -Auto fisher + // -Auto Preserves + // -Auto Keg + // -Auto Cask // -Materials // -Tin/Bronze/Alluminum/Silver?Platinum/Etc // -Crafting Menu @@ -128,10 +135,12 @@ namespace Revitalize customObjects = new Dictionary(); ObjectGroups = new Dictionary(); - this.loadContent(); + Serializer = new Serializer(); ObjectsToDraw = new Dictionary(); - + this.loadContent(); + + } private void GameLoop_ReturnedToTitle(object sender, StardewModdingAPI.Events.ReturnedToTitleEventArgs e) @@ -158,107 +167,16 @@ namespace Revitalize [bigObject] = 1 }, new KeyValuePair(new Furniture(3, Vector2.Zero), 1), new StatCost(100, 50, 0, 0)); - - - - Framework.Objects.Furniture.ChairTileComponent chairTop = new Framework.Objects.Furniture.ChairTileComponent(new BasicItemInformation("Oak Chair", "A basic wooden chair", "Chairs", Color.Brown, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.Revitalize.Furniture.Basic.OakChair", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", Framework.Graphics.TextureManager.TextureManagers["Furniture"].getTexture("Oak Chair").texture, Color.White, 0, false, typeof(Framework.Objects.Furniture.ChairTileComponent), null, new AnimationManager(TextureManager.TextureManagers["Furniture"].getTexture("Oak Chair"), new Animation(new Rectangle(0, 0, 16, 16)), new Dictionary>() { - { "Default_" + (int)Framework.Enums.Direction.Down , new List() - { - new Animation(new Rectangle(0,0,16,16)) - } - }, - { "Sitting_" + (int)Framework.Enums.Direction.Down , new List() - { - new Animation(new Rectangle(0,0,16,16)) - } - }, - { "Default_" + (int)Framework.Enums.Direction.Right , new List() - { - new Animation(new Rectangle(16,0,16,16)) - } - }, - { "Sitting_" + (int)Framework.Enums.Direction.Right , new List() - { - new Animation(new Rectangle(16,0,16,16)) - } - }, - { "Default_" + (int)Framework.Enums.Direction.Up , new List() - { - new Animation(new Rectangle(32,0,16,16)) - } - }, - { "Sitting_" + (int)Framework.Enums.Direction.Up , new List() - { - new Animation(new Rectangle(32,32,16,32)) - } - }, - { "Default_" + (int)Framework.Enums.Direction.Left , new List() - { - new Animation(new Rectangle(48,0,16,16)) - } - }, - { "Sitting_" + (int)Framework.Enums.Direction.Left , new List() - { - new Animation(new Rectangle(48,0,16,16)) - } - } - }, "Default_" + (int)Framework.Enums.Direction.Down), Color.White, true, new Framework.Utilities.InventoryManager(), new LightManager()), new Framework.Objects.InformationFiles.Furniture.ChairInformation(false)); - Framework.Objects.Furniture.ChairTileComponent chairBottom = new Framework.Objects.Furniture.ChairTileComponent(new BasicItemInformation("Oak Chair", "A basic wooden chair", "Chairs", Color.Brown, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.Revitalize.Furniture.Basic.OakChair", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", Framework.Graphics.TextureManager.TextureManagers["Furniture"].getTexture("Oak Chair").texture, Color.White, 0, false, typeof(Framework.Objects.Furniture.ChairTileComponent), null, new AnimationManager(TextureManager.TextureManagers["Furniture"].getTexture("Oak Chair"), new Animation(new Rectangle(0, 16, 16, 16)), new Dictionary>() { - { "Default_" + (int)Framework.Enums.Direction.Down , new List() - { - new Animation(new Rectangle(0,16,16,16)) - } - }, - { "Sitting_" + (int)Framework.Enums.Direction.Down , new List() - { - new Animation(new Rectangle(0,16,16,16)) - } - }, - { "Default_" + (int)Framework.Enums.Direction.Right , new List() - { - new Animation(new Rectangle(16,16,16,16)) - } - }, - { "Sitting_" + (int)Framework.Enums.Direction.Right , new List() - { - new Animation(new Rectangle(16,16,16,16)) - } - }, - { "Default_" + (int)Framework.Enums.Direction.Up , new List() - { - new Animation(new Rectangle(32,16,16,16)) - } - }, - { "Sitting_" + (int)Framework.Enums.Direction.Up , new List() - { - new Animation(new Rectangle(48,32,16,32)) - } - }, - { "Default_" + (int)Framework.Enums.Direction.Left , new List() - { - new Animation(new Rectangle(48,16,16,16)) - } - }, - { "Sitting" + (int)Framework.Enums.Direction.Left , new List() - { - new Animation(new Rectangle(48,16,16,16)) - } - } - }, "Default_" + (int)Framework.Enums.Direction.Down), Color.White, false, new Framework.Utilities.InventoryManager(), new LightManager()), new Framework.Objects.InformationFiles.Furniture.ChairInformation(true)); - - - Framework.Objects.Furniture.ChairMultiTiledObject oakChair = new Framework.Objects.Furniture.ChairMultiTiledObject(new BasicItemInformation("Oak Chair", "A wood chair you can place anywhere.", "Chair", Color.White, -300, 0, true, 100, Vector2.Zero, true, true, "Omegasis.Revitalize.Furniture.OakChair", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", TextureManager.TextureManagers["Furniture"].getTexture("Oak Chair").texture, Color.White, 0, true, typeof(Revitalize.Framework.Objects.Furniture.ChairMultiTiledObject), null, new AnimationManager(), Color.White, false, new Framework.Utilities.InventoryManager(), new LightManager())); - oakChair.addComponent(new Vector2(0, -1), chairTop); - oakChair.addComponent(new Vector2(0, 0), chairBottom); - customObjects.Add("Omegasis.BigTiledTest", bigObject); - customObjects.Add("Omegasis.Revitalize.Furniture.Chairs.OakChair",oakChair); + Framework.Objects.Furniture.RugTileComponent rug1 = new Framework.Objects.Furniture.RugTileComponent(new BasicItemInformation("BasicRugTile", "A basic rug", "Rug", Color.Brown, -300, 0, false, 100, new Vector2(0, 0), true, true, "Omegasis.Revitalize.Furniture.Basic.Rugs.TestRug", generatePlaceholderString(), TextureManager.TextureManagers["Furniture"].getTexture("Oak Chair").texture, Color.White, 0,true, typeof(Framework.Objects.Furniture.RugTileComponent), null, new AnimationManager(TextureManager.TextureManagers["Furniture"].getTexture("Oak Chair"), new Animation(new Rectangle(0, 0, 16, 16))), Color.White, true, null, null)); Framework.Objects.Furniture.RugMultiTiledObject rug = new Framework.Objects.Furniture.RugMultiTiledObject(new BasicItemInformation("BasicRugTile", "A basic rug", "Rug", Color.Brown, -300, 0, false, 100, new Vector2(0, 0), true, true, "Omegasis.Revitalize.Furniture.Basic.Rugs.TestRug", generatePlaceholderString(), TextureManager.TextureManagers["Furniture"].getTexture("Oak Chair").texture, Color.White, 0, true, typeof(Framework.Objects.Furniture.RugMultiTiledObject), null, new AnimationManager(), Color.White, true, null, null)); rug.addComponent(new Vector2(0, 0), rug1); customObjects.Add("Omegasis.Revitalize.Furniture.Rugs.RugTest", rug); + + FurnitureFactory.LoadChairFiles(); } private void createDirectories() @@ -289,6 +207,9 @@ namespace Revitalize private void GameLoop_SaveLoaded(object sender, StardewModdingAPI.Events.SaveLoadedEventArgs e) { + + + Serializer.afterLoad(); if (Game1.IsServer || Game1.IsMultiplayer || Game1.IsClient) @@ -296,8 +217,8 @@ namespace Revitalize throw new Exception("Can't run Revitalize in multiplayer due to lack of current support!"); } //Game1.player.addItemToInventory(customObjects["Omegasis.BigTiledTest"].getOne()); - Game1.player.addItemToInventory(this.getObjectFromPool("Omegasis.Revitalize.Furniture.Chairs.OakChair")); - Game1.player.addItemToInventory(this.getObjectFromPool("Omegasis.Revitalize.Furniture.Rugs.RugTest")); + Game1.player.addItemToInventory(GetObjectFromPool("Omegasis.Revitalize.Furniture.Chairs.OakChair")); + Game1.player.addItemToInventory(GetObjectFromPool("Omegasis.Revitalize.Furniture.Rugs.RugTest")); /* StardewValley.Tools.Axe axe = new StardewValley.Tools.Axe(); @@ -308,7 +229,7 @@ namespace Revitalize } - public Item getObjectFromPool(string objName) + public static Item GetObjectFromPool(string objName) { if (customObjects.ContainsKey(objName)) { diff --git a/GeneralMods/Revitalize/Revitalize.csproj b/GeneralMods/Revitalize/Revitalize.csproj index 7ca0d58c..80ed4ccd 100644 --- a/GeneralMods/Revitalize/Revitalize.csproj +++ b/GeneralMods/Revitalize/Revitalize.csproj @@ -54,6 +54,8 @@ + + @@ -92,5 +94,6 @@ + \ No newline at end of file