diff --git a/GeneralMods/Revitalize/Framework/Objects/BasicItemInformation.cs b/GeneralMods/Revitalize/Framework/Objects/BasicItemInformation.cs
index 3f29e0f4..2a277a07 100644
--- a/GeneralMods/Revitalize/Framework/Objects/BasicItemInformation.cs
+++ b/GeneralMods/Revitalize/Framework/Objects/BasicItemInformation.cs
@@ -27,6 +27,8 @@ namespace Revitalize.Framework.Objects
public AnimationManager animationManager;
public Vector2 drawPosition;
+ public Color drawColor;
+
public BasicItemInformation() : base()
{
name = "";
@@ -41,9 +43,10 @@ namespace Revitalize.Framework.Objects
this.animationManager = null;
this.drawPosition = Vector2.Zero;
+ this.drawColor = Color.White;
}
- public BasicItemInformation(string name, string description, string categoryName, Color categoryColor,int edibility,int fragility,bool isLamp,int price, Vector2 TileLocation,bool canBeSetOutdoors,bool canBeSetIndoors,string id, string data, Texture2D texture, Color color,int tileIndex, bool bigCraftable, Type type, CraftingData craftingData, AnimationManager animationManager):base(id,data,texture,color,tileIndex,bigCraftable,type,craftingData)
+ public BasicItemInformation(string name, string description, string categoryName, Color categoryColor,int edibility,int fragility,bool isLamp,int price, Vector2 TileLocation,bool canBeSetOutdoors,bool canBeSetIndoors,string id, string data, Texture2D texture, Color color,int tileIndex, bool bigCraftable, Type type, CraftingData craftingData, AnimationManager animationManager,Color DrawColor):base(id,data,texture,color,tileIndex,bigCraftable,type,craftingData)
{
this.name = name;
this.description = description;
@@ -71,6 +74,16 @@ namespace Revitalize.Framework.Objects
this.drawPosition = Vector2.Zero;
+ if (DrawColor == null)
+ {
+ this.drawColor = Color.White;
+ }
+ else
+ {
+ this.drawColor = DrawColor;
+ }
+
+
recreateDataString();
}
diff --git a/GeneralMods/Revitalize/Framework/Objects/CustomObject.cs b/GeneralMods/Revitalize/Framework/Objects/CustomObject.cs
index 95a0707c..9e208fe1 100644
--- a/GeneralMods/Revitalize/Framework/Objects/CustomObject.cs
+++ b/GeneralMods/Revitalize/Framework/Objects/CustomObject.cs
@@ -16,7 +16,7 @@ using System.Threading.Tasks;
namespace Revitalize.Framework.Objects
{
///
- /// Change draw functions.
+ /// A custom object template.
///
public class CustomObject : PySObject
{
@@ -24,7 +24,9 @@ namespace Revitalize.Framework.Objects
public string id;
public BasicItemInformation info;
-
+ ///
+ /// The animation manager.
+ ///
public AnimationManager animationManager
{
get
@@ -33,7 +35,9 @@ namespace Revitalize.Framework.Objects
}
}
-
+ ///
+ /// The display texture for this object.
+ ///
public Texture2D displayTexture
{
get
@@ -42,24 +46,38 @@ namespace Revitalize.Framework.Objects
}
}
-
+ ///
+ /// Empty constructor.
+ ///
public CustomObject()
{
}
+ ///
+ /// Constructor.
+ ///
+ ///
public CustomObject(BasicItemInformation info):base(info,Vector2.Zero)
{
this.info = info;
this.initializeBasics();
}
+ ///
+ /// Constructor.
+ ///
+ ///
+ ///
public CustomObject(BasicItemInformation info,Vector2 TileLocation) : base(info, TileLocation)
{
this.info = info;
this.initializeBasics();
}
+ ///
+ /// Sets some basic information up.
+ ///
public virtual void initializeBasics()
{
this.name = info.name;
@@ -78,6 +96,12 @@ namespace Revitalize.Framework.Objects
}
+ ///
+ /// Checks for interaction with the object.
+ ///
+ ///
+ ///
+ ///
public override bool checkForAction(Farmer who, bool justCheckingForActivity = false)
{
var mState = Microsoft.Xna.Framework.Input.Mouse.GetState();
@@ -107,7 +131,11 @@ namespace Revitalize.Framework.Objects
return new CustomObject((BasicItemInformation) CustomObjectData.collection[additionalSaveData["id"]], (replacement as Chest).TileLocation);
}
-
+ ///
+ /// What happens when the player right clicks the object.
+ ///
+ ///
+ ///
public virtual bool rightClicked(Farmer who)
{
// Game1.showRedMessage("YOOO");
@@ -126,12 +154,22 @@ namespace Revitalize.Framework.Objects
return true;
}
+ ///
+ /// What happens when the player shift-right clicks this object.
+ ///
+ ///
+ ///
public virtual bool shiftRightClicked(Farmer who)
{
Revitalize.ModCore.log("Shift right clicked!");
return true;
}
+ ///
+ /// What happens when the player left clicks the object.
+ ///
+ ///
+ ///
public override bool clicked(Farmer who)
{
Revitalize.ModCore.log("Clicky click!");
@@ -140,6 +178,12 @@ namespace Revitalize.Framework.Objects
//return base.clicked(who);
}
+ ///
+ /// What happens when a player uses a tool on this object.
+ ///
+ ///
+ ///
+ ///
public override bool performToolAction(Tool t, GameLocation location)
{
@@ -154,6 +198,10 @@ namespace Revitalize.Framework.Objects
//return base.performToolAction(t, location);
}
+ ///
+ /// Remove the object from the world and add it to the player's inventory if possible.
+ ///
+ ///
public virtual bool removeAndAddToPlayersInventory()
{
if (Game1.player.isInventoryFull())
@@ -166,17 +214,29 @@ namespace Revitalize.Framework.Objects
return true;
}
+ ///
+ /// Gets the category color for the object.
+ ///
+ ///
public override Color getCategoryColor()
{
return info.categoryColor;
//return data.categoryColor;
}
+ ///
+ /// Gets the category name for the object.
+ ///
+ ///
public override string getCategoryName()
{
return info.categoryName;
}
+ ///
+ /// Gets the description for the object.
+ ///
+ ///
public override string getDescription()
{
string text = info.description;
@@ -185,27 +245,49 @@ namespace Revitalize.Framework.Objects
return Game1.parseText(text, smallFont, width);
}
+ ///
+ /// Places an object down.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public override bool placementAction(GameLocation location, int x, int y, Farmer who = null)
{
this.updateDrawPosition();
return base.placementAction(location, x, y, who);
}
+ ///
+ /// Updates a visual draw position.
+ ///
public virtual void updateDrawPosition()
{
this.info.drawPosition = new Vector2((float)this.boundingBox.X, (float)(this.boundingBox.Y - (this.animationManager.currentAnimation.sourceRectangle.Height * Game1.pixelZoom - this.boundingBox.Height)));
}
+ ///
+ /// Gets a clone of the game object.
+ ///
+ ///
public override Item getOne()
{
return new CustomObject((BasicItemInformation)this.data);
}
+ ///
+ /// 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 (x == -1)
{
- spriteBatch.Draw(this.info.animationManager.getTexture(), Game1.GlobalToLocal(Game1.viewport, this.info.drawPosition), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
+ spriteBatch.Draw(this.info.animationManager.getTexture(), Game1.GlobalToLocal(Game1.viewport, this.info.drawPosition), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
}
else
{
@@ -218,14 +300,14 @@ namespace Revitalize.Framework.Objects
}
- spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
+ spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
// Log.AsyncG("ANIMATION IS NULL?!?!?!?!");
}
else
{
//Log.AsyncC("Animation Manager is working!");
- 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), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
+ 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), info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
try
{
this.animationManager.tickAnimation();
@@ -244,6 +326,14 @@ namespace Revitalize.Framework.Objects
}
}
+ ///
+ /// Draw the game object at a non-tile spot. Aka like debris.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public override void draw(SpriteBatch spriteBatch, int xNonTile, int yNonTile, float layerDepth, float alpha = 1f)
{
@@ -263,7 +353,7 @@ namespace Revitalize.Framework.Objects
int num3 = (bool)(this.flipped) ? 1 : 0;
double num4 = (double)layerDepth;
- spriteBatch1.Draw(this.displayTexture, local, this.animationManager.defaultDrawFrame.sourceRectangle, color, (float)num1, origin, (float)4f, (SpriteEffects)num3, (float)num4);
+ spriteBatch1.Draw(this.displayTexture, local, this.animationManager.defaultDrawFrame.sourceRectangle, info.drawColor*alpha, (float)num1, origin, (float)4f, (SpriteEffects)num3, (float)num4);
}
@@ -279,6 +369,17 @@ namespace Revitalize.Framework.Objects
base.drawAttachments(b, x, y);
}
+ ///
+ /// What happens when the object is drawn in a menu.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, bool drawStackNumber, Color c, bool drawShadow)
{
if (drawStackNumber && this.maximumStackSize() > 1 && ((double)scaleSize > 0.3 && this.Stack != int.MaxValue) && this.Stack > 1)
@@ -288,7 +389,7 @@ namespace Revitalize.Framework.Objects
float num = this.Quality < 4 ? 0.0f : (float)((Math.Cos((double)Game1.currentGameTime.TotalGameTime.Milliseconds * Math.PI / 512.0) + 1.0) * 0.0500000007450581);
spriteBatch.Draw(Game1.mouseCursors, location + new Vector2(12f, (float)(Game1.tileSize - 12) + num), new Microsoft.Xna.Framework.Rectangle?(this.Quality < 4 ? new Microsoft.Xna.Framework.Rectangle(338 + (this.Quality - 1) * 8, 400, 8, 8) : new Microsoft.Xna.Framework.Rectangle(346, 392, 8, 8)), Color.White * transparency, 0.0f, new Vector2(4f, 4f), (float)(3.0 * (double)scaleSize * (1.0 + (double)num)), SpriteEffects.None, layerDepth);
}
- spriteBatch.Draw(this.displayTexture, location + new Vector2((float)(Game1.tileSize/2), (float)(Game1.tileSize*.75)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), Color.White * transparency, 0f, new Vector2((float)(this.animationManager.currentAnimation.sourceRectangle.Width / 2), (float)(this.animationManager.currentAnimation.sourceRectangle.Height)), 3f, SpriteEffects.None, layerDepth);
+ spriteBatch.Draw(this.displayTexture, location + new Vector2((float)(Game1.tileSize/2), (float)(Game1.tileSize*.75)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), info.drawColor*transparency, 0f, new Vector2((float)(this.animationManager.currentAnimation.sourceRectangle.Width / 2), (float)(this.animationManager.currentAnimation.sourceRectangle.Height)), 3f, SpriteEffects.None, layerDepth);
}
public override void drawPlacementBounds(SpriteBatch spriteBatch, GameLocation location)
@@ -296,15 +397,22 @@ namespace Revitalize.Framework.Objects
base.drawPlacementBounds(spriteBatch, location);
}
+
+ ///
+ /// What happens when the object is drawn when held by a player.
+ ///
+ ///
+ ///
+ ///
public override void drawWhenHeld(SpriteBatch spriteBatch, Vector2 objectPosition, StardewValley.Farmer f)
{
if (f.ActiveObject.bigCraftable.Value)
{
- spriteBatch.Draw(this.displayTexture, objectPosition, this.animationManager.currentAnimation.sourceRectangle, Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, Math.Max(0f, (float)(f.getStandingY() + 2) / 10000f));
+ spriteBatch.Draw(this.displayTexture, objectPosition, this.animationManager.currentAnimation.sourceRectangle, info.drawColor, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, Math.Max(0f, (float)(f.getStandingY() + 2) / 10000f));
return;
}
- spriteBatch.Draw(this.displayTexture, objectPosition, this.animationManager.currentAnimation.sourceRectangle, Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, Math.Max(0f, (float)(f.getStandingY() + 2) / 10000f));
+ spriteBatch.Draw(this.displayTexture, objectPosition, this.animationManager.currentAnimation.sourceRectangle, info.drawColor, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, Math.Max(0f, (float)(f.getStandingY() + 2) / 10000f));
if (f.ActiveObject != null && f.ActiveObject.Name.Contains("="))
{
spriteBatch.Draw(this.displayTexture, objectPosition + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), this.animationManager.currentAnimation.sourceRectangle, Color.White, 0f, new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), (float)Game1.pixelZoom + Math.Abs(Game1.starCropShimmerPause) / 8f, SpriteEffects.None, Math.Max(0f, (float)(f.getStandingY() + 2) / 10000f));
diff --git a/GeneralMods/Revitalize/ModCore.cs b/GeneralMods/Revitalize/ModCore.cs
index 46f62943..924875d8 100644
--- a/GeneralMods/Revitalize/ModCore.cs
+++ b/GeneralMods/Revitalize/ModCore.cs
@@ -30,7 +30,7 @@ namespace Revitalize
private void GameLoop_SaveLoaded(object sender, StardewModdingAPI.Events.SaveLoadedEventArgs e)
{
- CustomObject obj = new CustomObject(new BasicItemInformation("CoreObjectTest","YAY FUN!","Omegasis.Revitalize.CoreObject",Color.Violet,-300,0,false,100,Vector2.Zero,true,true,"Omegasis.bleh", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", Game1.objectSpriteSheet,Color.White,0,true,typeof(CustomObject),null,new Framework.Graphics.Animations.AnimationManager()));
+ CustomObject obj = new CustomObject(new BasicItemInformation("CoreObjectTest","YAY FUN!","Omegasis.Revitalize.CoreObject",Color.Violet,-300,0,false,100,Vector2.Zero,true,true,"Omegasis.bleh", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", Game1.objectSpriteSheet,Color.White,0,true,typeof(CustomObject),null,new Framework.Graphics.Animations.AnimationManager(),Color.Red));
new InventoryItem(obj, 100,1).addToNPCShop("Gus");