Implemente correct interaction range with planter boxes.
This commit is contained in:
parent
bce270d6ce
commit
71c846acc5
|
@ -421,9 +421,11 @@ namespace AdditionalCropsFramework
|
||||||
|
|
||||||
public override bool clicked(StardewValley.Farmer who)
|
public override bool clicked(StardewValley.Farmer who)
|
||||||
{
|
{
|
||||||
if (StardustCore.Utilities.isWithinRange(2, this.tileLocation) == false) return false;
|
int range = 2;
|
||||||
|
if (StardustCore.Utilities.isWithinRange(range, this.tileLocation) == false) return false;
|
||||||
|
|
||||||
|
if (StardustCore.Utilities.isWithinDirectionRange(Game1.player.FacingDirection, range, this.tileLocation))
|
||||||
|
{
|
||||||
if (Game1.player.CurrentItem != null)
|
if (Game1.player.CurrentItem != null)
|
||||||
{
|
{
|
||||||
if (Game1.player.getToolFromName(Game1.player.CurrentItem.Name) is StardewValley.Tools.WateringCan)
|
if (Game1.player.getToolFromName(Game1.player.CurrentItem.Name) is StardewValley.Tools.WateringCan)
|
||||||
|
@ -456,6 +458,7 @@ namespace AdditionalCropsFramework
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -737,6 +737,20 @@ namespace StardustCore
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool isWithinDirectionRange(int direction,int range, Vector2 positionToCheck)
|
||||||
|
{
|
||||||
|
Vector2 v = Game1.player.getTileLocation();
|
||||||
|
if (direction==3 && (v.X >= positionToCheck.X - range)) return true; //face left
|
||||||
|
if (direction==1 && (v.X <= positionToCheck.X + range)) return true; //face right
|
||||||
|
if (direction==0 && (v.Y <= positionToCheck.Y + range)) return true; //face up
|
||||||
|
if (direction==2 && (v.Y >= positionToCheck.Y - range)) return true; //face down
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void drawGreenPlus()
|
public static void drawGreenPlus()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
Loading…
Reference in New Issue