Added some documentation, made it so BasicItemInformation, LightManager, and InventoryManager make copies of themselves per new item fixing a duplication glitch. Updated all objects to use the new copy function for BasicItemInformation.
This commit is contained in:
parent
0cbae77d28
commit
ff9aa226f7
|
@ -97,7 +97,7 @@ namespace Revitalize.Framework.Factories.Objects
|
||||||
LampTileComponent lampMiddle = new LampTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Lamps.OakLamp", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), typeof(LampTileComponent), Color.White), new BasicItemInformation("Oak Lamp", "Omegasis.Revitalize.Furniture.Lamps.OakLamp", "A basic wooden light.", "Lamps", Color.Brown, -300, 0, true, 100, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), new Animation(new Rectangle(0, 16, 16, 16))), Color.White, true, new InventoryManager(), new LightManager()));
|
LampTileComponent lampMiddle = new LampTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Lamps.OakLamp", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), typeof(LampTileComponent), Color.White), new BasicItemInformation("Oak Lamp", "Omegasis.Revitalize.Furniture.Lamps.OakLamp", "A basic wooden light.", "Lamps", Color.Brown, -300, 0, true, 100, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), new Animation(new Rectangle(0, 16, 16, 16))), Color.White, true, new InventoryManager(), new LightManager()));
|
||||||
LampTileComponent lampBottom = new LampTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Lamps.OakLamp", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), typeof(LampTileComponent), Color.White), new BasicItemInformation("Oak Lamp", "Omegasis.Revitalize.Furniture.Lamps.OakLamp", "A basic wooden light.", "Lamps", Color.Brown, -300, 0, true, 100 , true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), new Animation(new Rectangle(0, 32, 16, 16))), Color.White, false, new InventoryManager(), new LightManager()));
|
LampTileComponent lampBottom = new LampTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Lamps.OakLamp", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), typeof(LampTileComponent), Color.White), new BasicItemInformation("Oak Lamp", "Omegasis.Revitalize.Furniture.Lamps.OakLamp", "A basic wooden light.", "Lamps", Color.Brown, -300, 0, true, 100 , true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), new Animation(new Rectangle(0, 32, 16, 16))), Color.White, false, new InventoryManager(), new LightManager()));
|
||||||
|
|
||||||
lampMiddle.lights.addLight(new Vector2(Game1.tileSize), new LightSource(4, new Vector2(0, 0), 2.5f, Color.Orange.Invert()), lampMiddle);
|
lampMiddle.lightManager.addLight(new Vector2(Game1.tileSize), new LightSource(4, new Vector2(0, 0), 2.5f, Color.Orange.Invert()), lampMiddle);
|
||||||
|
|
||||||
LampMultiTiledObject lamp = new LampMultiTiledObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Lamps.OakLamp", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), typeof(LampMultiTiledObject), Color.White), new BasicItemInformation("Oak Lamp", "Omegasis.Revitalize.Furniture.Lamps.OakLamp", "A basic wooden light", "Lamps", Color.Brown, -300, 0, true, 300, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), new AnimationManager(), Color.White, false, new InventoryManager(), new LightManager()));
|
LampMultiTiledObject lamp = new LampMultiTiledObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Lamps.OakLamp", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), typeof(LampMultiTiledObject), Color.White), new BasicItemInformation("Oak Lamp", "Omegasis.Revitalize.Furniture.Lamps.OakLamp", "A basic wooden light", "Lamps", Color.Brown, -300, 0, true, 300, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), new AnimationManager(), Color.White, false, new InventoryManager(), new LightManager()));
|
||||||
|
|
||||||
|
@ -157,13 +157,13 @@ namespace Revitalize.Framework.Factories.Objects
|
||||||
|
|
||||||
LampTileComponent lampPiece = new LampTileComponent(info.PyTkData,info.info);
|
LampTileComponent lampPiece = new LampTileComponent(info.PyTkData,info.info);
|
||||||
//Recreate the lights info.
|
//Recreate the lights info.
|
||||||
if (lampPiece.lights != null)
|
if (lampPiece.lightManager != null)
|
||||||
{
|
{
|
||||||
//ModCore.log("Info for file"+Path.GetFileNameWithoutExtension(file)+" has this many lights: " + info.info.lightManager.fakeLights.Count);
|
//ModCore.log("Info for file"+Path.GetFileNameWithoutExtension(file)+" has this many lights: " + info.info.lightManager.fakeLights.Count);
|
||||||
lampPiece.lights.lights.Clear();
|
lampPiece.lightManager.lights.Clear();
|
||||||
foreach (KeyValuePair<Vector2, FakeLightSource> light in info.info.lightManager.fakeLights)
|
foreach (KeyValuePair<Vector2, FakeLightSource> light in info.info.lightManager.fakeLights)
|
||||||
{
|
{
|
||||||
lampPiece.lights.addLight(new Vector2(Game1.tileSize), new LightSource(light.Value.id, new Vector2(0, 0), light.Value.radius, light.Value.color.Invert()), lampPiece);
|
lampPiece.lightManager.addLight(new Vector2(Game1.tileSize), new LightSource(light.Value.id, new Vector2(0, 0), light.Value.radius, light.Value.color.Invert()), lampPiece);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,19 +7,43 @@ using Microsoft.Xna.Framework;
|
||||||
|
|
||||||
namespace Revitalize.Framework.Illuminate
|
namespace Revitalize.Framework.Illuminate
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Deals with recreating light sources in SDV.
|
||||||
|
/// </summary>
|
||||||
public class FakeLightSource
|
public class FakeLightSource
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The id for the light. Refers to the type of texture used.
|
||||||
|
/// </summary>
|
||||||
public int id;
|
public int id;
|
||||||
|
/// <summary>
|
||||||
|
/// The position offset from the source object this is attached to.
|
||||||
|
/// </summary>
|
||||||
public Vector2 positionOffset;
|
public Vector2 positionOffset;
|
||||||
|
/// <summary>
|
||||||
|
/// The color for the light.
|
||||||
|
/// </summary>
|
||||||
public Color color;
|
public Color color;
|
||||||
|
/// <summary>
|
||||||
|
/// The radius for the light.
|
||||||
|
/// </summary>
|
||||||
public float radius;
|
public float radius;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Empty constructor.
|
||||||
|
/// </summary>
|
||||||
public FakeLightSource()
|
public FakeLightSource()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ID">The id for the light source.</param>
|
||||||
|
/// <param name="Position">The position for the light source.</param>
|
||||||
|
/// <param name="Color">The color for the light.</param>
|
||||||
|
/// <param name="Raidus">The radius for the light.</param>
|
||||||
public FakeLightSource(int ID, Vector2 Position, Color Color, float Raidus)
|
public FakeLightSource(int ID, Vector2 Position, Color Color, float Raidus)
|
||||||
{
|
{
|
||||||
this.id = ID;
|
this.id = ID;
|
||||||
|
@ -28,5 +52,14 @@ namespace Revitalize.Framework.Illuminate
|
||||||
this.radius = Raidus;
|
this.radius = Raidus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a copy of the fake light source.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public FakeLightSource Copy()
|
||||||
|
{
|
||||||
|
return new FakeLightSource(this.id, new Vector2(this.positionOffset.X, this.positionOffset.Y), new Color(this.color.R, this.color.G, this.color.B, this.color.A), this.radius);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,14 +6,32 @@ using StardewValley;
|
||||||
|
|
||||||
namespace Revitalize.Framework.Illuminate
|
namespace Revitalize.Framework.Illuminate
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Deals with handling lights on custom objects.
|
||||||
|
/// </summary>
|
||||||
public class LightManager
|
public class LightManager
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The lights held by this object.
|
||||||
|
/// </summary>
|
||||||
public Dictionary<Vector2, LightSource> lights;
|
public Dictionary<Vector2, LightSource> lights;
|
||||||
|
/// <summary>
|
||||||
|
/// Used to recreate lights at run time.
|
||||||
|
/// </summary>
|
||||||
public Dictionary<Vector2, FakeLightSource> fakeLights;
|
public Dictionary<Vector2, FakeLightSource> fakeLights;
|
||||||
|
/// <summary>
|
||||||
|
/// Are the lights on this object on?
|
||||||
|
/// </summary>
|
||||||
public bool lightsOn;
|
public bool lightsOn;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Magic number for positioning.
|
||||||
|
/// </summary>
|
||||||
public const int lightBigNumber= 1000000;
|
public const int lightBigNumber= 1000000;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor.
|
||||||
|
/// </summary>
|
||||||
public LightManager()
|
public LightManager()
|
||||||
{
|
{
|
||||||
this.lights = new Dictionary<Vector2, LightSource>();
|
this.lights = new Dictionary<Vector2, LightSource>();
|
||||||
|
@ -40,6 +58,31 @@ namespace Revitalize.Framework.Illuminate
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds in a light at the given tile location in the world.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="IdKey"></param>
|
||||||
|
/// <param name="light"></param>
|
||||||
|
/// <param name="gameObjectTileLocation"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool addLight(Vector2 IdKey, LightSource light, Vector2 gameObjectTileLocation)
|
||||||
|
{
|
||||||
|
if (gameObjectTileLocation.X < 0) gameObjectTileLocation = new Vector2(gameObjectTileLocation.X * -1, gameObjectTileLocation.Y);
|
||||||
|
if (gameObjectTileLocation.Y < 0) gameObjectTileLocation = new Vector2(gameObjectTileLocation.X, gameObjectTileLocation.Y * -1);
|
||||||
|
|
||||||
|
Vector2 initialPosition = gameObjectTileLocation * Game1.tileSize;
|
||||||
|
initialPosition += IdKey;
|
||||||
|
|
||||||
|
if (this.lights.ContainsKey(IdKey))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
light.position.Value = initialPosition;
|
||||||
|
this.lights.Add(IdKey, light);
|
||||||
|
if (this.fakeLights.ContainsKey(IdKey)) return true;
|
||||||
|
this.fakeLights.Add(IdKey, new FakeLightSource(light.Identifier, light.position.Value, light.color.Value.Invert(), light.radius.Value));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>Turn off a single light.</summary>
|
/// <summary>Turn off a single light.</summary>
|
||||||
public bool turnOffLight(Vector2 IdKey, GameLocation location)
|
public bool turnOffLight(Vector2 IdKey, GameLocation location)
|
||||||
{
|
{
|
||||||
|
@ -69,7 +112,6 @@ namespace Revitalize.Framework.Illuminate
|
||||||
if (location.sharedLights == null)
|
if (location.sharedLights == null)
|
||||||
throw new Exception("Locational lights is null!");
|
throw new Exception("Locational lights is null!");
|
||||||
|
|
||||||
Game1.showRedMessage("TURN ON!");
|
|
||||||
|
|
||||||
if (light.lightTexture == null)
|
if (light.lightTexture == null)
|
||||||
{
|
{
|
||||||
|
@ -99,18 +141,33 @@ namespace Revitalize.Framework.Illuminate
|
||||||
this.turnOffLight(pair.Key, environment);
|
this.turnOffLight(pair.Key, environment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Repositions all lights for this object.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="gameObject"></param>
|
||||||
public void repositionLights(StardewValley.Object gameObject)
|
public void repositionLights(StardewValley.Object gameObject)
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<Vector2, LightSource> pair in this.lights)
|
foreach (KeyValuePair<Vector2, LightSource> pair in this.lights)
|
||||||
this.repositionLight(pair.Value, pair.Key, gameObject);
|
this.repositionLight(pair.Value, pair.Key, gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reposition a light for this object.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="light"></param>
|
||||||
|
/// <param name="offset"></param>
|
||||||
|
/// <param name="gameObject"></param>
|
||||||
public void repositionLight(LightSource light, Vector2 offset, StardewValley.Object gameObject)
|
public void repositionLight(LightSource light, Vector2 offset, StardewValley.Object gameObject)
|
||||||
{
|
{
|
||||||
Vector2 initialPosition = gameObject.TileLocation * Game1.tileSize;
|
Vector2 initialPosition = gameObject.TileLocation * Game1.tileSize;
|
||||||
light.position.Value = initialPosition + offset;
|
light.position.Value = initialPosition + offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggles the lights for this object.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="location"></param>
|
||||||
|
/// <param name="gameObject"></param>
|
||||||
public virtual void toggleLights(GameLocation location, StardewValley.Object gameObject)
|
public virtual void toggleLights(GameLocation location, StardewValley.Object gameObject)
|
||||||
{
|
{
|
||||||
if (!this.lightsOn)
|
if (!this.lightsOn)
|
||||||
|
@ -127,11 +184,20 @@ namespace Revitalize.Framework.Illuminate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes the lights from the world when this object needs to be cleaned up.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="loc"></param>
|
||||||
public virtual void removeForCleanUp(GameLocation loc)
|
public virtual void removeForCleanUp(GameLocation loc)
|
||||||
{
|
{
|
||||||
this.turnOffLights(loc);
|
this.turnOffLights(loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Loads in the appropriate texture from sdv depending on the int value used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
/// <returns></returns>
|
||||||
private Texture2D loadTextureFromConstantValue(int value)
|
private Texture2D loadTextureFromConstantValue(int value)
|
||||||
{
|
{
|
||||||
switch (value)
|
switch (value)
|
||||||
|
@ -154,5 +220,30 @@ namespace Revitalize.Framework.Illuminate
|
||||||
}
|
}
|
||||||
return Game1.sconceLight;
|
return Game1.sconceLight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a copy of all of the
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public LightManager Copy()
|
||||||
|
{
|
||||||
|
LightManager copy= new LightManager();
|
||||||
|
if (this.lights != null)
|
||||||
|
{
|
||||||
|
//ModCore.log("Info for file"+Path.GetFileNameWithoutExtension(file)+" has this many lights: " + info.info.lightManager.fakeLights.Count);
|
||||||
|
copy.lights.Clear();
|
||||||
|
foreach (KeyValuePair<Vector2, FakeLightSource> light in this.fakeLights)
|
||||||
|
{
|
||||||
|
Vector2 position = light.Value.positionOffset;
|
||||||
|
position -= light.Key;
|
||||||
|
position /= Game1.tileSize;
|
||||||
|
position = new Vector2((float)Math.Round(position.X), (float)Math.Round(position.Y));
|
||||||
|
copy.addLight(light.Key, new LightSource(light.Value.id, new Vector2(0, 0), light.Value.radius, light.Value.color.Invert()), position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@ namespace Revitalize.Framework.Objects
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public BasicItemInformation Copy()
|
public BasicItemInformation Copy()
|
||||||
{
|
{
|
||||||
return new BasicItemInformation(this.name, this.id,this.description, this.categoryName, this.categoryColor, this.edibility, this.fragility, this.isLamp, this.price, this.canBeSetOutdoors, this.canBeSetIndoors, this.animationManager.getTexture(), this.animationManager, this.drawColor, this.ignoreBoundingBox, this.inventory, this.lightManager);
|
return new BasicItemInformation(this.name, this.id,this.description, this.categoryName, this.categoryColor, this.edibility, this.fragility, this.isLamp, this.price, this.canBeSetOutdoors, this.canBeSetIndoors, this.animationManager.getTexture(), this.animationManager, this.drawColor, this.ignoreBoundingBox, this.inventory.Copy(), this.lightManager.Copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace Revitalize.Framework.Objects.Extras
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return new ArcadeCabinetOBJ(this.data, this.info, this.TileLocation, objs);
|
return new ArcadeCabinetOBJ(this.data, this.info.Copy(), this.TileLocation, objs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ namespace Revitalize.Framework.Objects.Extras
|
||||||
|
|
||||||
public override Item getOne()
|
public override Item getOne()
|
||||||
{
|
{
|
||||||
ArcadeCabinetTile component = new ArcadeCabinetTile(this.data, this.info, this.arcadeInfo);
|
ArcadeCabinetTile component = new ArcadeCabinetTile(this.data, this.info.Copy(), this.arcadeInfo);
|
||||||
component.containerObject = this.containerObject;
|
component.containerObject = this.containerObject;
|
||||||
component.offsetKey = this.offsetKey;
|
component.offsetKey = this.offsetKey;
|
||||||
return component;
|
return component;
|
||||||
|
|
|
@ -62,7 +62,7 @@ namespace Revitalize.Framework.Objects.Furniture
|
||||||
objs.Add(pair.Key, (MultiTiledComponent)pair.Value);
|
objs.Add(pair.Key, (MultiTiledComponent)pair.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Bench(this.data,this.info, this.TileLocation, objs);
|
return new Bench(this.data,this.info.Copy(), this.TileLocation, objs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ namespace Revitalize.Framework.Objects.Furniture
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return new ChairMultiTiledObject(this.data,this.info, this.TileLocation, objs);
|
return new ChairMultiTiledObject(this.data,this.info.Copy(), this.TileLocation, objs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ namespace Revitalize.Framework.Objects.Furniture
|
||||||
|
|
||||||
public override Item getOne()
|
public override Item getOne()
|
||||||
{
|
{
|
||||||
ChairTileComponent component = new ChairTileComponent(this.data,this.info, (ChairInformation)this.furnitureInfo);
|
ChairTileComponent component = new ChairTileComponent(this.data,this.info.Copy(), (ChairInformation)this.furnitureInfo);
|
||||||
component.containerObject = this.containerObject;
|
component.containerObject = this.containerObject;
|
||||||
component.offsetKey = this.offsetKey;
|
component.offsetKey = this.offsetKey;
|
||||||
return component;
|
return component;
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
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;
|
|
||||||
|
|
||||||
namespace Revitalize.Framework.Objects.Furniture
|
|
||||||
{
|
|
||||||
public class CustomFurniture:CustomObject
|
|
||||||
{
|
|
||||||
public FurnitureInformation furnitureInfo;
|
|
||||||
|
|
||||||
|
|
||||||
public CustomFurniture() : base()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public CustomFurniture(CustomObjectData PyTKData,BasicItemInformation itemInfo, FurnitureInformation furnitureInfo) : base(PyTKData,itemInfo)
|
|
||||||
{
|
|
||||||
this.furnitureInfo = furnitureInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CustomFurniture(CustomObjectData PyTKData, BasicItemInformation itemInfo, Vector2 TileLocation, FurnitureInformation furnitureInfo) : base(PyTKData,itemInfo, TileLocation)
|
|
||||||
{
|
|
||||||
this.furnitureInfo = furnitureInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -47,7 +47,7 @@ namespace Revitalize.Framework.Objects.Furniture
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return new LampMultiTiledObject(this.data,this.info, this.TileLocation, objs);
|
return new LampMultiTiledObject(this.data,this.info.Copy(), this.TileLocation, objs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace Revitalize.Framework.Objects.Furniture
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public LightManager lights
|
public LightManager lightManager
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
@ -124,7 +124,7 @@ namespace Revitalize.Framework.Objects.Furniture
|
||||||
|
|
||||||
public override Item getOne()
|
public override Item getOne()
|
||||||
{
|
{
|
||||||
LampTileComponent component = new LampTileComponent(this.data,this.info);
|
LampTileComponent component = new LampTileComponent(this.data,this.info.Copy());
|
||||||
component.containerObject = this.containerObject;
|
component.containerObject = this.containerObject;
|
||||||
component.offsetKey = this.offsetKey;
|
component.offsetKey = this.offsetKey;
|
||||||
return component;
|
return component;
|
||||||
|
|
|
@ -49,7 +49,7 @@ namespace Revitalize.Framework.Objects.Furniture
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return new RugMultiTiledObject(this.data,this.info, this.TileLocation, objs);
|
return new RugMultiTiledObject(this.data,this.info.Copy(), this.TileLocation, objs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ namespace Revitalize.Framework.Objects.Furniture
|
||||||
|
|
||||||
public override Item getOne()
|
public override Item getOne()
|
||||||
{
|
{
|
||||||
RugTileComponent component = new RugTileComponent(this.data,this.info);
|
RugTileComponent component = new RugTileComponent(this.data,this.info.Copy());
|
||||||
component.containerObject = this.containerObject;
|
component.containerObject = this.containerObject;
|
||||||
component.offsetKey = this.offsetKey;
|
component.offsetKey = this.offsetKey;
|
||||||
return component;
|
return component;
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace Revitalize.Framework.Objects.Furniture
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return new StorageFurnitureOBJ(this.data, this.info, this.TileLocation, objs);
|
return new StorageFurnitureOBJ(this.data, this.info.Copy(), this.TileLocation, objs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ namespace Revitalize.Framework.Objects.Furniture
|
||||||
|
|
||||||
public override Item getOne()
|
public override Item getOne()
|
||||||
{
|
{
|
||||||
StorageFurnitureTile component = new StorageFurnitureTile(this.data, this.info);
|
StorageFurnitureTile component = new StorageFurnitureTile(this.data, this.info.Copy());
|
||||||
component.containerObject = this.containerObject;
|
component.containerObject = this.containerObject;
|
||||||
component.offsetKey = this.offsetKey;
|
component.offsetKey = this.offsetKey;
|
||||||
return component;
|
return component;
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace Revitalize.Framework.Objects.Furniture
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return new TableMultiTiledObject(this.data,this.info, this.TileLocation,objs);
|
return new TableMultiTiledObject(this.data,this.info.Copy(), this.TileLocation,objs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -180,7 +180,7 @@ namespace Revitalize.Framework.Objects.Furniture
|
||||||
|
|
||||||
public override Item getOne()
|
public override Item getOne()
|
||||||
{
|
{
|
||||||
TableTileComponent component = new TableTileComponent(this.data,this.info, (TableInformation)this.furnitureInfo);
|
TableTileComponent component = new TableTileComponent(this.data,this.info.Copy(), (TableInformation)this.furnitureInfo);
|
||||||
component.containerObject = this.containerObject;
|
component.containerObject = this.containerObject;
|
||||||
component.offsetKey = this.offsetKey;
|
component.offsetKey = this.offsetKey;
|
||||||
return component;
|
return component;
|
||||||
|
|
|
@ -114,7 +114,7 @@ namespace Revitalize.Framework.Objects
|
||||||
|
|
||||||
public override Item getOne()
|
public override Item getOne()
|
||||||
{
|
{
|
||||||
MultiTiledComponent component = new MultiTiledComponent(this.data,this.info, this.TileLocation,this.offsetKey,this.containerObject);
|
MultiTiledComponent component = new MultiTiledComponent(this.data,this.info.Copy(), this.TileLocation,this.offsetKey,this.containerObject);
|
||||||
return component;
|
return component;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -268,7 +268,7 @@ namespace Revitalize.Framework.Objects
|
||||||
{
|
{
|
||||||
objs.Add(pair.Key, (MultiTiledComponent)pair.Value);
|
objs.Add(pair.Key, (MultiTiledComponent)pair.Value);
|
||||||
}
|
}
|
||||||
return new MultiTiledObject(this.data,this.info, this.TileLocation, objs);
|
return new MultiTiledObject(this.data,this.info.Copy(), this.TileLocation, objs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ICustomObject recreate(Dictionary<string, string> additionalSaveData, object replacement)
|
public override ICustomObject recreate(Dictionary<string, string> additionalSaveData, object replacement)
|
||||||
|
|
|
@ -60,7 +60,7 @@ namespace Revitalize.Framework.Objects.Resources.OreVeins
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return new OreVeinObj(this.data, this.info, this.TileLocation, objs);
|
return new OreVeinObj(this.data, this.info.Copy(), this.TileLocation, objs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -231,7 +231,7 @@ namespace Revitalize.Framework.Objects.Resources.OreVeins
|
||||||
|
|
||||||
public override Item getOne()
|
public override Item getOne()
|
||||||
{
|
{
|
||||||
OreVeinTile component = new OreVeinTile(this.data, this.info,this.resourceInfo,this.extraDrops,this.healthValue);
|
OreVeinTile component = new OreVeinTile(this.data, this.info.Copy(),this.resourceInfo,this.extraDrops,this.healthValue);
|
||||||
component.containerObject = this.containerObject;
|
component.containerObject = this.containerObject;
|
||||||
component.offsetKey = this.offsetKey;
|
component.offsetKey = this.offsetKey;
|
||||||
return component;
|
return component;
|
||||||
|
|
|
@ -129,5 +129,14 @@ namespace Revitalize.Framework.Utilities
|
||||||
{
|
{
|
||||||
this.MaxCapacity = amount;
|
this.MaxCapacity = amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a new inventory manager without the items but with the capacity limits.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public InventoryManager Copy()
|
||||||
|
{
|
||||||
|
return new InventoryManager(this.capacity, this.MaxCapacity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,20 @@ using StardewValley;
|
||||||
|
|
||||||
namespace Revitalize.Framework.Utilities.Serialization
|
namespace Revitalize.Framework.Utilities.Serialization
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Utilities for dealing with the XNA/Monogames spritebatch class.
|
||||||
|
/// </summary>
|
||||||
public class SpriteBatchUtilities
|
public class SpriteBatchUtilities
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Used to draw SDV items to the screen.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="spriteBatch"></param>
|
||||||
|
/// <param name="obj"></param>
|
||||||
|
/// <param name="itemToDraw"></param>
|
||||||
|
/// <param name="alpha"></param>
|
||||||
|
/// <param name="addedDepth"></param>
|
||||||
public static void Draw(SpriteBatch spriteBatch, CustomObject obj, StardewValley.Item itemToDraw,float alpha,float addedDepth)
|
public static void Draw(SpriteBatch spriteBatch, CustomObject obj, StardewValley.Item itemToDraw,float alpha,float addedDepth)
|
||||||
{
|
{
|
||||||
if (itemToDraw.GetType()==typeof(StardewValley.Object))
|
if (itemToDraw.GetType()==typeof(StardewValley.Object))
|
||||||
|
|
|
@ -110,7 +110,6 @@
|
||||||
<Compile Include="Framework\Objects\Furniture\Bench.cs" />
|
<Compile Include="Framework\Objects\Furniture\Bench.cs" />
|
||||||
<Compile Include="Framework\Objects\Furniture\ChairMultiTiledObject.cs" />
|
<Compile Include="Framework\Objects\Furniture\ChairMultiTiledObject.cs" />
|
||||||
<Compile Include="Framework\Objects\Furniture\ChairTileComponent.cs" />
|
<Compile Include="Framework\Objects\Furniture\ChairTileComponent.cs" />
|
||||||
<Compile Include="Framework\Objects\Furniture\CustomFurniture.cs" />
|
|
||||||
<Compile Include="Framework\Objects\Furniture\FurnitureTileComponent.cs" />
|
<Compile Include="Framework\Objects\Furniture\FurnitureTileComponent.cs" />
|
||||||
<Compile Include="Framework\Objects\Furniture\LampMultiTiledObject.cs" />
|
<Compile Include="Framework\Objects\Furniture\LampMultiTiledObject.cs" />
|
||||||
<Compile Include="Framework\Objects\Furniture\LampTileComponent.cs" />
|
<Compile Include="Framework\Objects\Furniture\LampTileComponent.cs" />
|
||||||
|
|
Loading…
Reference in New Issue