diff --git a/SmartCursor/CursorPosition.cs b/SmartCursor/CursorPosition.cs
deleted file mode 100644
index 2e365c1..0000000
--- a/SmartCursor/CursorPosition.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using Microsoft.Xna.Framework;
-using StardewModdingAPI;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace SmartCursor {
- class CursorPosition : ICursorPosition {
- public Vector2 AbsolutePixels { get; }
- public Vector2 ScreenPixels { get; }
- public Vector2 Tile { get; }
- public Vector2 GrabTile { get; }
-
- public CursorPosition(Vector2 absolutePixels, Vector2 screenPixels, Vector2 tile, Vector2 grabTile) {
- AbsolutePixels = absolutePixels;
- ScreenPixels = screenPixels;
- Tile = tile;
- GrabTile = grabTile;
- }
-
- public bool Equals(ICursorPosition other) {
- throw new NotImplementedException();
- }
- }
-}
diff --git a/SmartCursor/ModEntry.cs b/SmartCursor/ModEntry.cs
index d503621..2157387 100644
--- a/SmartCursor/ModEntry.cs
+++ b/SmartCursor/ModEntry.cs
@@ -7,13 +7,17 @@
namespace SmartCursor
{
public class ModEntry : Mod {
-
+ /// The mod entry point, called after the mod is first loaded.
+ /// Provides simplified APIs for writing mods.
public override void Entry(IModHelper helper) {
- InputEvents.ButtonPressed += InputEvents_ButtonPressed;
- ControlEvents.MouseChanged += ControlEvents_MouseChanged;
+ helper.Events.Input.ButtonPressed += OnButtonPressed;
+ helper.Events.Input.CursorMoved += OnCursorMoved;
}
- private void ControlEvents_MouseChanged(object sender, EventArgsMouseStateChanged e) {
+ /// Raised after the player moves the in-game cursor.
+ /// The event sender.
+ /// The event data.
+ private void OnCursorMoved(object sender, CursorMovedEventArgs e) {
if (!Context.IsWorldReady || !Context.IsPlayerFree || Game1.player.isMoving() || Game1.player.isCharging || Game1.player.isRafting || Game1.player.isRidingHorse() || Game1.player.UsingTool || Game1.player.IsEmoting || !Game1.player.CanMove) {
return;
}
@@ -21,7 +25,7 @@ private void ControlEvents_MouseChanged(object sender, EventArgsMouseStateChange
int dir = Game1.player.FacingDirection;
Vector2 grabTile = new Vector2(1, 0);
- switch(GetOctant(new Vector2(e.NewPosition.X, e.NewPosition.Y))) {
+ switch(GetOctant(new Vector2(e.NewPosition.ScreenPixels.X, e.NewPosition.ScreenPixels.Y))) {
case 0:
grabTile = new Vector2(1, 0);
dir = Game1.right;
@@ -80,7 +84,6 @@ private double GetAngle(Vector2 screenPixels) {
private int GetOctant(Vector2 screenPixels) {
double angle = GetAngle(screenPixels);
- Vector2 grabTile = Game1.player.getTileLocation();
angle += 22.5;
if (angle < 45) {
@@ -103,8 +106,11 @@ private int GetOctant(Vector2 screenPixels) {
return 0;
}
- private void InputEvents_ButtonPressed(object sender, EventArgsInput e) {
- if (!Context.IsWorldReady || !Context.IsPlayerFree || !(e.Button == SButton.MouseLeft) || Game1.player.isCharging || Game1.player.isRidingHorse() || Game1.player.UsingTool) {
+ /// Raised after the player presses a button on the keyboard, controller, or mouse.
+ /// The event sender.
+ /// The event data.
+ private void OnButtonPressed(object sender, ButtonPressedEventArgs e) {
+ if (!Context.IsWorldReady || !Context.IsPlayerFree || e.Button != SButton.MouseLeft || Game1.player.isCharging || Game1.player.isRidingHorse() || Game1.player.UsingTool) {
return;
}
@@ -145,10 +151,8 @@ private void InputEvents_ButtonPressed(object sender, EventArgsInput e) {
dir = Game1.right;
}
- e = new EventArgsInput(SButton.MouseLeft, new CursorPosition(cursor.AbsolutePixels, cursor.ScreenPixels, grabTile, grabTile), null);
Game1.player.lastClick = grabTile * 64 + new Vector2(32, 32);
Game1.player.FacingDirection = dir;
}
-
}
}
diff --git a/SmartCursor/SmartCursor.csproj b/SmartCursor/SmartCursor.csproj
index 9650216..ac47d1e 100644
--- a/SmartCursor/SmartCursor.csproj
+++ b/SmartCursor/SmartCursor.csproj
@@ -11,8 +11,6 @@
SmartCursor
v4.5
512
-
-
true
@@ -50,6 +48,9 @@
MinimumRecommendedRules.ruleset
true
+
+
+
@@ -61,23 +62,11 @@
-
-
-
-
-
-
-
-
- This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
\ No newline at end of file
diff --git a/SmartCursor/manifest.json b/SmartCursor/manifest.json
index 10c9e42..dc2b892 100644
--- a/SmartCursor/manifest.json
+++ b/SmartCursor/manifest.json
@@ -1,10 +1,10 @@
{
- "Name": "SmartCursor",
+ "Name": "Smart Cursor",
"Author": "stokastic",
- "Version": "1.1",
+ "Version": "1.1.0",
"Description": "Allows smart targeting of adjacent 8 tiles",
"UniqueID": "stokastic.SmartCursor",
"EntryDll": "SmartCursor.dll",
- "MinimumApiVersion": "2.7",
+ "MinimumApiVersion": "2.10.1",
"UpdateKeys": [ "Nexus:2458" ]
}
\ No newline at end of file
diff --git a/SmartCursor/packages.config b/SmartCursor/packages.config
deleted file mode 100644
index 170a804..0000000
--- a/SmartCursor/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file