diff options
author | Zoryn Aaron <zoryn4163@gmail.com> | 2016-03-02 23:38:51 -0500 |
---|---|---|
committer | Zoryn Aaron <zoryn4163@gmail.com> | 2016-03-02 23:38:51 -0500 |
commit | 250559d227fa3a8148ad97d75a725ed0a47a0f4f (patch) | |
tree | e803066b2054ddfeed43ad75819026e18f246be8 /StardewModdingAPI | |
parent | 47fecbd81eeecd9244ee2384f99bc224d5475029 (diff) | |
download | SMAPI-250559d227fa3a8148ad97d75a725ed0a47a0f4f.tar.gz SMAPI-250559d227fa3a8148ad97d75a725ed0a47a0f4f.tar.bz2 SMAPI-250559d227fa3a8148ad97d75a725ed0a47a0f4f.zip |
we can have more than 2 args in a command, c'mon brain
Diffstat (limited to 'StardewModdingAPI')
-rw-r--r-- | StardewModdingAPI/Command.cs | 2 | ||||
-rw-r--r-- | StardewModdingAPI/Inheritance/SGame.cs | 8 | ||||
-rw-r--r-- | StardewModdingAPI/Inheritance/SObject.cs | 18 | ||||
-rw-r--r-- | StardewModdingAPI/Program.cs | 7 |
4 files changed, 27 insertions, 8 deletions
diff --git a/StardewModdingAPI/Command.cs b/StardewModdingAPI/Command.cs index 1659b1e9..c65e8122 100644 --- a/StardewModdingAPI/Command.cs +++ b/StardewModdingAPI/Command.cs @@ -30,7 +30,7 @@ namespace StardewModdingAPI { args = input.Split(new[] {" "}, 2, StringSplitOptions.RemoveEmptyEntries); fnd = FindCommand(args[0]); - args = args[1].Split(new[] { " " }, 2, StringSplitOptions.RemoveEmptyEntries); + args = args[1].Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries); } else { diff --git a/StardewModdingAPI/Inheritance/SGame.cs b/StardewModdingAPI/Inheritance/SGame.cs index 27eb3c4b..99db73d9 100644 --- a/StardewModdingAPI/Inheritance/SGame.cs +++ b/StardewModdingAPI/Inheritance/SGame.cs @@ -49,6 +49,14 @@ namespace StardewModdingAPI.Inheritance public Farmer PreviousFarmer { get; private set; } + public SGame() + { + if (Program.debug) + { + //SaveGame.serializer. + } + } + protected override void Initialize() { Program.Log("XNA Initialize"); diff --git a/StardewModdingAPI/Inheritance/SObject.cs b/StardewModdingAPI/Inheritance/SObject.cs index 9d112859..5c80cd52 100644 --- a/StardewModdingAPI/Inheritance/SObject.cs +++ b/StardewModdingAPI/Inheritance/SObject.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Xml.Serialization; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using StardewValley; @@ -66,8 +67,6 @@ namespace StardewModdingAPI.Inheritance if (Texture != null) { int targSize = Game1.tileSize; - int midX = (int) ((x) + 32); - int midY = (int) ((y) + 32); Vector2 local = Game1.GlobalToLocal(Game1.viewport, new Vector2(x,y)); Rectangle targ = new Rectangle((int)local.X, (int)local.Y, targSize, targSize); @@ -207,12 +206,14 @@ namespace StardewModdingAPI.Inheritance public override void actionWhenBeingHeld(Farmer who) { Point p = Game1.getMousePosition(); - CurrentMouse = new Vector2(p.X, p.Y); + CurrentMouse = new Vector2((p.X / Game1.tileSize), (p.Y / Game1.tileSize)); + Program.LogInfo(canBePlacedHere(Game1.currentLocation, CurrentMouse)); base.actionWhenBeingHeld(who); } public override bool canBePlacedHere(GameLocation l, Vector2 tile) { + Program.LogInfo(CurrentMouse.ToString().Replace("{", "").Replace("}", "")); if (!l.objects.ContainsKey(tile)) return true; @@ -221,6 +222,9 @@ namespace StardewModdingAPI.Inheritance public override bool placementAction(GameLocation location, int x, int y, Farmer who = null) { + if (Game1.didPlayerJustRightClick()) + return false; + x = (x / Game1.tileSize) * Game1.tileSize; y = (y / Game1.tileSize) * Game1.tileSize; @@ -248,7 +252,13 @@ namespace StardewModdingAPI.Inheritance public override void drawPlacementBounds(SpriteBatch spriteBatch, GameLocation location) { if (canBePlacedHere(location, CurrentMouse)) - base.drawPlacementBounds(spriteBatch, location); + { + int targSize = Game1.tileSize; + + int x = Game1.oldMouseState.X + Game1.viewport.X; + int y = Game1.oldMouseState.Y + Game1.viewport.Y; + spriteBatch.Draw(Game1.mouseCursors, new Vector2((float)(x / Game1.tileSize * Game1.tileSize - Game1.viewport.X), (float)(y / Game1.tileSize * Game1.tileSize - Game1.viewport.Y)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(Utility.playerCanPlaceItemHere(location, (Item)this, x, y, Game1.player) ? 194 : 210, 388, 16, 16)), Color.White, 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.01f); + } } } }
\ No newline at end of file diff --git a/StardewModdingAPI/Program.cs b/StardewModdingAPI/Program.cs index a58a5f9b..313fcbe5 100644 --- a/StardewModdingAPI/Program.cs +++ b/StardewModdingAPI/Program.cs @@ -49,8 +49,8 @@ namespace StardewModdingAPI public static Thread gameThread; public static Thread consoleInputThread; - public const string Version = "0.35 Alpha"; - public const bool debug = false; + public const string Version = "0.36 Alpha"; + public const bool debug = true; public static bool disableLogging { get; private set; } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -63,7 +63,7 @@ namespace StardewModdingAPI Console.Title += " - Version " + Version; if (debug) - Console.Title += " - DEBUG IS NOT FALSE, AUTHOUR FORGOT TO INCREMENT VERSION VARS"; + Console.Title += " - DEBUG IS NOT FALSE, AUTHOUR NEEDS TO REUPLOAD THIS VERSION"; //TODO: Have an app.config and put the paths inside it so users can define locations to load mods from ExecutionPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); @@ -84,6 +84,7 @@ namespace StardewModdingAPI } catch (Exception ex) { + LogError("Could not create a missing ModPath: " + ModPath + "\n\n" + ex); } } |