Made PathTo which allows me to get from one path to another.
This commit is contained in:
parent
4eea726db3
commit
58bb6cb285
|
@ -50,6 +50,8 @@ namespace StarAI
|
|||
ModCore.CoreHelper.ConsoleCommands.Add("shipItem", "Ship an Item", new Action<string, string[]>(Commands.shipItem));
|
||||
|
||||
ModCore.CoreHelper.ConsoleCommands.Add("pathto", "Path to the adjacent map", new Action<string, string[]>(Commands.pathToMap));
|
||||
|
||||
ModCore.CoreHelper.ConsoleCommands.Add("goto", "Path to the adjacent map", new Action<string, string[]>(Commands.goToMap));
|
||||
// ModCore.CoreHelper.ConsoleCommands.Add("chopsticks", "Chop twigs.", new Action<string, string[]>(Commands.chopAllTwigs));
|
||||
pathfind("Initialize Delay 0", new string[] {
|
||||
"setDelay",
|
||||
|
@ -66,7 +68,7 @@ namespace StarAI
|
|||
}
|
||||
else
|
||||
{
|
||||
TransitionLogic.transitionToAdjacentMap(Game1.player.currentLocation, args[0]);
|
||||
WarpGoal.getWarpChain(Game1.player.currentLocation, args[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,6 +154,15 @@ namespace StarAI
|
|||
}
|
||||
|
||||
|
||||
public static void goToMap(string s, string[] args)
|
||||
{
|
||||
if (args.Length < 1)
|
||||
{
|
||||
ModCore.CoreMonitor.Log("Need args length of 1. Param: Name of location to go to.");
|
||||
return;
|
||||
}
|
||||
PathFindingCore.MapTransitionLogic.TransitionLogic.transitionToAdjacentMap(Game1.player.currentLocation, args[0]);
|
||||
}
|
||||
|
||||
public static void breakAllStones(string s, string[] args)
|
||||
{
|
||||
|
|
|
@ -137,7 +137,12 @@ namespace StarAI
|
|||
|
||||
//K key for placing a tile.
|
||||
#region
|
||||
if (e.KeyPressed == Microsoft.Xna.Framework.Input.Keys.K)
|
||||
|
||||
if (e.KeyPressed == Microsoft.Xna.Framework.Input.Keys.H)
|
||||
{
|
||||
CoreMonitor.Log(Game1.player.position.ToString());
|
||||
}
|
||||
if (e.KeyPressed == Microsoft.Xna.Framework.Input.Keys.K)
|
||||
{
|
||||
CoreMonitor.Log("OK THE K KEY WAS PRESSED!");
|
||||
|
||||
|
|
|
@ -117,17 +117,16 @@ namespace StarAI.PathFindingCore.MapTransitionLogic
|
|||
{
|
||||
if (InputSimulator.IsKeyDown(VirtualKeyCode.VK_A) == false) InputSimulator.SimulateKeyDown(VirtualKeyCode.VK_A);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
InputSimulator.SimulateKeyUp(VirtualKeyCode.VK_W);
|
||||
InputSimulator.SimulateKeyUp(VirtualKeyCode.VK_A);
|
||||
InputSimulator.SimulateKeyUp(VirtualKeyCode.VK_S);
|
||||
InputSimulator.SimulateKeyUp(VirtualKeyCode.VK_D);
|
||||
*/
|
||||
//ModCore.CoreMonitor.Log(tileLocation.ToString());
|
||||
//if(v.thisLocation.isTerrainFeatureAt)
|
||||
|
||||
//DO SOME LOGIC HERE IF I WANT TO SHIP???
|
||||
|
||||
Utilities.cleanExceptionList(v);
|
||||
StardustCore.ModCore.SerializationManager.trackedObjectList.Remove(v);
|
||||
foreach (var goodTile in correctPath)
|
||||
|
|
|
@ -0,0 +1,267 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
using StardewValley;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StarAI.PathFindingCore.MapTransitionLogic
|
||||
{
|
||||
public class WarpGoal
|
||||
{
|
||||
public WarpGoal parentWarpGoal;
|
||||
public Warp warp;
|
||||
public List<WarpGoal> childrenWarps;
|
||||
|
||||
public WarpGoal(WarpGoal Parent, Warp CurrentWarp)
|
||||
{
|
||||
this.parentWarpGoal = Parent;
|
||||
this.warp = CurrentWarp;
|
||||
this.childrenWarps = new List<WarpGoal>();
|
||||
}
|
||||
|
||||
public static List<WarpGoal> getWarpChain(GameLocation location,string mapName)
|
||||
{
|
||||
GameLocation check = Game1.getLocationFromName(mapName);
|
||||
if (check == null)
|
||||
{
|
||||
ModCore.CoreMonitor.Log("INVALID LOCATION");
|
||||
return null;
|
||||
}
|
||||
//init
|
||||
List<WarpGoal> startinggoals = new List<WarpGoal>();
|
||||
foreach(var Warp in location.warps)
|
||||
{
|
||||
WarpGoal child = new WarpGoal(null, Warp);
|
||||
startinggoals.Add(child);
|
||||
if (Warp.TargetName == mapName)
|
||||
{
|
||||
List<WarpGoal> listOfOne = new List<WarpGoal>();
|
||||
listOfOne.Add(child);
|
||||
return listOfOne;
|
||||
}
|
||||
}
|
||||
|
||||
//keep chaining children
|
||||
|
||||
List<WarpGoal> warpChain= okBye(startinggoals, mapName);
|
||||
if (warpChain == null)
|
||||
{
|
||||
ModCore.CoreMonitor.Log("NULL WARP CHAIN");
|
||||
return null;
|
||||
}
|
||||
if (warpChain.Count == 0)
|
||||
{
|
||||
ModCore.CoreMonitor.Log("NULL WARP CHAIN OR CAN't FIND PATH TO LOCATION");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
foreach(var v in warpChain)
|
||||
{
|
||||
if (v.parentWarpGoal != null)
|
||||
{
|
||||
ModCore.CoreMonitor.Log("Take this warp from location to destination:" +v.parentWarpGoal.warp.TargetName +" To " + v.warp.TargetName);
|
||||
}
|
||||
else
|
||||
{
|
||||
ModCore.CoreMonitor.Log("Take this warp from location to destination:" + Game1.player.currentLocation.name + " To " + v.warp.TargetName);
|
||||
}
|
||||
}
|
||||
|
||||
List<List<TileNode>> pathMaster = new List<List<TileNode>>();
|
||||
warpChain.Reverse();
|
||||
|
||||
foreach (var v in startinggoals)
|
||||
{
|
||||
if (v.warp.TargetName == warpChain.ElementAt(0).warp.TargetName)
|
||||
{
|
||||
//v.parentWarpGoal = warpChain.ElementAt(warpChain.Count - 1);
|
||||
warpChain.Insert(0,v);
|
||||
ModCore.CoreMonitor.Log("Insert from" + Game1.player.currentLocation.name + " To " + v.warp.TargetName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0;i<warpChain.Count;i++)
|
||||
{
|
||||
WarpGoal v = warpChain[i];
|
||||
ModCore.CoreMonitor.Log("Processing:" +v.warp.TargetName);
|
||||
if (i == 0)
|
||||
{
|
||||
|
||||
TileNode s = new TileNode(1, Vector2.Zero, Path.Combine("Tiles", "GenericUncoloredTile.xnb"), Path.Combine("Tiles", "TileData.xnb"), StardustCore.IlluminateFramework.Colors.invertColor(StardustCore.IlluminateFramework.ColorsList.Brown));
|
||||
s.fakePlacementAction(Game1.player.currentLocation, Game1.player.getTileX(), Game1.player.getTileY());
|
||||
Utilities.tileExceptionList.Add(new TileExceptionMetaData(s, "WarpGoal"));
|
||||
|
||||
TileNode t = new TileNode(1, Vector2.Zero, Path.Combine("Tiles", "GenericUncoloredTile.xnb"), Path.Combine("Tiles", "TileData.xnb"), StardustCore.IlluminateFramework.Colors.invertColor(StardustCore.IlluminateFramework.ColorsList.Brown));
|
||||
t.fakePlacementAction(Game1.currentLocation, v.warp.X, v.warp.Y);
|
||||
Utilities.tileExceptionList.Add(new TileExceptionMetaData(t, "WarpGoal"));
|
||||
pathMaster.Add(Utilities.getIdealPath(t,s));
|
||||
Utilities.clearExceptionListWithName("Child");
|
||||
Utilities.tileExceptionList.Clear();
|
||||
|
||||
ModCore.CoreMonitor.Log("OK COUNT:"+pathMaster.Count.ToString());
|
||||
|
||||
ModCore.CoreMonitor.Log(("Name: " + Game1.currentLocation + " X " + warpChain[i].warp.X + " Y " + warpChain[i].warp.Y));
|
||||
// List<TileNode> miniPath = pathMaster.ElementAt(pathMaster.Count - 1);
|
||||
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i == warpChain.Count - 1) continue;
|
||||
ModCore.CoreMonitor.Log("Count:" +warpChain.Count.ToString());
|
||||
ModCore.CoreMonitor.Log("I:" + i.ToString());
|
||||
int index = i + 1;
|
||||
ModCore.CoreMonitor.Log(("Name Source: " + warpChain[i].warp.TargetName + " X " + warpChain[index-1].warp.TargetX + " Y " + warpChain[index-1].warp.TargetY));
|
||||
ModCore.CoreMonitor.Log(("Name Destination: " + warpChain[i].warp.TargetName + " X " + warpChain[index].warp.X + " Y " + warpChain[index].warp.Y));
|
||||
try
|
||||
{
|
||||
TileNode tears = new TileNode(1, Vector2.Zero, Path.Combine("Tiles", "GenericUncoloredTile.xnb"), Path.Combine("Tiles", "TileData.xnb"), StardustCore.IlluminateFramework.Colors.invertColor(StardustCore.IlluminateFramework.ColorsList.Brown));
|
||||
tears.fakePlacementAction(Game1.getLocationFromName(warpChain[i].warp.TargetName), warpChain[index].warp.X, warpChain[index].warp.Y);
|
||||
Utilities.tileExceptionList.Add(new TileExceptionMetaData(tears, "WarpGoal"));
|
||||
|
||||
TileNode source = new TileNode(1, Vector2.Zero, Path.Combine("Tiles", "GenericUncoloredTile.xnb"), Path.Combine("Tiles", "TileData.xnb"), StardustCore.IlluminateFramework.Colors.invertColor(StardustCore.IlluminateFramework.ColorsList.Brown));
|
||||
source.fakePlacementAction(Game1.getLocationFromName(warpChain[i].warp.TargetName), warpChain[index-1].warp.TargetX, warpChain[index-1].warp.TargetY);
|
||||
Utilities.tileExceptionList.Add(new TileExceptionMetaData(source, "WarpGoal"));
|
||||
|
||||
|
||||
pathMaster.Add(Utilities.getIdealPath(tears,source));
|
||||
Utilities.clearExceptionListWithName("Child");
|
||||
Utilities.tileExceptionList.Clear();
|
||||
continue;
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
ModCore.CoreMonitor.Log("WTF ME I GUESS");
|
||||
ModCore.CoreMonitor.Log(err.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
bool once = false;
|
||||
|
||||
|
||||
foreach(var path in pathMaster)
|
||||
{
|
||||
foreach(var v in path)
|
||||
{
|
||||
ModCore.CoreMonitor.Log("This is my path LOL:" + v.thisLocation.ToString() + v.tileLocation.ToString(),StardewModdingAPI.LogLevel.Warn);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
while (pathMaster.Count != 0)
|
||||
{
|
||||
pathMaster.ElementAt(0).Remove(pathMaster.ElementAt(0).ElementAt( (pathMaster.ElementAt(0).Count-1) ) ); //get first path and remove first element from it because it will force me to warp back.
|
||||
ModCore.CoreMonitor.Log("Pathing to:" + pathMaster.ElementAt(0).ElementAt(0).thisLocation.ToString() + pathMaster.ElementAt(0).ElementAt(0).tileLocation.ToString());
|
||||
ModCore.CoreMonitor.Log("Pathing from:" + pathMaster.ElementAt(0).ElementAt(pathMaster.ElementAt(0).Count - 1).thisLocation.ToString() + pathMaster.ElementAt(0).ElementAt(pathMaster.ElementAt(0).Count - 1).tileLocation.ToString());
|
||||
|
||||
if (once == false)
|
||||
{
|
||||
|
||||
foreach(var v in pathMaster.ElementAt(0))
|
||||
{
|
||||
ModCore.CoreMonitor.Log("This is my path:" + v.thisLocation.ToString() + v.tileLocation.ToString());
|
||||
}
|
||||
//pathMaster.ElementAt(0).Remove(pathMaster.ElementAt(0).ElementAt(0));
|
||||
PathFindingLogic.calculateMovement(pathMaster.ElementAt(0));
|
||||
ModCore.CoreMonitor.Log("WTF???");
|
||||
once = true;
|
||||
//warped = false;
|
||||
}
|
||||
else if (once == true)
|
||||
{
|
||||
List<TileNode> temp = new List<TileNode>();
|
||||
for(int i=0;i< pathMaster.ElementAt(0).Count; i++)
|
||||
{
|
||||
|
||||
temp.Add(pathMaster.ElementAt(0).ElementAt(i));
|
||||
|
||||
}
|
||||
ModCore.CoreMonitor.Log("Pathing from FIX:"+temp.ElementAt(temp.Count-1).thisLocation.ToString()+temp.ElementAt(temp.Count-1).tileLocation.ToString());
|
||||
|
||||
foreach (var v in temp)
|
||||
{
|
||||
ModCore.CoreMonitor.Log("This is my path modified:" + v.thisLocation.ToString() + v.tileLocation.ToString()+ v.position.ToString());
|
||||
}
|
||||
// temp.Remove(temp.ElementAt(0));
|
||||
Game1.player.position = temp.ElementAt(temp.Count-1).position;
|
||||
PathFindingLogic.calculateMovement(temp);
|
||||
}
|
||||
|
||||
bool warped = false;
|
||||
for (int i = -1; i <= 1; i++)
|
||||
{
|
||||
|
||||
for (int j = -1; j <= 1; j++)
|
||||
{
|
||||
foreach (var warp in Game1.player.currentLocation.warps) //get location of tiles.
|
||||
{
|
||||
if (warp.X == Game1.player.getTileX() + i && warp.Y == Game1.player.getTileY() + j)
|
||||
{
|
||||
Game1.warpFarmer(warp.TargetName, warp.TargetX, warp.TargetY, false);
|
||||
ModCore.CoreMonitor.Log("WARP:" + warped.ToString());
|
||||
warped = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (warped == true) break;
|
||||
}
|
||||
if (warped == true) break;
|
||||
}
|
||||
warped = false;
|
||||
pathMaster.Remove(pathMaster.ElementAt(0));
|
||||
once = true;
|
||||
}
|
||||
|
||||
|
||||
//Do final location walk to stuff here.
|
||||
return warpChain;
|
||||
|
||||
}
|
||||
|
||||
public static List<WarpGoal> okBye(List<WarpGoal> param,string targetMapName)
|
||||
{
|
||||
bool found = false;
|
||||
WarpGoal theOne= new WarpGoal(null,null);
|
||||
List<WarpGoal> warpChain = new List<WarpGoal>();
|
||||
foreach (WarpGoal w in param)
|
||||
{
|
||||
GameLocation loc = Game1.getLocationFromName(w.warp.TargetName);
|
||||
foreach (var v in loc.warps)
|
||||
{
|
||||
WarpGoal ok = new WarpGoal(w, v);
|
||||
w.childrenWarps.Add(ok);
|
||||
if (v.TargetName == targetMapName)
|
||||
{
|
||||
found = true;
|
||||
theOne = ok;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found == false)
|
||||
{
|
||||
return okBye(w.childrenWarps,targetMapName);
|
||||
}
|
||||
if (found == true)
|
||||
{
|
||||
while (theOne.parentWarpGoal != null)
|
||||
{
|
||||
warpChain.Add(theOne);
|
||||
theOne = theOne.parentWarpGoal;
|
||||
}
|
||||
warpChain.Add(theOne);
|
||||
}
|
||||
return warpChain;
|
||||
//recursively call this logic???
|
||||
}
|
||||
return new List<WarpGoal>();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -484,34 +484,7 @@ namespace StarAI.PathFindingCore
|
|||
{
|
||||
if (v is TileNode)
|
||||
{
|
||||
|
||||
foreach (var exc in Utilities.tileExceptionList)
|
||||
{
|
||||
if (ignoreList.Contains(exc.tile)) continue;
|
||||
// if ( (exc.tile == (v as TileNode)&&(exc.actionType!="Child"||exc.actionType!="Navigation"||exc.actionType!="CostCalculation"))|| path.Contains(v)) continue;
|
||||
if (exc.actionType == "ChopStick")
|
||||
{
|
||||
List<TileNode> idk = new List<TileNode>();
|
||||
foreach (var q in removalList)
|
||||
{
|
||||
if (exc.tile.tileLocation == q.tileLocation)
|
||||
{
|
||||
idk.Add(q);
|
||||
//removalList.Remove(exc.tile);
|
||||
ignoreList.Add(exc.tile);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
foreach(var h in idk)
|
||||
{
|
||||
removalList.Remove(exc.tile);
|
||||
}
|
||||
|
||||
}
|
||||
else removalList.Add((TileNode)v);
|
||||
}
|
||||
|
||||
|
||||
removalList.Add((TileNode)v);
|
||||
}
|
||||
}
|
||||
foreach (var v in removalList)
|
||||
|
@ -589,9 +562,12 @@ namespace StarAI.PathFindingCore
|
|||
while (doesNodeEqualGoal(currentNode,Goals).Key==false && queue.Count != 0)
|
||||
{
|
||||
// ModCore.CoreMonitor.Log("LET'S GO PATH!!!!", LogLevel.Error);
|
||||
// ModCore.CoreMonitor.Log("PATH FROM SOURCE: " + currentNode.tileLocation, LogLevel.Error);
|
||||
// ModCore.CoreMonitor.Log("THIS IS MY MISTAKE!!!!!!! " + Goals.Count, LogLevel.Error);
|
||||
|
||||
// ModCore.CoreMonitor.Log("PATH FROM Node: " + currentNode.tileLocation, LogLevel.Error);
|
||||
// ModCore.CoreMonitor.Log("PATH FROM Source: " + Source.tileLocation, LogLevel.Error);
|
||||
// ModCore.CoreMonitor.Log("GOALS COUNT " + Goals.Count, LogLevel.Error);
|
||||
|
||||
// ModCore.CoreMonitor.Log("THIS IS MY MISTAKE!!!!!!! " + Goals.Count, LogLevel.Error);
|
||||
|
||||
//Console.WriteLine("OK WTF IS GOING ON????");
|
||||
//Add children to current node
|
||||
int xMin = -1;
|
||||
|
@ -655,7 +631,7 @@ namespace StarAI.PathFindingCore
|
|||
if (node.seenState == 0)
|
||||
{
|
||||
node.drawColor = StardustCore.IlluminateFramework.Colors.invertColor(StardustCore.IlluminateFramework.ColorsList.LightPink); //Seen
|
||||
adjList.Add(node);
|
||||
|
||||
}
|
||||
if (node.seenState == 1)
|
||||
{
|
||||
|
@ -665,8 +641,9 @@ namespace StarAI.PathFindingCore
|
|||
{
|
||||
node.drawColor = StardustCore.IlluminateFramework.Colors.invertColor(StardustCore.IlluminateFramework.ColorsList.DarkOrange);
|
||||
}
|
||||
adjList.Add(node);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -685,6 +662,7 @@ namespace StarAI.PathFindingCore
|
|||
catch (Exception err)
|
||||
{
|
||||
ModCore.CoreMonitor.Log("FUCK", LogLevel.Error);
|
||||
ModCore.CoreMonitor.Log("INDEX ERROR:"+index, LogLevel.Error);
|
||||
break;
|
||||
}
|
||||
currentNode.drawColor = StardustCore.IlluminateFramework.Colors.invertColor(StardustCore.IlluminateFramework.ColorsList.Blue); //Working
|
||||
|
@ -800,9 +778,14 @@ namespace StarAI.PathFindingCore
|
|||
while (path.Count > 0)
|
||||
{
|
||||
TileNode w = path[0];
|
||||
//ModCore.CoreMonitor.Log("Goto: " + w.tileLocation.ToString());
|
||||
|
||||
ModCore.CoreMonitor.Log("Here: " +Game1.player.position.ToString());
|
||||
ModCore.CoreMonitor.Log("LOC: " + Game1.player.currentLocation);
|
||||
Vector2 center2 = Utilities.parseCenterFromTile((int)w.tileLocation.X, (int)w.tileLocation.Y);
|
||||
ModCore.CoreMonitor.Log("Goto: " + center2);
|
||||
//ModCore.CoreMonitor.Log("My position now: " + Game1.player.getTileLocation());
|
||||
//ModCore.CoreMonitor.Log("My Point position now: " + Game1.player.getTileLocationPoint());
|
||||
|
||||
if (Game1.player.getTileX() == w.tileLocation.X && Game1.player.getTileY() == w.tileLocation.Y)
|
||||
{
|
||||
|
||||
|
@ -907,6 +890,10 @@ namespace StarAI.PathFindingCore
|
|||
|
||||
|
||||
ModCore.CoreMonitor.Log("UNCAUGHT EXCEPTION", LogLevel.Error);
|
||||
InputSimulator.SimulateKeyUp(VirtualKeyCode.VK_A);
|
||||
InputSimulator.SimulateKeyUp(VirtualKeyCode.VK_D);
|
||||
InputSimulator.SimulateKeyUp(VirtualKeyCode.VK_W);
|
||||
InputSimulator.SimulateKeyUp(VirtualKeyCode.VK_S);
|
||||
}
|
||||
}
|
||||
foreach(var v in removalList)
|
||||
|
|
|
@ -22,7 +22,6 @@ namespace StarAI.PathFindingCore
|
|||
/// </summary>
|
||||
public class TileNode : CoreObject
|
||||
{
|
||||
public Vector2 position;
|
||||
public List<TileNode> children = new List<TileNode>();
|
||||
public enum stateEnum { NotVisited, Seen, Visited };
|
||||
public int seenState;
|
||||
|
@ -84,7 +83,7 @@ namespace StarAI.PathFindingCore
|
|||
{
|
||||
Console.WriteLine("OK T LOCATION IS NULL");
|
||||
}
|
||||
|
||||
//ModCore.CoreMonitor.Log("TRY TO PLACE A TILE AT:" + loc + pos);
|
||||
|
||||
if (t.thisLocation.isObjectAt((int)pos.X, (int)pos.Y))
|
||||
{
|
||||
|
@ -111,14 +110,14 @@ namespace StarAI.PathFindingCore
|
|||
|
||||
if (t.thisLocation.isTileOccupied(pos / Game1.tileSize))
|
||||
{
|
||||
// ModCore.CoreMonitor.Log("Tile occupied!: " + t.thisLocation.name, LogLevel.Error);
|
||||
// ModCore.CoreMonitor.Log("Tile occupied!: " + t.thisLocation.name, LogLevel.Error);
|
||||
if (cry == true) t.thisLocation = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (t.thisLocation.isTilePlaceable(pos / Game1.tileSize) == false)
|
||||
{
|
||||
//ModCore.CoreMonitor.Log("Tile Not placeable at location. " + t.thisLocation.name, LogLevel.Error);
|
||||
// ModCore.CoreMonitor.Log("Tile Not placeable at location. " + t.thisLocation.name, LogLevel.Error);
|
||||
if (cry == true) t.thisLocation = null;
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -204,7 +204,7 @@ namespace StarAI.PathFindingCore
|
|||
{
|
||||
|
||||
TileNode t = new TileNode(1, Vector2.Zero, Path.Combine("Tiles", "GenericUncoloredTile.xnb"), Path.Combine("Tiles", "TileData.xnb"), StardustCore.IlluminateFramework.Colors.invertColor(StardustCore.IlluminateFramework.ColorsList.RosyBrown));
|
||||
if(placement)t.placementAction(Game1.currentLocation, (int)pos.X * Game1.tileSize, (int)pos.Y * Game1.tileSize);
|
||||
if(placement)t.placementAction(v.thisLocation, (int)pos.X * Game1.tileSize, (int)pos.Y * Game1.tileSize);
|
||||
else t.fakePlacementAction(v.thisLocation, (int)pos.X, (int)pos.Y);
|
||||
//StardustCore.Utilities.masterAdditionList.Add(new StardustCore.DataNodes.PlacementNode(t, Game1.currentLocation, (int)pos.X * Game1.tileSize, (int)pos.Y * Game1.tileSize));
|
||||
miniGoals.Add(t);
|
||||
|
@ -217,7 +217,7 @@ namespace StarAI.PathFindingCore
|
|||
{
|
||||
TileNode tempSource = new TileNode(1, Vector2.Zero, Path.Combine("Tiles", "GenericUncoloredTile.xnb"), Path.Combine("Tiles", "TileData.xnb"), StardustCore.IlluminateFramework.Colors.invertColor(StardustCore.IlluminateFramework.ColorsList.RosyBrown));
|
||||
if(placement)tempSource.placementAction(Game1.player.currentLocation, Game1.player.getTileX() * Game1.tileSize, Game1.player.getTileY() * Game1.tileSize);
|
||||
else tempSource.fakePlacementAction(Game1.player.currentLocation, Game1.player.getTileX(), Game1.player.getTileY());
|
||||
else tempSource.fakePlacementAction(v.thisLocation, (int)v.tileLocation.X, (int)v.tileLocation.Y);
|
||||
|
||||
List<TileNode> path = PathFindingCore.PathFindingLogic.pathFindToSingleGoalReturnPath(tempSource, nav, new List<TileNode>(),true,true);
|
||||
|
||||
|
@ -301,10 +301,11 @@ namespace StarAI.PathFindingCore
|
|||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
public static List<TileNode> getIdealPath(TileNode t)
|
||||
public static List<TileNode> getIdealPath(TileNode target, TileNode Source)
|
||||
{
|
||||
object[] arr = new object[1];
|
||||
arr[0] = t;
|
||||
object[] arr = new object[2];
|
||||
arr[0] = target;
|
||||
arr[1] = Source;
|
||||
return getIdealPath(arr);
|
||||
}
|
||||
|
||||
|
@ -317,6 +318,23 @@ namespace StarAI.PathFindingCore
|
|||
{
|
||||
object[] objArr = (object[])obj;
|
||||
TileNode v = (TileNode)objArr[0];
|
||||
TileNode s;
|
||||
try
|
||||
{
|
||||
s = (TileNode)objArr[1];
|
||||
if (s == null)
|
||||
{
|
||||
s = new TileNode(1, Vector2.Zero, Path.Combine("Tiles", "GenericUncoloredTile.xnb"), Path.Combine("Tiles", "TileData.xnb"), StardustCore.IlluminateFramework.Colors.invertColor(StardustCore.IlluminateFramework.ColorsList.RosyBrown));
|
||||
s.fakePlacementAction(Game1.player.currentLocation, Game1.player.getTileX(), Game1.player.getTileY());
|
||||
ModCore.CoreMonitor.Log("WHUT???????");
|
||||
}
|
||||
}
|
||||
catch(Exception err)
|
||||
{
|
||||
s = new TileNode(1, Vector2.Zero, Path.Combine("Tiles", "GenericUncoloredTile.xnb"), Path.Combine("Tiles", "TileData.xnb"), StardustCore.IlluminateFramework.Colors.invertColor(StardustCore.IlluminateFramework.ColorsList.RosyBrown));
|
||||
s.fakePlacementAction(Game1.player.currentLocation, Game1.player.getTileX(), Game1.player.getTileY());
|
||||
ModCore.CoreMonitor.Log("ICECREAM!!!!!!???????");
|
||||
}
|
||||
|
||||
|
||||
bool placement = false;
|
||||
|
@ -344,13 +362,18 @@ namespace StarAI.PathFindingCore
|
|||
Vector2 pos = new Vector2(v.tileLocation.X + x, v.tileLocation.Y + y);
|
||||
//ModCore.CoreMonitor.Log("AHHHHHHH POSITION: " + pos.ToString(), LogLevel.Alert);
|
||||
bool f = PathFindingCore.TileNode.checkIfICanPlaceHere(v, pos * Game1.tileSize, v.thisLocation, true, utility);
|
||||
if (f == false)
|
||||
{
|
||||
ModCore.CoreMonitor.Log("FAILED TO PUT DOWN A GOAL????");
|
||||
ModCore.CoreMonitor.Log(v.thisLocation.ToString()+v.tileLocation.ToString());
|
||||
}
|
||||
// ModCore.CoreMonitor.Log("OK THIS IS THE RESULT F: " + f, LogLevel.Alert);
|
||||
if (f == true)
|
||||
{
|
||||
|
||||
TileNode t = new TileNode(1, Vector2.Zero, Path.Combine("Tiles", "GenericUncoloredTile.xnb"), Path.Combine("Tiles", "TileData.xnb"), StardustCore.IlluminateFramework.Colors.invertColor(StardustCore.IlluminateFramework.ColorsList.RosyBrown));
|
||||
if (placement) t.placementAction(Game1.currentLocation, (int)pos.X * Game1.tileSize, (int)pos.Y * Game1.tileSize);
|
||||
else t.fakePlacementAction(Game1.currentLocation, (int)pos.X, (int)pos.Y);
|
||||
if (placement) t.placementAction(v.thisLocation, (int)pos.X * Game1.tileSize, (int)pos.Y * Game1.tileSize);
|
||||
else t.fakePlacementAction(v.thisLocation, (int)pos.X, (int)pos.Y);
|
||||
//StardustCore.Utilities.masterAdditionList.Add(new StardustCore.DataNodes.PlacementNode( t, Game1.currentLocation, (int)pos.X * Game1.tileSize, (int)pos.Y * Game1.tileSize));
|
||||
miniGoals.Add(t);
|
||||
Utilities.tileExceptionList.Add(new TileExceptionMetaData(t, "Navigation"));
|
||||
|
@ -362,8 +385,8 @@ namespace StarAI.PathFindingCore
|
|||
Utilities.clearExceptionListWithName("Child");
|
||||
Utilities.clearExceptionListWithName("Navigation");
|
||||
TileNode tempSource = new TileNode(1, Vector2.Zero, Path.Combine("Tiles", "GenericUncoloredTile.xnb"), Path.Combine("Tiles", "TileData.xnb"), StardustCore.IlluminateFramework.Colors.invertColor(StardustCore.IlluminateFramework.ColorsList.RosyBrown));
|
||||
if (placement) tempSource.placementAction(Game1.player.currentLocation, Game1.player.getTileX() * Game1.tileSize, Game1.player.getTileY() * Game1.tileSize);
|
||||
else tempSource.fakePlacementAction(Game1.player.currentLocation, Game1.player.getTileX(), Game1.player.getTileY());
|
||||
if (placement) tempSource.placementAction(v.thisLocation, Game1.player.getTileX() * Game1.tileSize, Game1.player.getTileY() * Game1.tileSize);
|
||||
else tempSource.fakePlacementAction(s.thisLocation, (int)s.tileLocation.X, (int)s.tileLocation.Y);
|
||||
|
||||
Utilities.tileExceptionList.Add(new TileExceptionMetaData(tempSource, "Navigation"));
|
||||
//StaardustCore.Utilities.masterAdditionList.Add(new StardustCore.DataNodes.PlacementNode(tempSource, Game1.currentLocation, Game1.player.getTileX() * Game1.tileSize, Game1.player.getTileY() * Game1.tileSize));
|
||||
|
@ -521,8 +544,8 @@ namespace StarAI.PathFindingCore
|
|||
{
|
||||
|
||||
TileNode t = new TileNode(1, Vector2.Zero, Path.Combine("Tiles", "GenericUncoloredTile.xnb"), Path.Combine("Tiles", "TileData.xnb"), StardustCore.IlluminateFramework.Colors.invertColor(StardustCore.IlluminateFramework.ColorsList.RosyBrown));
|
||||
if (placement) t.placementAction(Game1.currentLocation, (int)pos.X * Game1.tileSize, (int)pos.Y * Game1.tileSize);
|
||||
else t.fakePlacementAction(Game1.currentLocation, (int)pos.X, (int)pos.Y);
|
||||
if (placement) t.placementAction(v.thisLocation, (int)pos.X * Game1.tileSize, (int)pos.Y * Game1.tileSize);
|
||||
else t.fakePlacementAction(v.thisLocation, (int)pos.X, (int)pos.Y);
|
||||
//StardustCore.Utilities.masterAdditionList.Add(new StardustCore.DataNodes.PlacementNode( t, Game1.currentLocation, (int)pos.X * Game1.tileSize, (int)pos.Y * Game1.tileSize));
|
||||
miniGoals.Add(t);
|
||||
Utilities.tileExceptionList.Add(new TileExceptionMetaData(t, "Navigation"));
|
||||
|
@ -536,7 +559,7 @@ namespace StarAI.PathFindingCore
|
|||
Utilities.clearExceptionListWithName("Navigation");
|
||||
TileNode tempSource = new TileNode(1, Vector2.Zero, Path.Combine("Tiles", "GenericUncoloredTile.xnb"), Path.Combine("Tiles", "TileData.xnb"), StardustCore.IlluminateFramework.Colors.invertColor(StardustCore.IlluminateFramework.ColorsList.RosyBrown));
|
||||
if (placement) tempSource.placementAction(Game1.player.currentLocation, Game1.player.getTileX() * Game1.tileSize, Game1.player.getTileY() * Game1.tileSize);
|
||||
else tempSource.fakePlacementAction(Game1.player.currentLocation, Game1.player.getTileX(), Game1.player.getTileY());
|
||||
else tempSource.fakePlacementAction(vList[0].thisLocation, (int)vList[0].tileLocation.X,(int) vList[0].tileLocation.Y);
|
||||
|
||||
Utilities.tileExceptionList.Add(new TileExceptionMetaData(tempSource, "Navigation"));
|
||||
//StaardustCore.Utilities.masterAdditionList.Add(new StardustCore.DataNodes.PlacementNode(tempSource, Game1.currentLocation, Game1.player.getTileX() * Game1.tileSize, Game1.player.getTileY() * Game1.tileSize));
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace StarAI.PathFindingCore.WaterLogic
|
|||
if (location.isOpenWater(i, j))
|
||||
{
|
||||
TileNode t = new TileNode(1, Vector2.Zero, Path.Combine("Tiles", "GenericUncoloredTile.xnb"), Path.Combine("Tiles", "TileData.xnb"), StardustCore.IlluminateFramework.Colors.invertColor(StardustCore.IlluminateFramework.ColorsList.Brown));
|
||||
t.fakePlacementAction(Game1.currentLocation, i,j);
|
||||
t.fakePlacementAction(location, i,j);
|
||||
Utilities.tileExceptionList.Add(new TileExceptionMetaData(t, "ChopTree"));
|
||||
waterTilesAvailable.Add(t);
|
||||
twingCount++;
|
||||
|
@ -109,7 +109,7 @@ namespace StarAI.PathFindingCore.WaterLogic
|
|||
if (location.isOpenWater(i, j))
|
||||
{
|
||||
TileNode t = new TileNode(1, Vector2.Zero, Path.Combine("Tiles", "GenericUncoloredTile.xnb"), Path.Combine("Tiles", "TileData.xnb"), StardustCore.IlluminateFramework.Colors.invertColor(StardustCore.IlluminateFramework.ColorsList.Brown));
|
||||
t.fakePlacementAction(Game1.currentLocation, i, j);
|
||||
t.fakePlacementAction(location, i, j);
|
||||
Utilities.tileExceptionList.Add(new TileExceptionMetaData(t, "WaterTile"));
|
||||
waterTilesAvailable.Add(t);
|
||||
twingCount++;
|
||||
|
|
|
@ -73,6 +73,7 @@
|
|||
<Compile Include="PathFindingCore\CropLogic\ShippingLogic.cs" />
|
||||
<Compile Include="PathFindingCore\DebrisLogic\DebrisLogic.cs" />
|
||||
<Compile Include="PathFindingCore\MapTransitionLogic\TransitionLogic.cs" />
|
||||
<Compile Include="PathFindingCore\MapTransitionLogic\WarpGoal.cs" />
|
||||
<Compile Include="PathFindingCore\PathFindingLogic.cs" />
|
||||
<Compile Include="PathFindingCore\PlacementNode.cs" />
|
||||
<Compile Include="PathFindingCore\TileExceptionMetaData.cs" />
|
||||
|
|
Loading…
Reference in New Issue