diff --git a/GeneralMods/CustomNPCFramework/Class1.cs b/GeneralMods/CustomNPCFramework/Class1.cs
index c1755c9f..4a96a29d 100644
--- a/GeneralMods/CustomNPCFramework/Class1.cs
+++ b/GeneralMods/CustomNPCFramework/Class1.cs
@@ -42,14 +42,30 @@ namespace CustomNPCFramework
///
-
public class Class1 : Mod
{
+ ///
+ /// The mod helper for the mod.
+ ///
public static IModHelper ModHelper;
+ ///
+ /// The mod monitor for the mod.
+ ///
public static IMonitor ModMonitor;
+ ///
+ /// The npc tracker for the mod. Keeps track of all npcs added by the custom framework and cleans them up during saving.
+ ///
public static NPCTracker npcTracker;
+ ///
+ /// Keeps track of all of the asets/textures added in by the framework. Also manages all of the asset managers that are the ones actually managing the textures.
+ ///
public static AssetPool assetPool;
+
+ ///
+ /// Ran when loading the SMAPI. Used to initialize data.
+ ///
+ ///
public override void Entry(IModHelper helper)
{
ModHelper = this.Helper;
@@ -71,24 +87,43 @@ namespace CustomNPCFramework
assetPool.loadAllAssets();
}
+ ///
+ /// Initialize the asset pool with some test variables.
+ ///
public void initializeAssetPool()
{
string path = Path.Combine(ModHelper.DirectoryPath, "Content", "Graphics", "NPCS");
assetPool.getAssetManager("testNPC").addPathCreateDirectory(new KeyValuePair("characters", path));
}
+ ///
+ /// A function that is called when the game finishes saving.
+ ///
+ ///
+ ///
private void SaveEvents_AfterSave(object sender, EventArgs e)
{
npcTracker.afterSave();
}
+ ///
+ /// A function that is called when the game is about to load. Used to clean up all the npcs from the game world to prevent it from crashing.
+ ///
+ ///
+ ///
private void SaveEvents_BeforeSave(object sender, EventArgs e)
{
npcTracker.cleanUpBeforeSave();
}
+ ///
+ /// Called upon 60 times a second. For testing purposes only. Will remove in future release.
+ ///
+ ///
+ ///
private void GameEvents_UpdateTick(object sender, EventArgs e)
{
+ /*
if (Game1.player.currentLocation == null) return;
if (Game1.activeClickableMenu != null) return;
foreach (var v in Game1.player.currentLocation.characters)
@@ -101,8 +136,14 @@ namespace CustomNPCFramework
//v.MovePosition(Game1.currentGameTime, Game1.viewport, Game1.player.currentLocation);
//ModMonitor.Log(v.sprite.spriteHeight.ToString());
}
+ */
}
+ ///
+ /// Called when the player's location changes.
+ ///
+ ///
+ ///
private void LocationEvents_CurrentLocationChanged(object sender, StardewModdingAPI.Events.EventArgsCurrentLocationChanged e)
{
@@ -124,6 +165,9 @@ namespace CustomNPCFramework
npcTracker.addNewNPCToLocation(Game1.getLocationFromName("BusStop", false), merch,new Vector2(2,23));
}
+ ///
+ /// Used to initialize examples for other modders to look at as reference.
+ ///
public void initializeExamples()
{
return;
@@ -153,6 +197,11 @@ namespace CustomNPCFramework
}
}
+ ///
+ /// Used to splice the mod directory to get relative paths.
+ ///
+ ///
+ ///
public static string getShortenedDirectory(string path)
{
string lol = (string)path.Clone();
@@ -167,6 +216,11 @@ namespace CustomNPCFramework
}
}
+ ///
+ /// Used to finish cleaning up absolute asset paths into a shortened relative path.
+ ///
+ ///
+ ///
public static string getRelativeDirectory(string path)
{
string s = getShortenedDirectory(path);
diff --git a/GeneralMods/CustomNPCFramework/Framework/Graphics/AssetSheet.cs b/GeneralMods/CustomNPCFramework/Framework/Graphics/AssetSheet.cs
index 6ac92683..c7119852 100644
--- a/GeneralMods/CustomNPCFramework/Framework/Graphics/AssetSheet.cs
+++ b/GeneralMods/CustomNPCFramework/Framework/Graphics/AssetSheet.cs
@@ -37,7 +37,6 @@ namespace CustomNPCFramework.Framework.Graphics
public Rectangle currentAsset;
public int index;
-
///
/// Constructor.
///
@@ -59,7 +58,6 @@ namespace CustomNPCFramework.Framework.Graphics
this.index = 0;
}
-
///
/// Get the path to the current texture.
///
diff --git a/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/AnimatedSpriteCollection.cs b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/AnimatedSpriteCollection.cs
index 0b31d26c..9144413c 100644
--- a/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/AnimatedSpriteCollection.cs
+++ b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/AnimatedSpriteCollection.cs
@@ -16,11 +16,26 @@ namespace CustomNPCFramework.Framework.ModularNPCS
///
public class AnimatedSpriteCollection
{
+ ///
+ /// The left sprite for this sprite asset part.
+ ///
AnimatedSpriteExtended leftSprite;
+ ///
+ /// The right sprite for this sprite asset part.
+ ///
AnimatedSpriteExtended rightSprite;
+ ///
+ /// The up sprite for this sprite asset part.
+ ///
AnimatedSpriteExtended upSprite;
+ ///
+ /// The down sprite for this sprite asset part.
+ ///
AnimatedSpriteExtended downSprite;
+ ///
+ /// The current sprite for this sprite collection. This is one of the four directions for this collection.
+ ///
public AnimatedSpriteExtended currentSprite;
///
@@ -55,6 +70,9 @@ namespace CustomNPCFramework.Framework.ModularNPCS
}
}
+ ///
+ /// Reloads all of the directional textures for this texture collection.
+ ///
public virtual void reload()
{
this.leftSprite.reload();
@@ -64,23 +82,32 @@ namespace CustomNPCFramework.Framework.ModularNPCS
}
///
- /// Sets the current
+ /// Sets the current sprite direction to face left.
///
public void setLeft()
{
this.currentSprite = leftSprite;
}
+ ///
+ /// Sets the current sprite direction to face right.
+ ///
public void setRight()
{
this.currentSprite = rightSprite;
}
+ ///
+ /// Sets the current sprite direction to face down.
+ ///
public void setDown()
{
this.currentSprite = downSprite;
}
+ ///
+ /// Sets the current sprite direction to face up.
+ ///
public void setUp()
{
this.currentSprite = upSprite;
@@ -140,18 +167,22 @@ namespace CustomNPCFramework.Framework.ModularNPCS
///
/// Animate the current sprite. Theoreticlly works from index offset to how many frames
///
- ///
- public void Animate(float intervalFromCharacter,bool loop=true)
+ /// The delay in milliseconds between frames.
+ public void Animate(float intervalDelay,bool loop=true)
{
- //ANIMATE AND UPDATE SOURCE RECTANGLE NOT WORKING!!!! FIGURE THIS OUT!!!!
- //Class1.ModMonitor.Log("Current sprite frame:"+this.currentSprite.sprite.currentFrame.ToString());
- //Class1.ModMonitor.Log("Am I ignoring something??: " + this.currentSprite.sprite.ignoreSourceRectUpdates);
- //Class1.ModMonitor.Log("Current Sprite Source Rect:" + this.currentSprite.sprite.sourceRect);
- //Class1.ModMonitor.Log("Sprite width: " + this.currentSprite.sprite.spriteWidth);
- //Class1.ModMonitor.Log("Sprite width: " + this.currentSprite.sprite.spriteHeight);
- this.Animate(Game1.currentGameTime, 0,2, intervalFromCharacter,this.currentSprite.sprite,loop);
+ this.Animate(Game1.currentGameTime, 0,2, intervalDelay,this.currentSprite.sprite,loop);
}
+ ///
+ /// Animate the current sprite.
+ ///
+ /// The game time from Monogames/XNA
+ /// The starting frame of the animation on the sprite sheet.
+ /// The number of frames to animate the sprite.
+ /// The delay between frames in milliseconds.
+ /// The animated sprite from the npc.
+ /// If true, the animation plays over and over again.
+ ///
public virtual bool Animate(GameTime gameTime, int startFrame, int numberOfFrames, float interval, AnimatedSprite sprite, bool loop=true)
{
if (sprite.CurrentFrame >= startFrame + numberOfFrames + 1 || sprite.CurrentFrame < startFrame)
@@ -173,6 +204,10 @@ namespace CustomNPCFramework.Framework.ModularNPCS
return false;
}
+ ///
+ /// Update the source rectangle on the sprite sheet. Needed for animation.
+ ///
+ ///
public virtual void UpdateSourceRect(AnimatedSprite sprite)
{
if (sprite.ignoreSourceRectUpdates)
diff --git a/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/AnimatedSpriteExtended.cs b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/AnimatedSpriteExtended.cs
index 430c36d8..55731336 100644
--- a/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/AnimatedSpriteExtended.cs
+++ b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/AnimatedSpriteExtended.cs
@@ -8,9 +8,18 @@ using System.Threading.Tasks;
namespace CustomNPCFramework.Framework.ModularNPCS
{
+ ///
+ /// Used as a wrapper for the AnimatedSprite class.
+ ///
public class AnimatedSpriteExtended
{
+ ///
+ /// The actual sprite of the object.
+ ///
public AnimatedSprite sprite;
+ ///
+ /// The path to the texture to load the sprite from.
+ ///
public string path;
diff --git a/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/CharacterAnimationBases/StandardCharacterAnimation.cs b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/CharacterAnimationBases/StandardCharacterAnimation.cs
index d23aa91b..c563354b 100644
--- a/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/CharacterAnimationBases/StandardCharacterAnimation.cs
+++ b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/CharacterAnimationBases/StandardCharacterAnimation.cs
@@ -11,17 +11,52 @@ using System.Threading.Tasks;
namespace CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases
{
+ ///
+ /// A class used to reference the different textures used to comprise the different parts for character rendering.
+ ///
public class StandardCharacterAnimation :CharacterAnimationBase
{
+ ///
+ /// Used to hold all of the information for the npc hair part.
+ ///
public AnimatedSpriteCollection hair;
+ ///
+ /// Used to hold all of the information for the npc body part.
+ ///
public AnimatedSpriteCollection body;
+ ///
+ /// Used to hold all of the information for the npc eyes part.
+ ///
public AnimatedSpriteCollection eyes;
+ ///
+ /// Used to hold all of the information for the npc shirt part.
+ ///
public AnimatedSpriteCollection shirt;
+ ///
+ /// Used to hold all of the information for the npc pants part.
+ ///
public AnimatedSpriteCollection pants;
+ ///
+ /// Used to hold all of the information for the npc shoes part.
+ ///
public AnimatedSpriteCollection shoes;
+ ///
+ /// Used to hold all of the information for draw colors for the different parts.
+ ///
public StandardColorCollection drawColors;
public List accessories;
+ ///
+ /// Constructor.
+ ///
+ /// The collection of textures to be used for the body part for the npc.
+ /// The collection of textures to be used for the eyes part for the npc.
+ /// The collection of textures to be used for the hair part for the npc.
+ /// The collection of textures to be used for the shirt part for the npc.
+ /// The collection of textures to be used for the pants part for the npc.
+ /// The collection of textures to be used for the shoes part for the npc.
+ /// The collection of textures to be used for the accessories part for the npc.
+ /// The collection of draw colors for the different parts for the npc.
public StandardCharacterAnimation(AnimatedSpriteCollection bodyAnimation, AnimatedSpriteCollection eyeAnimation, AnimatedSpriteCollection hairAnimation, AnimatedSpriteCollection shirtAnimation, AnimatedSpriteCollection pantsAnimation, AnimatedSpriteCollection shoesAnimation,List accessoriesWithAnimations, StandardColorCollection DrawColors) :base()
{
this.body = bodyAnimation;
@@ -34,6 +69,9 @@ namespace CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases
this.drawColors = DrawColors;
}
+ ///
+ /// Sets all of the different textures to face left.
+ ///
public override void setLeft()
{
this.body.setLeft();
@@ -48,6 +86,9 @@ namespace CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases
accessory.setLeft();
}
}
+ ///
+ /// Sets all of the different textures to face right.
+ ///
public override void setRight()
{
this.body.setRight();
@@ -62,6 +103,9 @@ namespace CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases
accessory.setRight();
}
}
+ ///
+ /// Sets all of the different textures to face up.
+ ///
public override void setUp()
{
this.body.setUp();
@@ -76,6 +120,9 @@ namespace CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases
accessory.setUp();
}
}
+ ///
+ /// Sets all of the different textures to face down.
+ ///
public override void setDown()
{
this.body.setDown();
@@ -91,6 +138,9 @@ namespace CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases
}
}
+ ///
+ /// Reloads all of the sprite textures.
+ ///
public override void reload()
{
this.body.reload();
@@ -101,6 +151,11 @@ namespace CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases
this.shoes.reload();
}
+ ///
+ /// Animates all of the textures for this sprite.
+ ///
+ /// The delay in milliseconds between animation frames.
+ /// Determines if the animation continuously plays over and over.
public override void Animate(float animationInterval,bool loop=true)
{
this.body.Animate(animationInterval,loop);
diff --git a/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/ColorCollections/StandardColorCollection.cs b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/ColorCollections/StandardColorCollection.cs
index 52d6a073..c27922e7 100644
--- a/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/ColorCollections/StandardColorCollection.cs
+++ b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/ColorCollections/StandardColorCollection.cs
@@ -12,11 +12,29 @@ namespace CustomNPCFramework.Framework.ModularNPCS.ColorCollections
///
public class StandardColorCollection
{
+ ///
+ /// The draw color to be used for the body sprite for the npc.
+ ///
public Color bodyColor;
+ ///
+ /// The draw color to be used for the eye sprite for the npc.
+ ///
public Color eyeColor;
+ ///
+ /// The draw color to be used for the hair sprite for the npc.
+ ///
public Color hairColor;
+ ///
+ /// The draw color to be used for the shirt sprite for the npc.
+ ///
public Color shirtColor;
+ ///
+ /// The draw color to be used for the bottoms/pants sprite for the npc.
+ ///
public Color bottomsColor;
+ ///
+ /// The draw color to be used for the shoes sprite for the npc.
+ ///
public Color shoesColor;
///
@@ -67,6 +85,12 @@ namespace CustomNPCFramework.Framework.ModularNPCS.ColorCollections
if (color == null) color = Color.White;
}
+ ///
+ /// Used to mix colors together.
+ ///
+ /// The base color to mix.
+ /// The modifier color to mix.
+ /// A color that is a mix between the two colors passed in.
public static Color colorMult(Color cBase, Color cMult)
{
Vector3 color1 = cBase.ToVector3();
diff --git a/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/ModularRenderers/AnimationKeys.cs b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/ModularRenderers/AnimationKeys.cs
index 502b540a..de9249ae 100644
--- a/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/ModularRenderers/AnimationKeys.cs
+++ b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/ModularRenderers/AnimationKeys.cs
@@ -6,11 +6,26 @@ using System.Threading.Tasks;
namespace CustomNPCFramework.Framework.ModularNPCS.ModularRenderers
{
- class AnimationKeys
+ ///
+ /// A class used instead of an enum to hold keys for all of the different animations.
+ ///
+ public class AnimationKeys
{
+ ///
+ /// The string that is used for the standing animation.
+ ///
public static string standingKey = "standing";
+ ///
+ /// The string that is used for the walking/moving animation.
+ ///
public static string walkingKey = "walking";
+ ///
+ /// The string that is used for the sitting animation.
+ ///
public static string sittingKey = "sitting";
+ ///
+ /// The string that is used for the swimming animation.
+ ///
public static string swimmingKey = "swimming";
}
}
diff --git a/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/ModularRenderers/BasicRenderer.cs b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/ModularRenderers/BasicRenderer.cs
index 7e69f930..6ea6629b 100644
--- a/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/ModularRenderers/BasicRenderer.cs
+++ b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/ModularRenderers/BasicRenderer.cs
@@ -1,4 +1,6 @@
-using CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases;
+using CustomNPCFramework.Framework.Enums;
+using CustomNPCFramework.Framework.Graphics;
+using CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases;
using CustomNPCFramework.Framework.NPCS;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
@@ -11,11 +13,26 @@ using System.Threading.Tasks;
namespace CustomNPCFramework.Framework.ModularNPCS.ModularRenderers
{
+ ///
+ /// A class used to hold all of the textures/animations/information to make modular npc rendering possible.
+ ///
public class BasicRenderer
{
+ ///
+ /// Dictionary that holds key pair values of (animationName,Animation). USed to manage multiple animations.
+ ///
public Dictionary animationList;
+ ///
+ /// Used to keep track of what animation is currently being used.
+ ///
public StandardCharacterAnimation currentAnimation;
+ ///
+ /// Constructor.
+ ///
+ /// The animation information to be used when the character is standing.
+ /// The animation information to be used when the character is walking/moving.
+ /// The animation information to be used when the character is walking/moving.
public BasicRenderer(StandardCharacterAnimation standingAnimation,StandardCharacterAnimation walkingAnimation, StandardCharacterAnimation swimmingAnimation)
{
animationList = new Dictionary();
@@ -28,7 +45,7 @@ namespace CustomNPCFramework.Framework.ModularNPCS.ModularRenderers
///
/// Sets the animation associated with the key name; If it fails the npc will just default to standing.
///
- ///
+ /// The name of the animation to swap the current animation to.
public virtual void setAnimation(string key)
{
this.currentAnimation = animationList[key];
@@ -39,6 +56,10 @@ namespace CustomNPCFramework.Framework.ModularNPCS.ModularRenderers
}
}
+ ///
+ /// Sets the direction of the current animated sprite respectively.
+ ///
+ /// The direction to face. 0=up, 1=right, 2= down, 3=left.
public virtual void setDirection(int facingDirection)
{
if (facingDirection == 0) setUp();
@@ -47,26 +68,54 @@ namespace CustomNPCFramework.Framework.ModularNPCS.ModularRenderers
if (facingDirection == 2) setLeft();
}
+ ///
+ /// Sets the direction of the current animated sprite respectively to the direction passed in.
+ ///
+ /// The direction to face.
+ public virtual void setDirection(Direction direction)
+ {
+ if (direction == Direction.up) setUp();
+ if (direction == Direction.right) setRight();
+ if (direction == Direction.down) setDown();
+ if (direction == Direction.left) setLeft();
+ }
+
+
+ ///
+ /// Sets the current animated sprite to face left.
+ ///
public virtual void setLeft()
{
this.currentAnimation.setLeft();
}
+ ///
+ /// Sets the current animated sprite to face right.
+ ///
public virtual void setRight()
{
this.currentAnimation.setRight();
}
+ ///
+ /// Sets the current animated sprite to face up.
+ ///
public virtual void setUp()
{
this.currentAnimation.setUp();
}
-
+
+ ///
+ /// Sets the current animated sprite to face down.
+ ///
public virtual void setDown()
{
this.currentAnimation.setDown();
}
+ ///
+ /// Used to reload all of the sprites pertaining to all of the animations stored in this renderer.
+ ///
public virtual void reloadSprites()
{
foreach(var v in this.animationList)
@@ -124,6 +173,11 @@ namespace CustomNPCFramework.Framework.ModularNPCS.ModularRenderers
}
+ ///
+ /// Animates the current animation for the current sprite.
+ ///
+ ///
+ ///
public virtual void Animate(float interval, bool loop=true)
{
this.currentAnimation.Animate(interval,loop);
diff --git a/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/Portrait.cs b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/Portrait.cs
index eae4739e..4e6b10aa 100644
--- a/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/Portrait.cs
+++ b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/Portrait.cs
@@ -8,9 +8,18 @@ using System.Threading.Tasks;
namespace CustomNPCFramework.Framework.ModularNPCS
{
+ ///
+ /// Used as a wrapper for npc portraits.
+ ///
public class Portrait
{
+ ///
+ /// Used to display the npc portrait.
+ ///
public Texture2D portrait;
+ ///
+ /// Used to hold the path to the texture to use for the npc portrait.
+ ///
public string relativePath;
///
diff --git a/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/Sprite.cs b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/Sprite.cs
index a076ca1f..4854c000 100644
--- a/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/Sprite.cs
+++ b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/Sprite.cs
@@ -10,9 +10,18 @@ using System.Threading.Tasks;
namespace CustomNPCFramework.Framework.ModularNPCS
{
+ ///
+ /// Used as a wrapper for the npcs to hold sprite information.
+ ///
public class Sprite
{
+ ///
+ /// The actual sprite to draw for the npc.
+ ///
public AnimatedSprite sprite;
+ ///
+ /// The path to the texture to use for the animated sprite.
+ ///
public string relativePath;
///
diff --git a/GeneralMods/CustomNPCFramework/Framework/NPCNames.cs b/GeneralMods/CustomNPCFramework/Framework/NPCNames.cs
index 38ddfdf2..6ede8e02 100644
--- a/GeneralMods/CustomNPCFramework/Framework/NPCNames.cs
+++ b/GeneralMods/CustomNPCFramework/Framework/NPCNames.cs
@@ -8,6 +8,9 @@ using System.Threading.Tasks;
namespace CustomNPCFramework.Framework
{
+ ///
+ /// Used as a class to hold all of the possible npc names.
+ ///
public class NPCNames
{
///
diff --git a/GeneralMods/CustomNPCFramework/Framework/NPCS/ExtendedNPC.cs b/GeneralMods/CustomNPCFramework/Framework/NPCS/ExtendedNPC.cs
index 498f4b6b..626c5212 100644
--- a/GeneralMods/CustomNPCFramework/Framework/NPCS/ExtendedNPC.cs
+++ b/GeneralMods/CustomNPCFramework/Framework/NPCS/ExtendedNPC.cs
@@ -27,6 +27,9 @@ namespace CustomNPCFramework.Framework.NPCS
///
public class ExtendedNPC :StardewValley.NPC
{
+ ///
+ /// The custom character renderer for this npc.
+ ///
public BasicRenderer characterRenderer;
public bool hasBeenKissedToday;
public Point previousEndPoint;
@@ -34,16 +37,35 @@ namespace CustomNPCFramework.Framework.NPCS
public bool hasSaidAfternoonDialogue;
public int timeAfterSquare;
+ ///
+ /// Used to hold sprite information to be used in the case the npc renderer is null.
+ ///
public Sprite spriteInformation;
+ ///
+ /// Used to hold the portrait information for the npc and display it.
+ ///
public Portrait portraitInformation;
+ ///
+ /// The default location for this npc to reside in.
+ ///
public GameLocation defaultLocation;
+ ///
+ /// Empty Constructor.
+ ///
public ExtendedNPC() :base()
{
}
+ ///
+ /// Non modular npc Constructor.
+ ///
+ /// The sprite for the character.
+ /// The position of the npc on the map.
+ /// The direction of the npc
+ /// The name of the npc.
public ExtendedNPC(Sprite sprite, Vector2 position, int facingDirection, string name) : base(sprite.sprite, position, facingDirection, name, null)
{
this.characterRenderer = null;
@@ -57,6 +79,14 @@ namespace CustomNPCFramework.Framework.NPCS
this.swimming = false;
}
+ ///
+ /// Non modular npc Constructor.
+ ///
+ /// The sprite for the character.
+ /// The portrait texture for this npc.
+ /// The position of the npc on the map.
+ /// The direction of the npc
+ /// The name of the npc.
public ExtendedNPC(Sprite sprite, Portrait portrait, Vector2 position, int facingDirection, string name) : base(sprite.sprite, position, facingDirection, name, null)
{
this.characterRenderer = null;
@@ -70,6 +100,15 @@ namespace CustomNPCFramework.Framework.NPCS
this.swimming = false;
}
+ ///
+ /// Modular npc constructor.
+ ///
+ /// The sprite for the character to use incase the renderer is null.
+ /// The custom npc render. Used to draw the npcfrom a collection of assets.
+ /// The portrait texture for this npc.
+ /// The position of the npc on the map.
+ /// The direction of the npc
+ /// The name of the npc.
public ExtendedNPC(Sprite sprite,BasicRenderer renderer,Vector2 position,int facingDirection,string name): base(sprite.sprite, position, facingDirection, name, null)
{
this.characterRenderer = renderer;
@@ -83,6 +122,15 @@ namespace CustomNPCFramework.Framework.NPCS
this.swimming = false;
}
+ ///
+ /// Modular constructor for the npc.
+ ///
+ /// The sprite for the npc to use incase the renderer is null.
+ /// The custom npc renderer used to draw the npc from the collection of textures.
+ /// The portrait texture for the npc.
+ /// The positon for the npc to be.
+ /// The direction for the npc to face.
+ /// The name for the npc.
public ExtendedNPC(Sprite sprite,BasicRenderer renderer,Portrait portrait, Vector2 position, int facingDirection, string name) : base(sprite.sprite, position, facingDirection, name, null)
{
this.characterRenderer = renderer;
@@ -99,7 +147,9 @@ namespace CustomNPCFramework.Framework.NPCS
this.swimming = false;
}
- //ERROR NEED FIXING
+ ///
+ /// Used to reload the sprite for the npc.
+ ///
public override void reloadSprite()
{
if (this.characterRenderer == null)
@@ -150,13 +200,24 @@ namespace CustomNPCFramework.Framework.NPCS
}
+ ///
+ /// Functionality used when interacting with the npc.
+ ///
+ ///
+ ///
+ ///
public override bool checkAction(StardewValley.Farmer who, GameLocation l)
{
base.checkAction(who, l);
return false;
}
- //ERROR NEED FIXING
+ ///
+ /// Used to move the npc. Different code is used depending if the character renderer is null or not.
+ ///
+ ///
+ ///
+ ///
public override void MovePosition(GameTime time, xTile.Dimensions.Rectangle viewport, GameLocation currentLocation)
{
if (this.characterRenderer != null)
@@ -188,12 +249,23 @@ namespace CustomNPCFramework.Framework.NPCS
this.MovePosition(time, viewport, currentLocation);
}
+ ///
+ /// USed to move the npc if the character renderer is null.
+ ///
+ ///
+ ///
+ ///
public virtual void NonModularMovement(GameTime time, xTile.Dimensions.Rectangle viewport, GameLocation location)
{
base.MovePosition(time, viewport, currentLocation);
return;
}
+ ///
+ /// Used to determine if the npc can move past the next location.
+ ///
+ ///
+ ///
public virtual bool canMovePastNextLocation(xTile.Dimensions.Rectangle viewport)
{
//Up
@@ -219,9 +291,15 @@ namespace CustomNPCFramework.Framework.NPCS
return true;
}
+ ///
+ /// Used to move the npc if the character renderer is valid. Handles animating all of the sprites associated with the renderer.
+ ///
+ ///
+ ///
+ ///
+ ///
public virtual void ModularMovement(GameTime time, xTile.Dimensions.Rectangle viewport, GameLocation location, float interval = 1000f)
{
- interval /= 2;
this.characterRenderer.setAnimation(AnimationKeys.walkingKey);
if (this.canMovePastNextLocation(viewport) == false)
{
@@ -369,17 +447,32 @@ namespace CustomNPCFramework.Framework.NPCS
}
}
+ ///
+ /// Used to halt the npc sprite. Sets the npc's animation to the standing animation if the character renderer is not null.
+ ///
public override void Halt()
{
- this.characterRenderer.setAnimation(AnimationKeys.standingKey);
+ if (this.characterRenderer != null)
+ {
+ this.characterRenderer.setAnimation(AnimationKeys.standingKey);
+ }
base.Halt();
}
+ ///
+ /// Used to update npc information.
+ ///
+ ///
+ ///
public override void update(GameTime time, GameLocation location)
{
base.update(time, location);
}
+ ///
+ /// Pathfinding code.
+ ///
+ ///
public virtual void routeEndAnimationFinished(StardewValley.Farmer who)
{
this.doingEndOfRouteAnimation = false;
@@ -397,11 +490,20 @@ namespace CustomNPCFramework.Framework.NPCS
this.timeAfterSquare = Game1.timeOfDay;
}
+ ///
+ /// Pathfinding code.
+ ///
+ ///
+ ///
public virtual void doAnimationAtEndOfScheduleRoute(Character c, GameLocation l)
{
}
+ ///
+ /// Pathfinding code.
+ ///
+ ///
public virtual void startRouteBehavior(string behaviorName)
{
if (behaviorName.Length > 0 && (int)behaviorName[0] == 34)
@@ -429,6 +531,11 @@ namespace CustomNPCFramework.Framework.NPCS
}
+ ///
+ /// Occurs when the npc gets hit by the player.
+ ///
+ ///
+ ///
public new void getHitByPlayer(StardewValley.Farmer who, GameLocation location)
{
this.doEmote(12, true);
diff --git a/GeneralMods/CustomNPCFramework/Framework/NPCS/MerchantNPC.cs b/GeneralMods/CustomNPCFramework/Framework/NPCS/MerchantNPC.cs
index 95f9ac3c..406d4fa0 100644
--- a/GeneralMods/CustomNPCFramework/Framework/NPCS/MerchantNPC.cs
+++ b/GeneralMods/CustomNPCFramework/Framework/NPCS/MerchantNPC.cs
@@ -10,20 +10,46 @@ using System.Threading.Tasks;
namespace CustomNPCFramework.Framework.NPCS
{
+ ///
+ /// Extended merchant npc from ExtendedNPC.
+ ///
class MerchantNPC: ExtendedNPC
{
+ ///
+ /// Thelist of items this npc has for sale.
+ ///
public List- stock;
+ ///
+ /// Constructor.
+ ///
+ /// The list of items this npc will sell.
+ /// The sprite for the npc to use.
+ /// The renderer for the npc to use.
+ /// The position for the npc to use.
+ /// The facing direction for the player to face.
+ /// The name for the npc.
public MerchantNPC(List
- Stock, Sprite sprite, BasicRenderer renderer,Vector2 position,int facingDirection,string name): base(sprite,renderer,position,facingDirection,name)
{
this.stock = Stock;
}
+ ///
+ /// Constructor.
+ ///
+ /// The list of items for the npc to sell.
+ /// The npc base for the character to be expanded upon.
public MerchantNPC(List
- Stock, ExtendedNPC npcBase) : base(npcBase.spriteInformation, npcBase.characterRenderer, npcBase.portraitInformation, npcBase.position, npcBase.facingDirection, npcBase.name)
{
this.stock = Stock;
}
+ ///
+ /// Used to interact with the npc. When interacting pulls up a shop menu for the npc with their current stock.
+ ///
+ ///
+ ///
+ ///
public override bool checkAction(StardewValley.Farmer who, GameLocation l)
{
if (Game1.activeClickableMenu == null)
diff --git a/GeneralMods/CustomNPCFramework/Framework/Utilities/NPCTracker.cs b/GeneralMods/CustomNPCFramework/Framework/Utilities/NPCTracker.cs
index 5c80adf9..1ccbbbd7 100644
--- a/GeneralMods/CustomNPCFramework/Framework/Utilities/NPCTracker.cs
+++ b/GeneralMods/CustomNPCFramework/Framework/Utilities/NPCTracker.cs
@@ -9,6 +9,9 @@ using System.Threading.Tasks;
namespace CustomNPCFramework.Framework.Utilities
{
+ ///
+ /// Used to keep track of all of the custom npcs.
+ ///
public class NPCTracker
{
///
@@ -27,8 +30,8 @@ namespace CustomNPCFramework.Framework.Utilities
///
/// Use this to add a new npc into the game.
///
- ///
- ///
+ /// The game location to add the npc to.
+ /// The extended npc to add to the location.
public void addNewNPCToLocation(GameLocation loc,ExtendedNPC npc)
{
this.moddedNPCS.Add(npc);
@@ -37,6 +40,12 @@ namespace CustomNPCFramework.Framework.Utilities
loc.addCharacter(npc);
}
+ ///
+ /// Add a npc to a location.
+ ///
+ /// The game location to add an npc to.
+ /// The extended npc to add to the location.
+ /// The tile position at the game location to add the mpc to.
public void addNewNPCToLocation(GameLocation loc, ExtendedNPC npc, Vector2 tilePosition)
{
this.moddedNPCS.Add(npc);
@@ -59,7 +68,7 @@ namespace CustomNPCFramework.Framework.Utilities
///
/// Use this to completly remove and npc from the game as it is removed from the location and is no longer tracked.
///
- ///
+ /// The npc to remove from the location.
public void removeFromLocationAndTrackingList(ExtendedNPC npc)
{
if (npc.currentLocation != null)