Added in the skeleton for tables but they don't do anything yet. Also the hack for no bounding boxes does make things super derpy for removal/placement of objects.
This commit is contained in:
parent
c2f5657ef0
commit
c8a1ce8e86
|
@ -0,0 +1,36 @@
|
||||||
|
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 TableFactoryInfo
|
||||||
|
{
|
||||||
|
public BasicItemInformation info;
|
||||||
|
public TableInformation tableInfo;
|
||||||
|
|
||||||
|
|
||||||
|
public TableFactoryInfo()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public TableFactoryInfo(TableTileComponent table)
|
||||||
|
{
|
||||||
|
this.info= table.info;
|
||||||
|
this.tableInfo = table.furnitureInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TableFactoryInfo(TableMultiTiledObject table)
|
||||||
|
{
|
||||||
|
this.info = table.info;
|
||||||
|
this.tableInfo = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,16 +17,31 @@ namespace Revitalize.Framework.Factories.Objects
|
||||||
public class FurnitureFactory
|
public class FurnitureFactory
|
||||||
{
|
{
|
||||||
public static string ChairFolder = Path.Combine("Objects", "Furniture", "Chairs");
|
public static string ChairFolder = Path.Combine("Objects", "Furniture", "Chairs");
|
||||||
|
public static string TablesFolder = Path.Combine("Objects", "Furniture", "Tables");
|
||||||
|
|
||||||
|
public static void LoadFurnitureFiles()
|
||||||
|
{
|
||||||
|
LoadChairFiles();
|
||||||
|
LoadTableFiles();
|
||||||
|
}
|
||||||
|
|
||||||
public static void LoadChairFiles()
|
private static void LoadChairFiles()
|
||||||
{
|
{
|
||||||
SerializeChairs();
|
SerializeChairs();
|
||||||
DeserializeChairs();
|
DeserializeChairs();
|
||||||
}
|
}
|
||||||
public static void SerializeChairs()
|
|
||||||
|
private static void LoadTableFiles()
|
||||||
{
|
{
|
||||||
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<string, List<Animation>>() {
|
SerializeTableFiles();
|
||||||
|
DeserializeTableFiles();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private 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", 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<string, List<Animation>>() {
|
||||||
{ "Default_" + (int)Framework.Enums.Direction.Down , new List<Animation>()
|
{ "Default_" + (int)Framework.Enums.Direction.Down , new List<Animation>()
|
||||||
{
|
{
|
||||||
new Animation(new Rectangle(0,0,16,16))
|
new Animation(new Rectangle(0,0,16,16))
|
||||||
|
@ -121,7 +136,7 @@ namespace Revitalize.Framework.Factories.Objects
|
||||||
ModCore.Serializer.SerializeContentFile("OakChair_0_0", bottom, ChairFolder);
|
ModCore.Serializer.SerializeContentFile("OakChair_0_0", bottom, ChairFolder);
|
||||||
ModCore.Serializer.SerializeContentFile("OakChair", obj, ChairFolder);
|
ModCore.Serializer.SerializeContentFile("OakChair", obj, ChairFolder);
|
||||||
}
|
}
|
||||||
public static void DeserializeChairs()
|
private static void DeserializeChairs()
|
||||||
{
|
{
|
||||||
if (!Directory.Exists(Path.Combine(ModCore.ModHelper.DirectoryPath, "Content", ChairFolder))) Directory.CreateDirectory(Path.Combine(ModCore.ModHelper.DirectoryPath, "Content", ChairFolder));
|
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));
|
string[] files = Directory.GetFiles(Path.Combine(ModCore.ModHelper.DirectoryPath, "Content", ChairFolder));
|
||||||
|
@ -157,14 +172,85 @@ namespace Revitalize.Framework.Factories.Objects
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ChairMultiTiledObject GetChair(string name)
|
private static void SerializeTableFiles()
|
||||||
{
|
{
|
||||||
|
TableTileComponent upperLeft = new TableTileComponent(new BasicItemInformation("Oak Table", "A simple oak table to hold things.", "Tables", Color.White, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.Revitalize.Furniture.Tables.OakTable", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", TextureManager.TextureManagers["Furniture"].getTexture("Oak Table").texture, Color.White, 0, true, typeof(TableTileComponent), null, new AnimationManager(TextureManager.TextureManagers["Furniture"].getTexture("Oak Table"),new Animation(new Rectangle(0,0,16,16),-1)),Color.White,true, new Utilities.InventoryManager(), new LightManager()), new Framework.Objects.InformationFiles.Furniture.TableInformation(false));
|
||||||
|
TableTileComponent upperRight = new TableTileComponent(new BasicItemInformation("Oak Table", "A simple oak table to hold things.", "Tables", Color.White, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.Revitalize.Furniture.Tables.OakTable", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", TextureManager.TextureManagers["Furniture"].getTexture("Oak Table").texture, Color.White, 0, true, typeof(TableTileComponent), null, new AnimationManager(TextureManager.TextureManagers["Furniture"].getTexture("Oak Table"), new Animation(new Rectangle(16, 0, 16, 16), -1)), Color.White, true, new Utilities.InventoryManager(), new LightManager()), new Framework.Objects.InformationFiles.Furniture.TableInformation(false));
|
||||||
|
TableTileComponent centerLeft = new TableTileComponent(new BasicItemInformation("Oak Table", "A simple oak table to hold things.", "Tables", Color.White, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.Revitalize.Furniture.Tables.OakTable", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", TextureManager.TextureManagers["Furniture"].getTexture("Oak Table").texture, Color.White, 0, true, typeof(TableTileComponent), null, new AnimationManager(TextureManager.TextureManagers["Furniture"].getTexture("Oak Table"), new Animation(new Rectangle(0, 16, 16, 16), -1)), Color.White, false, new Utilities.InventoryManager(), new LightManager()), new Framework.Objects.InformationFiles.Furniture.TableInformation(false));
|
||||||
|
TableTileComponent centerRight = new TableTileComponent(new BasicItemInformation("Oak Table", "A simple oak table to hold things.", "Tables", Color.White, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.Revitalize.Furniture.Tables.OakTable", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", TextureManager.TextureManagers["Furniture"].getTexture("Oak Table").texture, Color.White, 0, true, typeof(TableTileComponent), null, new AnimationManager(TextureManager.TextureManagers["Furniture"].getTexture("Oak Table"), new Animation(new Rectangle(16, 16, 16, 16), -1)), Color.White, false, new Utilities.InventoryManager(), new LightManager()), new Framework.Objects.InformationFiles.Furniture.TableInformation(false));
|
||||||
|
TableTileComponent bottomLeft = new TableTileComponent(new BasicItemInformation("Oak Table", "A simple oak table to hold things.", "Tables", Color.White, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.Revitalize.Furniture.Tables.OakTable", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", TextureManager.TextureManagers["Furniture"].getTexture("Oak Table").texture, Color.White, 0, true, typeof(TableTileComponent), null, new AnimationManager(TextureManager.TextureManagers["Furniture"].getTexture("Oak Table"), new Animation(new Rectangle(0, 32, 16, 16), -1)), Color.White, false, new Utilities.InventoryManager(), new LightManager()), new Framework.Objects.InformationFiles.Furniture.TableInformation(false));
|
||||||
|
TableTileComponent bottomRight = new TableTileComponent(new BasicItemInformation("Oak Table", "A simple oak table to hold things.", "Tables", Color.White, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.Revitalize.Furniture.Tables.OakTable", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", TextureManager.TextureManagers["Furniture"].getTexture("Oak Table").texture, Color.White, 0, true, typeof(TableTileComponent), null, new AnimationManager(TextureManager.TextureManagers["Furniture"].getTexture("Oak Table"), new Animation(new Rectangle(16, 32, 16, 16), -1)), Color.White, false, new Utilities.InventoryManager(), new LightManager()), new Framework.Objects.InformationFiles.Furniture.TableInformation(false));
|
||||||
|
|
||||||
return (ChairMultiTiledObject)ModCore.GetObjectFromPool(name);
|
TableMultiTiledObject obj = new TableMultiTiledObject(new BasicItemInformation("Oak Table", "A simple oak table to hold things.", "Tables", Color.White, -300, 0, false, 350, Vector2.Zero, true, true, "Omegasis.Revitalize.Furniture.Tables.OakTable", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", TextureManager.TextureManagers["Furniture"].getTexture("Oak Table").texture, Color.White, 0, true, typeof(TableMultiTiledObject), null, new AnimationManager(), Color.White, false, new Utilities.InventoryManager(), new LightManager()));
|
||||||
|
|
||||||
|
TableFactoryInfo uL = new TableFactoryInfo(upperLeft);
|
||||||
|
TableFactoryInfo uR = new TableFactoryInfo(upperRight);
|
||||||
|
TableFactoryInfo cL = new TableFactoryInfo(centerLeft);
|
||||||
|
TableFactoryInfo cR = new TableFactoryInfo(centerRight);
|
||||||
|
TableFactoryInfo bL = new TableFactoryInfo(bottomLeft);
|
||||||
|
TableFactoryInfo bR = new TableFactoryInfo(bottomRight);
|
||||||
|
|
||||||
|
TableFactoryInfo table = new TableFactoryInfo(obj);
|
||||||
|
|
||||||
|
|
||||||
|
ModCore.Serializer.SerializeContentFile("OakTable_0_0", uL, TablesFolder);
|
||||||
|
ModCore.Serializer.SerializeContentFile("OakTable_1_0", uR, TablesFolder);
|
||||||
|
ModCore.Serializer.SerializeContentFile("OakTable_0_1", cL, TablesFolder);
|
||||||
|
ModCore.Serializer.SerializeContentFile("OakTable_1_1", cR, TablesFolder);
|
||||||
|
ModCore.Serializer.SerializeContentFile("OakTable_0_2", bL, TablesFolder);
|
||||||
|
ModCore.Serializer.SerializeContentFile("OakTable_1_2", bR, TablesFolder);
|
||||||
|
|
||||||
|
ModCore.Serializer.SerializeContentFile("OakTable", table, TablesFolder);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void DeserializeTableFiles()
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(Path.Combine(ModCore.ModHelper.DirectoryPath, "Content", TablesFolder))) Directory.CreateDirectory(Path.Combine(ModCore.ModHelper.DirectoryPath, "Content", TablesFolder));
|
||||||
|
string[] files = Directory.GetFiles(Path.Combine(ModCore.ModHelper.DirectoryPath, "Content", TablesFolder));
|
||||||
|
|
||||||
|
Dictionary<string, TableMultiTiledObject> chairObjects = new Dictionary<string, TableMultiTiledObject>();
|
||||||
|
|
||||||
|
//Deserialize container.
|
||||||
|
foreach (string file in files)
|
||||||
|
{
|
||||||
|
if ((Path.GetFileName(file)).Contains("_") == true) continue;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
chairObjects.Add(Path.GetFileNameWithoutExtension(file), new TableMultiTiledObject(ModCore.Serializer.DeserializeContentFile<TableFactoryInfo>(file).info));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//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]));
|
||||||
|
TableFactoryInfo info = ModCore.Serializer.DeserializeContentFile<TableFactoryInfo>(file);
|
||||||
|
chairObjects[name].addComponent(offset, new TableTileComponent(info.info, info.tableInfo));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
public static TableMultiTiledObject GetTable(string name)
|
||||||
|
{
|
||||||
|
return (TableMultiTiledObject)ModCore.GetObjectFromPool(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,6 @@ namespace Revitalize.Framework.Objects.Furniture
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override void rotate()
|
public override void rotate()
|
||||||
{
|
{
|
||||||
Revitalize.ModCore.log("Rotate!");
|
|
||||||
foreach(KeyValuePair<Vector2, StardewValley.Object> pair in this.objects)
|
foreach(KeyValuePair<Vector2, StardewValley.Object> pair in this.objects)
|
||||||
{
|
{
|
||||||
(pair.Value as ChairTileComponent).rotate();
|
(pair.Value as ChairTileComponent).rotate();
|
||||||
|
|
|
@ -0,0 +1,102 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using PyTK.CustomElementHandler;
|
||||||
|
using StardewValley;
|
||||||
|
|
||||||
|
namespace Revitalize.Framework.Objects.Furniture
|
||||||
|
{
|
||||||
|
public class TableMultiTiledObject:MultiTiledObject
|
||||||
|
{
|
||||||
|
public TableMultiTiledObject() : base()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public TableMultiTiledObject(BasicItemInformation Info) : base(Info)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public TableMultiTiledObject(BasicItemInformation Info, Vector2 TilePosition) : base(Info, TilePosition)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public TableMultiTiledObject(BasicItemInformation Info, Vector2 TilePosition, Dictionary<Vector2, MultiTiledComponent> Objects) : base(Info, TilePosition, Objects)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void rotate()
|
||||||
|
{
|
||||||
|
|
||||||
|
base.rotate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Item getOne()
|
||||||
|
{
|
||||||
|
Dictionary<Vector2, MultiTiledComponent> objs = new Dictionary<Vector2, MultiTiledComponent>();
|
||||||
|
foreach (var pair in this.objects)
|
||||||
|
{
|
||||||
|
objs.Add(pair.Key, (MultiTiledComponent)pair.Value.getOne());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return new TableMultiTiledObject(this.info, this.TileLocation, objs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override ICustomObject recreate(Dictionary<string, string> additionalSaveData, object replacement)
|
||||||
|
{
|
||||||
|
TableMultiTiledObject obj = (TableMultiTiledObject)Revitalize.ModCore.Serializer.DeserializeGUID<TableMultiTiledObject>(additionalSaveData["GUID"]);
|
||||||
|
if (obj == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Dictionary<Vector2, Guid> guids = new Dictionary<Vector2, Guid>();
|
||||||
|
|
||||||
|
foreach (KeyValuePair<Vector2, Guid> pair in obj.childrenGuids)
|
||||||
|
{
|
||||||
|
guids.Add(pair.Key, pair.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (KeyValuePair<Vector2, Guid> pair in guids)
|
||||||
|
{
|
||||||
|
obj.childrenGuids.Remove(pair.Key);
|
||||||
|
//Revitalize.ModCore.log("DESERIALIZE: " + pair.Value.ToString());
|
||||||
|
TableTileComponent component = Revitalize.ModCore.Serializer.DeserializeGUID<TableTileComponent>(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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -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 PyTK.CustomElementHandler;
|
||||||
|
using Revitalize.Framework.Objects.InformationFiles.Furniture;
|
||||||
|
using StardewValley;
|
||||||
|
|
||||||
|
namespace Revitalize.Framework.Objects.Furniture
|
||||||
|
{
|
||||||
|
public class TableTileComponent : FurnitureTileComponent
|
||||||
|
{
|
||||||
|
public TableInformation furnitureInfo;
|
||||||
|
|
||||||
|
public bool CanPlaceItemsHere
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return this.furnitureInfo.canPlaceItemsHere;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public TableTileComponent() : base()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public TableTileComponent(BasicItemInformation Info, TableInformation FurnitureInfo) : base(Info)
|
||||||
|
{
|
||||||
|
this.furnitureInfo = FurnitureInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TableTileComponent(BasicItemInformation Info, Vector2 TileLocation, TableInformation FurnitureInfo) : base(Info, TileLocation)
|
||||||
|
{
|
||||||
|
this.furnitureInfo = FurnitureInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override bool clicked(Farmer who)
|
||||||
|
{
|
||||||
|
return base.clicked(who);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool rightClicked(Farmer who)
|
||||||
|
{
|
||||||
|
///Not sure.
|
||||||
|
return true;
|
||||||
|
//return base.rightClicked(who);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool shiftRightClicked(Farmer who)
|
||||||
|
{
|
||||||
|
return base.shiftRightClicked(who);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override Item getOne()
|
||||||
|
{
|
||||||
|
TableTileComponent component = new TableTileComponent(this.info, (TableInformation)this.furnitureInfo);
|
||||||
|
component.containerObject = this.containerObject;
|
||||||
|
component.offsetKey = this.offsetKey;
|
||||||
|
return component;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override ICustomObject recreate(Dictionary<string, string> 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"]));
|
||||||
|
TableTileComponent self = Revitalize.ModCore.Serializer.DeserializeGUID<TableTileComponent>(additionalSaveData["GUID"]);
|
||||||
|
if (self == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Revitalize.ModCore.ObjectGroups.ContainsKey(additionalSaveData["ParentGUID"]))
|
||||||
|
{
|
||||||
|
//Get new container
|
||||||
|
TableMultiTiledObject obj = (TableMultiTiledObject)Revitalize.ModCore.Serializer.DeserializeGUID<TableMultiTiledObject>(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;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Dictionary<string, string> getAdditionalSaveData()
|
||||||
|
{
|
||||||
|
Dictionary<string, string> saveData = base.getAdditionalSaveData();
|
||||||
|
Revitalize.ModCore.Serializer.SerializeGUID(this.containerObject.childrenGuids[this.offsetKey].ToString(), this);
|
||||||
|
|
||||||
|
return saveData;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Revitalize.Framework.Objects.InformationFiles.Furniture
|
||||||
|
{
|
||||||
|
public class TableInformation
|
||||||
|
{
|
||||||
|
public bool canPlaceItemsHere;
|
||||||
|
public TableInformation()
|
||||||
|
{
|
||||||
|
this.canPlaceItemsHere = false;
|
||||||
|
}
|
||||||
|
public TableInformation(bool CanPlaceItemsHere)
|
||||||
|
{
|
||||||
|
this.canPlaceItemsHere = CanPlaceItemsHere;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -131,7 +131,7 @@ namespace Revitalize
|
||||||
|
|
||||||
Framework.Graphics.TextureManager.TextureManagers.Add("Furniture", new TextureManager());
|
Framework.Graphics.TextureManager.TextureManagers.Add("Furniture", new TextureManager());
|
||||||
TextureManager.addTexture("Furniture","Oak Chair", new Texture2DExtended(this.Helper, this.ModManifest, Path.Combine("Content","Graphics","Furniture", "Chairs", "OakChair.png")));
|
TextureManager.addTexture("Furniture","Oak Chair", new Texture2DExtended(this.Helper, this.ModManifest, Path.Combine("Content","Graphics","Furniture", "Chairs", "OakChair.png")));
|
||||||
|
TextureManager.addTexture("Furniture", "Oak Table", new Texture2DExtended(this.Helper, this.ModManifest, Path.Combine("Content", "Graphics", "Furniture", "Tables", "OakTable.png")));
|
||||||
customObjects = new Dictionary<string, CustomObject>();
|
customObjects = new Dictionary<string, CustomObject>();
|
||||||
ObjectGroups = new Dictionary<string, MultiTiledObject>();
|
ObjectGroups = new Dictionary<string, MultiTiledObject>();
|
||||||
|
|
||||||
|
@ -176,7 +176,9 @@ namespace Revitalize
|
||||||
|
|
||||||
customObjects.Add("Omegasis.Revitalize.Furniture.Rugs.RugTest", rug);
|
customObjects.Add("Omegasis.Revitalize.Furniture.Rugs.RugTest", rug);
|
||||||
|
|
||||||
FurnitureFactory.LoadChairFiles();
|
|
||||||
|
|
||||||
|
FurnitureFactory.LoadFurnitureFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createDirectories()
|
private void createDirectories()
|
||||||
|
@ -219,7 +221,7 @@ namespace Revitalize
|
||||||
//Game1.player.addItemToInventory(customObjects["Omegasis.BigTiledTest"].getOne());
|
//Game1.player.addItemToInventory(customObjects["Omegasis.BigTiledTest"].getOne());
|
||||||
Game1.player.addItemToInventory(GetObjectFromPool("Omegasis.Revitalize.Furniture.Chairs.OakChair"));
|
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.Rugs.RugTest"));
|
||||||
|
Game1.player.addItemToInventory(GetObjectFromPool("Omegasis.Revitalize.Furniture.Tables.OakTable"));
|
||||||
/*
|
/*
|
||||||
StardewValley.Tools.Axe axe = new StardewValley.Tools.Axe();
|
StardewValley.Tools.Axe axe = new StardewValley.Tools.Axe();
|
||||||
Serializer.Serialize(Path.Combine(this.Helper.DirectoryPath, "AXE.json"), axe);
|
Serializer.Serialize(Path.Combine(this.Helper.DirectoryPath, "AXE.json"), axe);
|
||||||
|
|
|
@ -56,6 +56,7 @@
|
||||||
<Compile Include="Framework\Environment\DarkerNightConfig.cs" />
|
<Compile Include="Framework\Environment\DarkerNightConfig.cs" />
|
||||||
<Compile Include="Framework\Factories\Objects\FurnitureFactory.cs" />
|
<Compile Include="Framework\Factories\Objects\FurnitureFactory.cs" />
|
||||||
<Compile Include="Framework\Factories\Objects\Furniture\ChairFactoryInfo.cs" />
|
<Compile Include="Framework\Factories\Objects\Furniture\ChairFactoryInfo.cs" />
|
||||||
|
<Compile Include="Framework\Factories\Objects\Furniture\TableFactoryInfo.cs" />
|
||||||
<Compile Include="Framework\Graphics\Animations\Animation.cs" />
|
<Compile Include="Framework\Graphics\Animations\Animation.cs" />
|
||||||
<Compile Include="Framework\Graphics\Animations\AnimationManager.cs" />
|
<Compile Include="Framework\Graphics\Animations\AnimationManager.cs" />
|
||||||
<Compile Include="Framework\Graphics\Texture2DExtended.cs" />
|
<Compile Include="Framework\Graphics\Texture2DExtended.cs" />
|
||||||
|
@ -71,8 +72,11 @@
|
||||||
<Compile Include="Framework\Objects\Furniture\FurnitureTileComponent.cs" />
|
<Compile Include="Framework\Objects\Furniture\FurnitureTileComponent.cs" />
|
||||||
<Compile Include="Framework\Objects\Furniture\RugMultiTiledObject.cs" />
|
<Compile Include="Framework\Objects\Furniture\RugMultiTiledObject.cs" />
|
||||||
<Compile Include="Framework\Objects\Furniture\RugTileComponent.cs" />
|
<Compile Include="Framework\Objects\Furniture\RugTileComponent.cs" />
|
||||||
|
<Compile Include="Framework\Objects\Furniture\TableMultiTiledObject.cs" />
|
||||||
|
<Compile Include="Framework\Objects\Furniture\TableTileComponent.cs" />
|
||||||
<Compile Include="Framework\Objects\InformationFiles\Furniture\ChairInformation.cs" />
|
<Compile Include="Framework\Objects\InformationFiles\Furniture\ChairInformation.cs" />
|
||||||
<Compile Include="Framework\Objects\InformationFiles\Furniture\FurnitureInformation.cs" />
|
<Compile Include="Framework\Objects\InformationFiles\Furniture\FurnitureInformation.cs" />
|
||||||
|
<Compile Include="Framework\Objects\InformationFiles\Furniture\TableInformation.cs" />
|
||||||
<Compile Include="Framework\Objects\InformationFiles\ObjectGUIDInfo.cs" />
|
<Compile Include="Framework\Objects\InformationFiles\ObjectGUIDInfo.cs" />
|
||||||
<Compile Include="Framework\Objects\MultiTiledComponent.cs" />
|
<Compile Include="Framework\Objects\MultiTiledComponent.cs" />
|
||||||
<Compile Include="Framework\Objects\MultiTiledObject.cs" />
|
<Compile Include="Framework\Objects\MultiTiledObject.cs" />
|
||||||
|
|
Loading…
Reference in New Issue