The experiment failed. It looks like I won't be able to do perfect object placement unless I figure something else out.
This commit is contained in:
parent
198a908c01
commit
c329613f09
|
@ -75,6 +75,7 @@ namespace Revitalize.Framework.Objects
|
|||
|
||||
public override Rectangle getBoundingBox(Vector2 tileLocation)
|
||||
{
|
||||
//Revitalize.ModCore.log(System.Environment.StackTrace);
|
||||
return this.info.ignoreBoundingBox
|
||||
? new Rectangle(int.MinValue, int.MinValue, 0, 0)
|
||||
: base.getBoundingBox(tileLocation);
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Revitalize.Framework.Objects.InformationFiles.Furniture;
|
||||
|
||||
namespace Revitalize.Framework.Objects.Furniture
|
||||
{
|
||||
public class CustomFurniture:CustomObject
|
||||
{
|
||||
public FurnitureInformation furnitureInfo;
|
||||
|
||||
|
||||
public CustomFurniture() : base()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public CustomFurniture(BasicItemInformation itemInfo, FurnitureInformation furnitureInfo) : base(itemInfo)
|
||||
{
|
||||
this.furnitureInfo = furnitureInfo;
|
||||
}
|
||||
|
||||
public CustomFurniture(BasicItemInformation itemInfo, Vector2 TileLocation, FurnitureInformation furnitureInfo) : base(itemInfo, TileLocation)
|
||||
{
|
||||
this.furnitureInfo = furnitureInfo;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Revitalize.Framework.Objects;
|
||||
using StardewValley;
|
||||
|
||||
namespace Revitalize.Framework.Utilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Deals with calculating bounding boxes on objects.
|
||||
/// </summary>
|
||||
public class BoundingBoxInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The number of tiles in size for this bounding box;
|
||||
/// </summary>
|
||||
public Rectangle tileSize;
|
||||
/// <summary>
|
||||
/// The pixel offset for this bounding box dimensions.
|
||||
/// </summary>
|
||||
public Rectangle pixelOffsets;
|
||||
|
||||
public BoundingBoxInfo()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="TileSize">How big in tiles this bounding box is.</param>
|
||||
public BoundingBoxInfo(Rectangle TileSize)
|
||||
{
|
||||
this.tileSize = TileSize;
|
||||
this.pixelOffsets = new Rectangle(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="TileSize">How big in tiles this bounding box is.</param>
|
||||
/// <param name="PixelOffsets">The offset in size and position in pixels.</param>
|
||||
public BoundingBoxInfo(Rectangle TileSize,Rectangle PixelOffsets)
|
||||
{
|
||||
this.tileSize = TileSize;
|
||||
this.pixelOffsets = PixelOffsets;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@ using System.IO;
|
|||
using Microsoft.Xna.Framework;
|
||||
using PyTK.Extensions;
|
||||
using PyTK.Types;
|
||||
using Revitalize.Framework;
|
||||
using Revitalize.Framework.Crafting;
|
||||
using Revitalize.Framework.Environment;
|
||||
using Revitalize.Framework.Graphics;
|
||||
|
@ -144,6 +145,7 @@ namespace Revitalize
|
|||
|
||||
private void GameLoop_SaveLoaded(object sender, StardewModdingAPI.Events.SaveLoadedEventArgs e)
|
||||
{
|
||||
|
||||
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", Game1.objectSpriteSheet, Color.White, 0, true, typeof(MultiTiledComponent), null, new AnimationManager(new Texture2DExtended(Game1.objectSpriteSheet), 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", Game1.objectSpriteSheet, Color.White, 0, true, typeof(MultiTiledComponent), null, new AnimationManager(new Texture2DExtended(Game1.objectSpriteSheet), 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", Game1.objectSpriteSheet, Color.White, 0, true, typeof(MultiTiledComponent), null, new AnimationManager(new Texture2DExtended(Game1.objectSpriteSheet), new Animation(new Rectangle(0, 32, 16, 16))), Color.Red, false, null, null));
|
||||
|
@ -264,11 +266,19 @@ namespace Revitalize
|
|||
{
|
||||
//pie.craft();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
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";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
<Compile Include="Framework\Objects\CustomObject.cs" />
|
||||
<Compile Include="Framework\Objects\Furniture\ChairMultiTiledObject.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\InformationFiles\Furniture\ChairInformation.cs" />
|
||||
<Compile Include="Framework\Objects\InformationFiles\Furniture\FurnitureInformation.cs" />
|
||||
|
@ -69,6 +70,7 @@
|
|||
<Compile Include="Framework\Player\Managers\MagicManager.cs" />
|
||||
<Compile Include="Framework\Player\Managers\SittingInfo.cs" />
|
||||
<Compile Include="Framework\Player\PlayerInfo.cs" />
|
||||
<Compile Include="Framework\Utilities\BoundingBoxInfo.cs" />
|
||||
<Compile Include="Framework\Utilities\InventoryManager.cs" />
|
||||
<Compile Include="ModCore.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
|
Loading…
Reference in New Issue