Reworked object pools to be more sorted out. Also added in ore veins!
Before Width: | Height: | Size: 899 B After Width: | Height: | Size: 899 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 470 B After Width: | Height: | Size: 470 B |
Before Width: | Height: | Size: 491 B After Width: | Height: | Size: 491 B |
Before Width: | Height: | Size: 450 B After Width: | Height: | Size: 450 B |
After Width: | Height: | Size: 530 B |
|
@ -23,12 +23,26 @@ namespace Revitalize.Framework.Factories.Objects
|
|||
//Create portable beds???
|
||||
public class FurnitureFactory
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// The path to the chairs data on disk.
|
||||
/// </summary>
|
||||
public static string ChairFolder = Path.Combine("Data", "Furniture", "Chairs");
|
||||
/// <summary>
|
||||
/// The path to the tables data on disk.
|
||||
/// </summary>
|
||||
public static string TablesFolder = Path.Combine("Data", "Furniture", "Tables");
|
||||
/// <summary>
|
||||
/// The path to the lamps data on disk.
|
||||
/// </summary>
|
||||
public static string LampsFolder = Path.Combine("Data", "Furniture", "Lamps");
|
||||
/// <summary>
|
||||
/// The path to the storage data on disk.
|
||||
/// </summary>
|
||||
public static string StorageFolder = Path.Combine("Data", "Furniture", "Storage");
|
||||
|
||||
/// <summary>
|
||||
/// Loads all furniture files.
|
||||
/// </summary>
|
||||
public static void LoadFurnitureFiles()
|
||||
{
|
||||
LoadChairFiles();
|
||||
|
@ -37,24 +51,36 @@ namespace Revitalize.Framework.Factories.Objects
|
|||
LoadFurnitureStorageFiles();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads all chair files.
|
||||
/// </summary>
|
||||
private static void LoadChairFiles()
|
||||
{
|
||||
SerializeChairs();
|
||||
DeserializeChairs();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads all table files.
|
||||
/// </summary>
|
||||
private static void LoadTableFiles()
|
||||
{
|
||||
SerializeTableFiles();
|
||||
DeserializeTableFiles();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads all lamp files.
|
||||
/// </summary>
|
||||
private static void LoadLampFiles()
|
||||
{
|
||||
SerializeLamps();
|
||||
DeserializeLamps();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads all furniture storage files.
|
||||
/// </summary>
|
||||
private static void LoadFurnitureStorageFiles()
|
||||
{
|
||||
SerializeFurnitureStorageFiles();
|
||||
|
@ -93,6 +119,9 @@ namespace Revitalize.Framework.Factories.Objects
|
|||
//ModCore.customObjects.Add(lamp.info.id, lamp);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deserializes all lamp files for the mod.
|
||||
/// </summary>
|
||||
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"));
|
||||
}
|
||||
/// <summary>
|
||||
/// Deserializes all chair files for the mod.
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an example table file for the mod.
|
||||
/// </summary>
|
||||
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
|
|||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deserailzes all table files for the mod.
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Creates an example storage file for the mod.
|
||||
/// </summary>
|
||||
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
|
|||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deserializes the furniure files for the mod.
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets a chair from the object manager.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public static ChairMultiTiledObject GetChair(string name)
|
||||
{
|
||||
return (ChairMultiTiledObject)ModCore.GetObjectFromPool(name);
|
||||
return (ChairMultiTiledObject)ModCore.ObjectManager.getChair(name);
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets a table from the object manager.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public static TableMultiTiledObject GetTable(string name)
|
||||
{
|
||||
return (TableMultiTiledObject)ModCore.GetObjectFromPool(name);
|
||||
return (TableMultiTiledObject)ModCore.ObjectManager.getTable(name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a lamp from the object manager.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public static LampMultiTiledObject GetLamp(string name)
|
||||
{
|
||||
return (LampMultiTiledObject)ModCore.GetObjectFromPool(name);
|
||||
return (LampMultiTiledObject)ModCore.ObjectManager.getLamp(name);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets a furniture storage file for the mod.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public static StorageFurnitureOBJ GetFurnitureStorage(string name)
|
||||
{
|
||||
return (StorageFurnitureOBJ)ModCore.ObjectManager.getStorageFuriture(name);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Deals with information reguarding resources.
|
||||
/// </summary>
|
||||
public class ResourceInformaton
|
||||
{
|
||||
/// <summary>
|
||||
/// The item to drop.
|
||||
/// </summary>
|
||||
public Item droppedItem;
|
||||
/// <summary>
|
||||
/// The min amount to drop.
|
||||
/// </summary>
|
||||
public int minDropAmount;
|
||||
/// <summary>
|
||||
/// The max amount to drop.
|
||||
/// </summary>
|
||||
public int maxDropAmount;
|
||||
|
||||
/// <summary>
|
||||
/// Empty constructor.
|
||||
/// </summary>
|
||||
public ResourceInformaton()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="I">The item to drop.</param>
|
||||
/// <param name="Min">The min amount to drop.</param>
|
||||
/// <param name="Max">The max amount to drop.</param>
|
||||
public ResourceInformaton(Item I, int Min, int Max)
|
||||
{
|
||||
this.droppedItem = I;
|
||||
this.minDropAmount = Min;
|
||||
this.maxDropAmount = Max;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,6 +9,9 @@ using StardewValley;
|
|||
|
||||
namespace Revitalize.Framework.Objects
|
||||
{
|
||||
/// <summary>
|
||||
/// Deals with handling all objects for the mod.
|
||||
/// </summary>
|
||||
public class ObjectManager
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -38,6 +41,15 @@ namespace Revitalize.Framework.Objects
|
|||
/// All of the rugs held by this object pool.
|
||||
/// </summary>
|
||||
public Dictionary<string, RugMultiTiledObject> rugs;
|
||||
public Dictionary<string, StorageFurnitureOBJ> furnitureStorage;
|
||||
|
||||
public Dictionary<string, MultiTiledObject> generic;
|
||||
/// <summary>
|
||||
/// Misc. items for this mod.
|
||||
/// </summary>
|
||||
public Dictionary<string, MultiTiledObject> miscellaneous;
|
||||
|
||||
public ResourceManager resources;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
|
@ -66,6 +78,12 @@ namespace Revitalize.Framework.Objects
|
|||
this.tables = new Dictionary<string, TableMultiTiledObject>();
|
||||
this.lamps = new Dictionary<string, LampMultiTiledObject>();
|
||||
this.rugs = new Dictionary<string, RugMultiTiledObject>();
|
||||
this.furnitureStorage = new Dictionary<string, StorageFurnitureOBJ>();
|
||||
|
||||
this.generic = new Dictionary<string, MultiTiledObject>();
|
||||
this.miscellaneous = new Dictionary<string, MultiTiledObject>();
|
||||
|
||||
this.resources = new ResourceManager();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -85,6 +103,7 @@ namespace Revitalize.Framework.Objects
|
|||
return objs[rand].getOne();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets an object from the dictionary that is passed in.
|
||||
/// </summary>
|
||||
|
@ -102,6 +121,86 @@ namespace Revitalize.Framework.Objects
|
|||
throw new Exception("Object pool doesn't contain said object.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Item getObject(string objectName, Dictionary<string, MultiTiledObject> dictionary)
|
||||
{
|
||||
if (dictionary.ContainsKey(objectName))
|
||||
{
|
||||
return dictionary[objectName].getOne();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Object pool doesn't contain said object.");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a chair from the object manager.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
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.");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets a table from the object manager.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
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.");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a lamp from the object manager.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
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.");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets storage furniture from the object manager.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
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.");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new object manager to the master pool of managers.
|
||||
|
|
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// A static reference to the resource manager for quicker access.
|
||||
/// </summary>
|
||||
public static ResourceManager self;
|
||||
|
||||
/// <summary>
|
||||
/// A list of all of the ores held by the resource manager.
|
||||
/// </summary>
|
||||
public Dictionary<string, OreVeinObj> ores;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
public ResourceManager()
|
||||
{
|
||||
self = this;
|
||||
this.ores = new Dictionary<string, OreVeinObj>();
|
||||
this.loadOreVeins();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads in all of the ore veins for the game.
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Spawns an ore vein at the given location if possible.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
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);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Spawns an orevein at the tile position at the same location as the player.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="TilePosition"></param>
|
||||
/// <returns></returns>
|
||||
public bool spawnOreVein(string name, Vector2 TilePosition)
|
||||
{
|
||||
return this.spawnOreVein(name, Game1.player.currentLocation, TilePosition);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks to see if a resource can be spawned here.
|
||||
/// </summary>
|
||||
/// <param name="OBJ"></param>
|
||||
/// <param name="Location"></param>
|
||||
/// <param name="TilePosition"></param>
|
||||
/// <returns></returns>
|
||||
public bool canResourceBeSpawnedHere(StardewValley.Object OBJ,GameLocation Location, Vector2 TilePosition)
|
||||
{
|
||||
return OBJ.canBePlacedHere(Location, TilePosition);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -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<Vector2, MultiTiledComponent> Objects) : base(PyTKData, 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 OreVeinObj(this.data, this.info, this.TileLocation, objs);
|
||||
}
|
||||
|
||||
|
||||
public override ICustomObject recreate(Dictionary<string, string> additionalSaveData, object replacement)
|
||||
{
|
||||
OreVeinObj obj = (OreVeinObj)Revitalize.ModCore.Serializer.DeserializeGUID<OreVeinObj>(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());
|
||||
OreVeinTile component = Revitalize.ModCore.Serializer.DeserializeGUID<OreVeinTile>(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<Vector2, StardewValley.Object> 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<Vector2, StardewValley.Object> pair in this.objects)
|
||||
{
|
||||
(pair.Value as OreVeinTile).removeFromLocation((pair.Value as OreVeinTile).location, pair.Key);
|
||||
}
|
||||
this.location = null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Deals with information tied to the resource itself.
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets called when there is no actively held item on the tile.
|
||||
/// </summary>
|
||||
/// <param name="who"></param>
|
||||
/// <returns></returns>
|
||||
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<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"]));
|
||||
OreVeinTile self = Revitalize.ModCore.Serializer.DeserializeGUID<OreVeinTile>(additionalSaveData["GUID"]);
|
||||
if (self == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!Revitalize.ModCore.ObjectGroups.ContainsKey(additionalSaveData["ParentGUID"]))
|
||||
{
|
||||
//Get new container
|
||||
OreVeinObj obj = (OreVeinObj)Revitalize.ModCore.Serializer.DeserializeGUID<OreVeinObj>(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<string, string> getAdditionalSaveData()
|
||||
{
|
||||
Dictionary<string, string> saveData = base.getAdditionalSaveData();
|
||||
Revitalize.ModCore.Serializer.SerializeGUID(this.containerObject.childrenGuids[this.offsetKey].ToString(), this);
|
||||
|
||||
return saveData;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>What happens when the object is drawn at a tile location.</summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -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<string, CustomObject> customObjects;
|
||||
/// <summary>
|
||||
/// Keeps track of custom objects. REPLACE THIS WITH RESOUCE MANAGER.
|
||||
/// </summary>
|
||||
//public static Dictionary<string, CustomObject> customObjects;
|
||||
public static ObjectManager ObjectManager;
|
||||
|
||||
/// <summary>
|
||||
/// Keeps track of all of the extra object groups.
|
||||
/// </summary>
|
||||
public static Dictionary<string, MultiTiledObject> 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<string, CustomObject>();
|
||||
ObjectGroups = new Dictionary<string, MultiTiledObject>();
|
||||
//customObjects = new Dictionary<string, CustomObject>();
|
||||
|
||||
ObjectGroups = new Dictionary<string, MultiTiledObject>();
|
||||
ObjectManager = new ObjectManager();
|
||||
|
||||
Serializer = new Serializer();
|
||||
ObjectsToDraw = new Dictionary<GameLocation, MultiTiledObject>();
|
||||
|
@ -269,7 +280,7 @@ namespace Revitalize
|
|||
[bigObject] = 1
|
||||
}, new KeyValuePair<Item, int>(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);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/// <summary>
|
||||
///Logs information to the console.
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
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";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,9 +124,13 @@
|
|||
<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\ResourceInformaton.cs" />
|
||||
<Compile Include="Framework\Objects\MultiTiledComponent.cs" />
|
||||
<Compile Include="Framework\Objects\MultiTiledObject.cs" />
|
||||
<Compile Include="Framework\Objects\ObjectManager.cs" />
|
||||
<Compile Include="Framework\Objects\ResourceManager.cs" />
|
||||
<Compile Include="Framework\Objects\Resources\OreVeins\OreVeinObj.cs" />
|
||||
<Compile Include="Framework\Objects\Resources\OreVeins\OreVeinTile.cs" />
|
||||
<Compile Include="Framework\Player\Managers\MagicManager.cs" />
|
||||
<Compile Include="Framework\Player\Managers\SittingInfo.cs" />
|
||||
<Compile Include="Framework\Player\PlayerInfo.cs" />
|
||||
|
@ -147,6 +151,7 @@
|
|||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Content\Graphics\Objects\Resources\Ore\TestTemplate.aseprite" />
|
||||
<None Include="Content\Minigames\SeasideScramble\Maps\ShootingGallery.tbin">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
@ -159,21 +164,6 @@
|
|||
<None Include="manifest.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Content\Graphics\Furniture\Arcade\SeasideScrambleArcade.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Graphics\Furniture\Chairs\Oak Chair.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Graphics\Furniture\Lamps\Oak Lamp.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Graphics\Furniture\Storage\Oak Cabinet.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Graphics\Furniture\Tables\Oak Table.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Graphics\Menus\InventoryMenu\ItemBackground.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
@ -192,6 +182,24 @@
|
|||
<Content Include="Content\Graphics\Menus\InventoryMenu\TrashButton.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Graphics\Objects\Furniture\Arcade\SeasideScrambleArcade.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Graphics\Objects\Furniture\Chairs\Oak Chair.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Graphics\Objects\Furniture\Lamps\Oak Lamp.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Graphics\Objects\Furniture\Storage\Oak Cabinet.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Graphics\Objects\Furniture\Tables\Oak Table.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Graphics\Objects\Resources\Ore\Test.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Minigames\SeasideScramble\Graphics\Enemies\Target.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
|