Fixed tables not removing items on clean up.

This commit is contained in:
JoshuaNavarro 2019-05-16 13:00:43 -07:00
parent 42f8d2595b
commit 05aeabed12
7 changed files with 147 additions and 166 deletions

View File

@ -61,7 +61,9 @@ namespace Revitalize.Framework.Objects
/// <summary>Empty constructor.</summary> /// <summary>Empty constructor.</summary>
public CustomObject() { public CustomObject() {
this.guid = Guid.NewGuid(); this.guid = Guid.NewGuid();
ModCore.log("Created new obj with guid: " + this.guid);
this.InitNetFields(); this.InitNetFields();
ModCore.log(System.Environment.StackTrace);
} }
/// <summary>Construct an instance.</summary> /// <summary>Construct an instance.</summary>
@ -71,6 +73,8 @@ namespace Revitalize.Framework.Objects
this.info = info; this.info = info;
this.initializeBasics(); this.initializeBasics();
this.guid = Guid.NewGuid(); this.guid = Guid.NewGuid();
ModCore.log("Created new obj with guid: " + this.guid);
ModCore.log(System.Environment.StackTrace);
} }
/// <summary>Construct an instance.</summary> /// <summary>Construct an instance.</summary>
@ -80,6 +84,8 @@ namespace Revitalize.Framework.Objects
this.info = info; this.info = info;
this.initializeBasics(); this.initializeBasics();
this.guid = Guid.NewGuid(); this.guid = Guid.NewGuid();
ModCore.log("Created new obj with guid: " + this.guid);
ModCore.log(System.Environment.StackTrace);
} }
/// <summary>Sets some basic information up.</summary> /// <summary>Sets some basic information up.</summary>

View File

@ -48,7 +48,7 @@ namespace Revitalize.Framework.Objects.Furniture
} }
return new TableMultiTiledObject(this.info, this.TileLocation, objs); return new TableMultiTiledObject(this.info, this.TileLocation,objs);
} }
@ -137,8 +137,8 @@ namespace Revitalize.Framework.Objects.Furniture
{ {
foreach (KeyValuePair<Vector2, StardewValley.Object> pair in this.objects) foreach (KeyValuePair<Vector2, StardewValley.Object> pair in this.objects)
{ {
(pair.Value as TableTileComponent).clearHeldObject();
(pair.Value as TableTileComponent).removeFromLocation((pair.Value as TableTileComponent).location, pair.Key); (pair.Value as TableTileComponent).removeFromLocation((pair.Value as TableTileComponent).location, pair.Key);
(pair.Value as TableTileComponent).pickUpItem(true);
} }
this.location = null; this.location = null;
} }
@ -146,5 +146,7 @@ namespace Revitalize.Framework.Objects.Furniture
Game1.showRedMessage("NOOOOOOOO"); Game1.showRedMessage("NOOOOOOOO");
} }
} }
} }

View File

