diff --git a/GeneralMods/Revitalize/Framework/Objects/BasicItemInformation.cs b/GeneralMods/Revitalize/Framework/Objects/BasicItemInformation.cs
index e233ade3..11450e91 100644
--- a/GeneralMods/Revitalize/Framework/Objects/BasicItemInformation.cs
+++ b/GeneralMods/Revitalize/Framework/Objects/BasicItemInformation.cs
@@ -38,6 +38,8 @@ namespace Revitalize.Framework.Objects
public Enums.Direction facingDirection;
+ public int shakeTimer;
+
public BasicItemInformation()
{
this.name = "";
@@ -57,6 +59,7 @@ namespace Revitalize.Framework.Objects
this.facingDirection = Enums.Direction.Down;
this.id = "";
+ this.shakeTimer = 0;
}
@@ -88,9 +91,19 @@ namespace Revitalize.Framework.Objects
this.inventory = Inventory ?? new InventoryManager();
this.lightManager = Lights ?? new LightManager();
this.facingDirection = Enums.Direction.Down;
+ this.shakeTimer = 0;
}
+ ///
+ /// Gets an x offset for shaking an object. Source code used from game.
+ ///
+ ///
+ public int shakeTimerOffset()
+ {
+ return (this.shakeTimer > 0 ? Game1.random.Next(-1, 2) : 0);
+ }
+
}
}
diff --git a/GeneralMods/Revitalize/Framework/Objects/Resources/OreVeins/OreVeinTile.cs b/GeneralMods/Revitalize/Framework/Objects/Resources/OreVeins/OreVeinTile.cs
index 3db63969..d9123f12 100644
--- a/GeneralMods/Revitalize/Framework/Objects/Resources/OreVeins/OreVeinTile.cs
+++ b/GeneralMods/Revitalize/Framework/Objects/Resources/OreVeins/OreVeinTile.cs
@@ -67,6 +67,7 @@ namespace Revitalize.Framework.Objects.Resources.OreVeins
{
base.updateWhenCurrentLocation(time, environment);
this.setHealth(this.healthValue);
+ this.info.shakeTimer -= time.ElapsedGameTime.Milliseconds;
}
public override void DayUpdate(GameLocation location)
@@ -117,7 +118,8 @@ namespace Revitalize.Framework.Objects.Resources.OreVeins
if (this.location != null)
{
this.location.playSound("hammer");
- ModCore.log("Ore has this much health left: "+this.healthValue);
+ //ModCore.log("Ore has this much health left: "+this.healthValue);
+ this.info.shakeTimer = 200;
}
return false;
}
@@ -277,7 +279,6 @@ namespace Revitalize.Framework.Objects.Resources.OreVeins
/// What happens when the object is drawn at a tile location.
public override void draw(SpriteBatch spriteBatch, int x, int y, float alpha = 1f)
{
-
if (this.info == null)
{
Revitalize.ModCore.log("info is null");
@@ -292,7 +293,7 @@ namespace Revitalize.Framework.Objects.Resources.OreVeins
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));
+ spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize)+this.info.shakeTimerOffset(), (y * Game1.tileSize)+this.info.shakeTimerOffset())), 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?!?!?!?!");
}
@@ -311,7 +312,7 @@ namespace Revitalize.Framework.Objects.Resources.OreVeins
{
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);
+ this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize)+this.info.shakeTimerOffset(), (y * Game1.tileSize)+this.info.shakeTimerOffset())), 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();