@ -17,17 +17,6 @@ namespace Revitalize.Framework.Objects.Furniture
{ {
public TableInformation furnitureInfo; public TableInformation furnitureInfo;
public StardewValley.Object heldItem
{
get
{
return this.heldObject.Value;
}
set
{
this.heldObject.Value = value;
}
}
public bool CanPlaceItemsHere public bool CanPlaceItemsHere
{ {
@ -59,165 +48,95 @@ namespace Revitalize.Framework.Objects.Furniture
this.furnitureInfo = FurnitureInfo; this.furnitureInfo = FurnitureInfo;
} }
/// <summary>
public PickUpState pickUpItem(bool forCleanUp = false) /// Forcefully clears the held object without much fuss.
/// </summary>
public void clearHeldObject()
{ {
if (this.heldObject.Value != null)
//ModCore.log("Pick up!");
if (this.CanPlaceItemsHere == false) return PickUpState.DoNothing;
if (forCleanUp == true)
{ {
ModCore.log("Clean up: " + this.TileLocation); ModCore.log("Help the held object!");
if (this.heldItem != null) if (Game1.player.isInventoryFull() == false)
{ {
if (Game1.player.isInventoryFull() == true)
{ Game1.player.addItemToInventoryBool(this.heldObject.Value, false);
Game1.createItemDebris(this.heldItem.getOne(), Vector2.Zero, 0, this.location); this.heldObject.Value = null;
this.heldItem = null; ModCore.log("Recover item");
return PickUpState.DoNothing; return;
}
else
{
Game1.player.addItemToInventoryBool(this.heldItem);
this.heldItem = null;
return PickUpState.DoNothing;
}
} }
else else
{ {
ModCore.log("Nothing here..."); Game1.createItemDebris(this.heldObject.Value, Vector2.Zero, 0);
return PickUpState.DoNothing;
} }
} }
else
if (this.heldItem == null)
{ {
if (this.CanPlaceItemsHere == true && this.heldItem == null && Game1.player.ActiveObject != null) ModCore.log("Why is there no held object here???");
{
//ModCore.log("Hello1");
this.heldItem = (StardewValley.Object)Game1.player.ActiveObject.getOne();
Game1.player.reduceActiveItemByOne();
return PickUpState.DoNothing;
}
else if (this.CanPlaceItemsHere == true && this.heldItem == null && Game1.player.ActiveObject == null)
{
ModCore.log("Hello1Pickup");
return PickUpState.RemoveContainer;
}
return PickUpState.DoNothing;
} }
else if(this.heldItem!=null)
{
if (this.CanPlaceItemsHere == true && this.heldItem != null && Game1.player.ActiveObject == null)
{
//ModCore.log("Hello2");
if (Game1.player.isInventoryFull() == false)
{
Game1.player.addItemToInventoryBool(this.heldItem);
this.heldItem = null;
//ModCore.log("Get rid of it11111");
return PickUpState.DoNothing;
}
else
{
ModCore.log("I'm not sure....");
//do nothing.
return PickUpState.DoNothing;
}
}
else if (this.CanPlaceItemsHere == true && this.heldItem != null && Game1.player.ActiveObject != null)
{
ModCore.log("Hello3");
if (Game1.player.isInventoryFull() == false)
{
Game1.player.addItemToInventoryBool(this.heldItem);
this.heldItem = null;
//ModCore.log("Get rid of it222222");
//ModCore.log(System.Environment.StackTrace);
return PickUpState.DoNothing;
}
else
{
ModCore.log("I'm not sure....");
//do nothing.
return PickUpState.DoNothing;
}
}
}
return PickUpState.DoNothing;
} }
public PickUpState pickUpItemCheck(bool forCleanUp = false) /// <summary>
/// Picks up the held item from this tile.
/// </summary>
/// <param name="justChecking"></param>
/// <returns></returns>
public PickUpState pickUpItem(bool justChecking = true)
{ {
if (this.heldObject.Value == null && Game1.player.ActiveObject != null)
//ModCore.log("Pick up!");
if (this.CanPlaceItemsHere == false) return PickUpState.DoNothing;
if (this.heldItem == null)
{ {
if (this.CanPlaceItemsHere == true && this.heldItem == null && Game1.player.ActiveObject != null) if (justChecking == false)
{ {
this.heldObject.Value = (StardewValley.Object)Game1.player.ActiveObject.getOne();
Game1.player.reduceActiveItemByOne();
ModCore.log("My guid: "+this.guid);
ModCore.log("Container guid: " + this.containerObject.guid);
foreach (var v in this.containerObject.objects)
{
if (v.Value.heldObject.Value != null) ModCore.log("Found a keeper to put down!");
else
{
ModCore.log("Nothing here seriously");
}
if (v.Value == this) ModCore.log("I AM PRESENT!");
ModCore.log("Other guid: " + (v.Value as TableTileComponent).guid);
}
//ModCore.log("Hello1");
//this.heldItem = (StardewValley.Object)Game1.player.ActiveObject.getOne();
//Game1.player.reduceActiveItemByOne();
return PickUpState.DoNothing;
}
else if (this.CanPlaceItemsHere == true && this.heldItem == null && Game1.player.ActiveObject == null)
{
ModCore.log("Hello1Pickup");
return PickUpState.RemoveContainer;
} }
return PickUpState.DoNothing; return PickUpState.DoNothing;
} }
else if (this.heldItem != null) else if (this.heldObject.Value != null)
{ {
if (this.CanPlaceItemsHere == true && this.heldItem != null && Game1.player.ActiveObject == null) if (justChecking == false)
{ {
//ModCore.log("Hello2");
if (Game1.player.isInventoryFull() == false) if (Game1.player.isInventoryFull() == false)
{ {
//Game1.player.addItemToInventoryBool(this.heldItem); Game1.player.addItemToInventoryBool(this.heldObject.Value, false);
//this.heldItem = null; this.heldObject.Value = null;
//ModCore.log("Get rid of it11111");
return PickUpState.DoNothing;
} }
else else
{ {
ModCore.log("I'm not sure...."); Game1.createItemDebris(this.heldObject.Value, Vector2.Zero, 0);
//do nothing.
return PickUpState.DoNothing;
}
}
else if (this.CanPlaceItemsHere == true && this.heldItem != null && Game1.player.ActiveObject != null)
{
ModCore.log("Hello3");
if (Game1.player.isInventoryFull() == false)
{
//Game1.player.addItemToInventoryBool(this.heldItem);
//ModCore.log("Get rid of it222222");
//ModCore.log(System.Environment.StackTrace);
return PickUpState.DoNothing;
}
else
{
ModCore.log("I'm not sure....");
//do nothing.
return PickUpState.DoNothing;
} }
} }
return PickUpState.DoNothing;
} }
else if (this.heldObject.Value == null && Game1.player.ActiveObject == null)
{
return PickUpState.RemoveContainer;
}
return PickUpState.DoNothing; return PickUpState.DoNothing;
} }
public override bool performObjectDropInAction(Item dropInItem, bool probe, Farmer who) public override bool performObjectDropInAction(Item dropInItem, bool probe, Farmer who)
{ {
ModCore.log("Drop In");
return false; //this.pickUpItem()==PickUpState.DoNothing; return false; //this.pickUpItem()==PickUpState.DoNothing;
//return base.performObjectDropInAction(dropInItem, probe, who); //return base.performObjectDropInAction(dropInItem, probe, who);
} }
@ -227,6 +146,7 @@ namespace Revitalize.Framework.Objects.Furniture
return base.performDropDownAction(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) public override bool checkForAction(Farmer who, bool justCheckingForActivity = false)
{ {
MouseState mState = Mouse.GetState(); MouseState mState = Mouse.GetState();
@ -234,7 +154,6 @@ namespace Revitalize.Framework.Objects.Furniture
if (mState.RightButton == ButtonState.Pressed && (keyboardState.IsKeyDown(Keys.LeftShift) || !keyboardState.IsKeyDown(Keys.RightShift))) if (mState.RightButton == ButtonState.Pressed && (keyboardState.IsKeyDown(Keys.LeftShift) || !keyboardState.IsKeyDown(Keys.RightShift)))
{ {
ModCore.log("Right clicked!");
return this.rightClicked(who); return this.rightClicked(who);
} }
@ -246,6 +165,8 @@ namespace Revitalize.Framework.Objects.Furniture
if (justCheckingForActivity) if (justCheckingForActivity)
return true; return true;
ModCore.log("Check for action");
this.pickUpItem(false); this.pickUpItem(false);
return true; return true;
@ -253,14 +174,34 @@ namespace Revitalize.Framework.Objects.Furniture
//return false; //return false;
} }
public override bool performToolAction(Tool t, GameLocation location)
{
ModCore.log("Perform tool action");
return base.performToolAction(t, location);
}
public override bool performUseAction(GameLocation location)
{
ModCore.log("Perform use action");
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) public override bool clicked(Farmer who)
{ {
if (this.pickUpItem() == PickUpState.DoNothing) return false;
ModCore.log("Click a table"); ModCore.log("Clicked!");
if (this.pickUpItemCheck() == PickUpState.DoNothing) return false; foreach(var v in this.containerObject.objects)
else
{ {
return base.clicked(who); if (v.Value.heldObject.Value != null) ModCore.log("Found a keeper!");
else
{
ModCore.log("Already null!");
}
} }
///Not sure. ///Not sure.
@ -376,7 +317,7 @@ namespace Revitalize.Framework.Objects.Furniture
{ {
ModCore.ModMonitor.Log(err.ToString()); ModCore.ModMonitor.Log(err.ToString());
} }
if (this.heldItem != null) SpriteBatchUtilities.Draw(spriteBatch, this, this.heldItem, alpha, -1f); if (this.heldObject.Value != null) SpriteBatchUtilities.Draw(spriteBatch, this, this.heldObject.Value, alpha, addedDepth);
} }
// spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)((double)tileLocation.X * (double)Game1.tileSize + (((double)tileLocation.X * 11.0 + (double)tileLocation.Y * 7.0) % 10.0 - 5.0)) + (float)(Game1.tileSize / 2), (float)((double)tileLocation.Y * (double)Game1.tileSize + (((double)tileLocation.Y * 11.0 + (double)tileLocation.X * 7.0) % 10.0 - 5.0)) + (float)(Game1.tileSize / 2))), new Rectangle?(new Rectangle((int)((double)tileLocation.X * 51.0 + (double)tileLocation.Y * 77.0) % 3 * 16, 128 + this.whichForageCrop * 16, 16, 16)), Color.White, 0.0f, new Vector2(8f, 8f), (float)Game1.pixelZoom, SpriteEffects.None, (float)(((double)tileLocation.Y * (double)Game1.tileSize + (double)(Game1.tileSize / 2) + (((double)tileLocation.Y * 11.0 + (double)tileLocation.X * 7.0) % 10.0 - 5.0)) / 10000.0)); // spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)((double)tileLocation.X * (double)Game1.tileSize + (((double)tileLocation.X * 11.0 + (double)tileLocation.Y * 7.0) % 10.0 - 5.0)) + (float)(Game1.tileSize / 2), (float)((double)tileLocation.Y * (double)Game1.tileSize + (((double)tileLocation.Y * 11.0 + (double)tileLocation.X * 7.0) % 10.0 - 5.0)) + (float)(Game1.tileSize / 2))), new Rectangle?(new Rectangle((int)((double)tileLocation.X * 51.0 + (double)tileLocation.Y * 77.0) % 3 * 16, 128 + this.whichForageCrop * 16, 16, 16)), Color.White, 0.0f, new Vector2(8f, 8f), (float)Game1.pixelZoom, SpriteEffects.None, (float)(((double)tileLocation.Y * (double)Game1.tileSize + (double)(Game1.tileSize / 2) + (((double)tileLocation.Y * 11.0 + (double)tileLocation.X * 7.0) % 10.0 - 5.0)) / 10000.0));

View File

@ -82,8 +82,15 @@ namespace Revitalize.Framework.Objects
if (this.location == null) this.location = Game1.player.currentLocation; if (this.location == null) this.location = Game1.player.currentLocation;
this.TileLocation = new Vector2((int)(x / Game1.tileSize), (int)(y / Game1.tileSize)); this.TileLocation = new Vector2((int)(x / Game1.tileSize), (int)(y / Game1.tileSize));
/*
return base.placementAction(location, x, y, who); return base.placementAction(location, x, y, who);
*/
this.performDropDownAction(who);
location.objects.Add(this.TileLocation, this);
return true;
} }
public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, bool drawStackNumber, Color c, bool drawShadow) public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, bool drawStackNumber, Color c, bool drawShadow)

View File

@ -39,7 +39,7 @@ namespace Revitalize.Framework.Objects
{ {
this.objects = new Dictionary<Vector2, StardewValley.Object>(); this.objects = new Dictionary<Vector2, StardewValley.Object>();
this.childrenGuids = new Dictionary<Vector2, Guid>(); this.childrenGuids = new Dictionary<Vector2, Guid>();
this.guid = Guid.NewGuid();
} }
public MultiTiledObject(BasicItemInformation info) public MultiTiledObject(BasicItemInformation info)
@ -47,7 +47,7 @@ namespace Revitalize.Framework.Objects
{ {
this.objects = new Dictionary<Vector2, StardewValley.Object>(); this.objects = new Dictionary<Vector2, StardewValley.Object>();
this.childrenGuids = new Dictionary<Vector2, Guid>(); this.childrenGuids = new Dictionary<Vector2, Guid>();
this.guid = Guid.NewGuid();
} }
public MultiTiledObject(BasicItemInformation info, Vector2 TileLocation) public MultiTiledObject(BasicItemInformation info, Vector2 TileLocation)
@ -55,7 +55,7 @@ namespace Revitalize.Framework.Objects
{ {
this.objects = new Dictionary<Vector2, StardewValley.Object>(); this.objects = new Dictionary<Vector2, StardewValley.Object>();
this.childrenGuids = new Dictionary<Vector2, Guid>(); this.childrenGuids = new Dictionary<Vector2, Guid>();
this.guid = Guid.NewGuid();
} }
public MultiTiledObject(BasicItemInformation info, Vector2 TileLocation, Dictionary<Vector2, MultiTiledComponent> ObjectsList) public MultiTiledObject(BasicItemInformation info, Vector2 TileLocation, Dictionary<Vector2, MultiTiledComponent> ObjectsList)
@ -65,20 +65,25 @@ namespace Revitalize.Framework.Objects
this.childrenGuids = new Dictionary<Vector2, Guid>(); this.childrenGuids = new Dictionary<Vector2, Guid>();
foreach (var v in ObjectsList) foreach (var v in ObjectsList)
{ {
ModCore.log("Original GUID: "+(v.Value as CustomObject).guid);
MultiTiledComponent component =(MultiTiledComponent) v.Value.getOne(); MultiTiledComponent component =(MultiTiledComponent) v.Value.getOne();
this.addComponent(v.Key, (component as MultiTiledComponent)); ModCore.log("Altered GUID: " + component.guid);
this.addComponent(v.Key, component);
} }
this.guid = Guid.NewGuid();
} }
public bool addComponent(Vector2 key, MultiTiledComponent obj) public bool addComponent(Vector2 key, MultiTiledComponent obj)
{ {
if (this.objects.ContainsKey(key)) if (this.objects.ContainsKey(key))
{
ModCore.log("Bad DATA");
return false; return false;
}
this.objects.Add(key, obj); this.objects.Add(key, obj);
this.childrenGuids.Add(key, Guid.NewGuid()); this.childrenGuids.Add(key, new Guid());
if (key.X > this.width) this.width = (int)key.X; if (key.X > this.width) this.width = (int)key.X;
if (key.Y > this.height) this.height = (int)key.Y; if (key.Y > this.height) this.height = (int)key.Y;
@ -205,7 +210,7 @@ namespace Revitalize.Framework.Objects
{ {
pair.Value.placementAction(location, x + (int)pair.Key.X * Game1.tileSize, y + (int)pair.Key.Y * Game1.tileSize, who); pair.Value.placementAction(location, x + (int)pair.Key.X * Game1.tileSize, y + (int)pair.Key.Y * Game1.tileSize, who);
}*/ }*/
pair.Value.placementAction(location, x + (int)pair.Key.X * Game1.tileSize, y + (int)pair.Key.Y * Game1.tileSize, who); (pair.Value as MultiTiledComponent).placementAction(location, x + (int)pair.Key.X * Game1.tileSize, y + (int)pair.Key.Y * Game1.tileSize, who);
//ModCore.log(pair.Value.TileLocation); //ModCore.log(pair.Value.TileLocation);
} }
this.location = location; this.location = location;

View File

@ -32,11 +32,12 @@ namespace Revitalize.Framework.Utilities.Serialization
spriteBatch1.Draw(shadowTexture, position, sourceRectangle, color, 0.0f, origin, 4f, SpriteEffects.None, (float)num); spriteBatch1.Draw(shadowTexture, position, sourceRectangle, color, 0.0f, origin, 4f, SpriteEffects.None, (float)num);
spriteBatch.Draw(Game1.objectSpriteSheet, Game1.GlobalToLocal(Game1.viewport, obj.TileLocation*Game1.tileSize), Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet,itemToDraw.ParentSheetIndex,16,16), Color.White * alpha, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, ((float)(obj.boundingBox.Bottom + 1) / 10000f)+ addedDepth); spriteBatch.Draw(Game1.objectSpriteSheet, Game1.GlobalToLocal(Game1.viewport, obj.TileLocation*Game1.tileSize), Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet,itemToDraw.ParentSheetIndex,16,16), Color.White * alpha, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, ((float)(obj.boundingBox.Bottom + 1) / 10000f)+ addedDepth);
(itemToDraw as StardewValley.Object).draw(spriteBatch, (int)obj.TileLocation.X, (int)obj.TileLocation.Y); (itemToDraw as StardewValley.Object).draw(spriteBatch, (int)obj.TileLocation.X*Game1.tileSize, (int)obj.TileLocation.Y*Game1.tileSize, Math.Max(0f, (float)(((obj.TileLocation.Y+1) + addedDepth) * Game1.tileSize) / 10000f) + .0001f, alpha);
} }
if (ModCore.Serializer.IsSameOrSubclass(typeof(CustomObject),itemToDraw.GetType())) if (ModCore.Serializer.IsSameOrSubclass(typeof(CustomObject),itemToDraw.GetType()))
{ {
(itemToDraw as CustomObject).draw(spriteBatch,(int)obj.TileLocation.X, (int)obj.TileLocation.Y); (itemToDraw as CustomObject).draw(spriteBatch,(int)obj.TileLocation.X, (int)obj.TileLocation.Y);
//(itemToDraw as CustomObject).draw(spriteBatch, (int)obj.TileLocation.X*Game1.tileSize, (int)obj.TileLocation.Y*Game1.tileSize,addedDepth,alpha);
} }
} }

View File

@ -12,6 +12,7 @@ using Revitalize.Framework.Graphics;
using Revitalize.Framework.Graphics.Animations; using Revitalize.Framework.Graphics.Animations;
using Revitalize.Framework.Illuminate; using Revitalize.Framework.Illuminate;
using Revitalize.Framework.Objects; using Revitalize.Framework.Objects;
using Revitalize.Framework.Objects.Furniture;
using Revitalize.Framework.Player; using Revitalize.Framework.Player;
using Revitalize.Framework.Utilities; using Revitalize.Framework.Utilities;
using StardewModdingAPI; using StardewModdingAPI;
@ -25,7 +26,8 @@ namespace Revitalize
// -Chair tops cut off objects // -Chair tops cut off objects
// -ignoring bounding box cuts off objects // -ignoring bounding box cuts off objects
// -Tables don't draw their held objects // -Tables don't draw their held objects
// -load content MUST be enabled for the table to be placed?????? WTF
// -multitiledobject cs 213 in placementAction must have special logic so that new components aren't being placed
// TODO: // TODO:
// //
// //
@ -155,20 +157,23 @@ namespace Revitalize
{ {
Serializer.returnToTitle(); Serializer.returnToTitle();
} }
/// <summary>
/// Must be enabled for the tabled to be placed????
/// </summary>
private void loadContent() private void loadContent()
{ {
MultiTiledComponent obj = new MultiTiledComponent(new BasicItemInformation("CoreObjectTest", "YAY FUN!", "Omegasis.Revitalize.MultiTiledComponent", Color.White, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.TEST1", "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(MultiTiledComponent), null, new AnimationManager(TextureManager.TextureManagers["Furniture"].getTexture("Oak Chair"), new Animation(new Rectangle(0, 0, 16, 16))), Color.Red, true, null, null)); MultiTiledComponent obj = new MultiTiledComponent(new BasicItemInformation("CoreObjectTest", "YAY FUN!", "Omegasis.Revitalize.MultiTiledComponent", Color.White, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.TEST1", "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(MultiTiledComponent), null, new AnimationManager(TextureManager.TextureManagers["Furniture"].getTexture("Oak Chair"), new Animation(new Rectangle(0, 0, 16, 16))), Color.Red, true, null, null));
MultiTiledComponent obj2 = new MultiTiledComponent(new BasicItemInformation("CoreObjectTest2", "SomeFun", "Omegasis.Revitalize.MultiTiledComponent", Color.White, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.TEST1", "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(MultiTiledComponent), null, new AnimationManager(TextureManager.TextureManagers["Furniture"].getTexture("Oak Chair"), new Animation(new Rectangle(0, 16, 16, 16))), Color.Red, false, null, null)); MultiTiledComponent obj2 = new MultiTiledComponent(new BasicItemInformation("CoreObjectTest2", "SomeFun", "Omegasis.Revitalize.MultiTiledComponent", Color.White, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.TEST1", "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(MultiTiledComponent), null, new AnimationManager(TextureManager.TextureManagers["Furniture"].getTexture("Oak Chair"), new Animation(new Rectangle(0, 16, 16, 16))), Color.Red, false, null, null));
MultiTiledComponent obj3 = new MultiTiledComponent(new BasicItemInformation("CoreObjectTest3", "NoFun", "Omegasis.Revitalize.MultiTiledComponent", Color.White, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.TEST1", "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(MultiTiledComponent), null, new AnimationManager(TextureManager.TextureManagers["Furniture"].getTexture("Oak Chair"), new Animation(new Rectangle(0, 32, 16, 16))), Color.Red, false, null, null)); MultiTiledComponent obj3 = new MultiTiledComponent(new BasicItemInformation("CoreObjectTest3", "NoFun", "Omegasis.Revitalize.MultiTiledComponent", Color.White, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.TEST1", "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(MultiTiledComponent), null, new AnimationManager(TextureManager.TextureManagers["Furniture"].getTexture("Oak Chair"), new Animation(new Rectangle(0, 32, 16, 16))), Color.Red, false, null, null));
obj.info.lightManager.addLight(new Vector2(Game1.tileSize), new LightSource(4, new Vector2(0, 0), 2.5f, Color.Orange.Invert()), obj); //obj.info.lightManager.addLight(new Vector2(Game1.tileSize), new LightSource(4, new Vector2(0, 0), 2.5f, Color.Orange.Invert()), obj);
MultiTiledObject bigObject = new MultiTiledObject(new BasicItemInformation("MultiTest", "A really big object", "Omegasis.Revitalize.MultiTiledObject", Color.Blue, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.BigTiledTest", "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(MultiTiledObject), null, new AnimationManager(), Color.White, false, null, null)); MultiTiledObject bigObject = new MultiTiledObject(new BasicItemInformation("MultiTest", "A really big object", "Omegasis.Revitalize.MultiTiledObject", Color.Blue, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.BigTiledTest", "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(MultiTiledObject), null, new AnimationManager(), Color.White, false, null, null));
bigObject.addComponent(new Vector2(0, 0), obj); //bigObject.addComponent(new Vector2(0, 0), obj);
bigObject.addComponent(new Vector2(1, 0), obj2); //bigObject.addComponent(new Vector2(1, 0), obj2);
bigObject.addComponent(new Vector2(2, 0), obj3); //bigObject.addComponent(new Vector2(2, 0), obj3);
Recipe pie = new Recipe(new Dictionary<Item, int>() Recipe pie = new Recipe(new Dictionary<Item, int>()
{ {
@ -227,8 +232,8 @@ namespace Revitalize
throw new Exception("Can't run Revitalize in multiplayer due to lack of current support!"); throw new Exception("Can't run Revitalize in multiplayer due to lack of current support!");
} }
//Game1.player.addItemToInventory(customObjects["Omegasis.BigTiledTest"].getOne()); //Game1.player.addItemToInventory(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")); 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();
@ -243,7 +248,21 @@ namespace Revitalize
{ {
if (customObjects.ContainsKey(objName)) if (customObjects.ContainsKey(objName))
{ {
return customObjects[objName];
TableMultiTiledObject old = (TableMultiTiledObject)customObjects[objName];
ModCore.log("Old GUID:" + old.guid);
foreach (var v in old.objects)
{
log("OLD GUID PART: "+(v.Value as TableTileComponent).guid);
}
TableMultiTiledObject i =(TableMultiTiledObject)customObjects[objName].getOne();
foreach (var v in i.objects)
{
log("OLD GUID PART: " + (v.Value as TableTileComponent).guid);
}
ModCore.log("New GUID:" + i.guid);
return i;
} }
else else
{ {