From 126ce53618719f6734125669e1466f681be49a78 Mon Sep 17 00:00:00 2001 From: ClxS Date: Sun, 6 Mar 2016 18:01:52 +0000 Subject: Updated readme. Small change to prevent trainermod using copy-local --- TrainerMod/TrainerMod.csproj | 3 +++ 1 file changed, 3 insertions(+) (limited to 'TrainerMod/TrainerMod.csproj') diff --git a/TrainerMod/TrainerMod.csproj b/TrainerMod/TrainerMod.csproj index c7dbe94f..8753bc1b 100644 --- a/TrainerMod/TrainerMod.csproj +++ b/TrainerMod/TrainerMod.csproj @@ -42,6 +42,7 @@ $(SteamInstallPath)\steamapps\common\Stardew Valley\Stardew Valley.exe + False @@ -53,6 +54,7 @@ $(SteamInstallPath)\steamapps\common\Stardew Valley\xTile.dll + False @@ -63,6 +65,7 @@ {f1a573b0-f436-472c-ae29-0b91ea6b9f8f} StardewModdingAPI + False -- cgit From 49090c98fcdc11ca536de42875f50b763e83ce63 Mon Sep 17 00:00:00 2001 From: ClxS Date: Sun, 6 Mar 2016 23:28:32 +0000 Subject: Fixed mod content path not being set correctly. Fixed object draw code. Custom objects can now be placed and show up correctly. --- StardewModdingAPI/Entities/SCharacter.cs | 12 ++++++++++ StardewModdingAPI/Entities/SFarm.cs | 12 ++++++++++ StardewModdingAPI/Entities/SFarmAnimal.cs | 12 ++++++++++ StardewModdingAPI/Entities/SNpc.cs | 12 ++++++++++ StardewModdingAPI/Entities/SPlayer.cs | 37 ++++++++++++++++++++++++++++++ StardewModdingAPI/Inheritance/SObject.cs | 13 ++++++----- StardewModdingAPI/Program.cs | 28 +++++++++++----------- StardewModdingAPI/StardewModdingAPI.csproj | 8 +++++++ TrainerMod/TrainerMod.cs | 4 +--- TrainerMod/TrainerMod.csproj | 6 ++--- 10 files changed, 118 insertions(+), 26 deletions(-) create mode 100644 StardewModdingAPI/Entities/SCharacter.cs create mode 100644 StardewModdingAPI/Entities/SFarm.cs create mode 100644 StardewModdingAPI/Entities/SFarmAnimal.cs create mode 100644 StardewModdingAPI/Entities/SNpc.cs create mode 100644 StardewModdingAPI/Entities/SPlayer.cs (limited to 'TrainerMod/TrainerMod.csproj') diff --git a/StardewModdingAPI/Entities/SCharacter.cs b/StardewModdingAPI/Entities/SCharacter.cs new file mode 100644 index 00000000..740a6d7f --- /dev/null +++ b/StardewModdingAPI/Entities/SCharacter.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StardewModdingAPI.Entities +{ + class SCharacter + { + } +} diff --git a/StardewModdingAPI/Entities/SFarm.cs b/StardewModdingAPI/Entities/SFarm.cs new file mode 100644 index 00000000..5d1647a8 --- /dev/null +++ b/StardewModdingAPI/Entities/SFarm.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StardewModdingAPI.Entities +{ + class SFarm + { + } +} diff --git a/StardewModdingAPI/Entities/SFarmAnimal.cs b/StardewModdingAPI/Entities/SFarmAnimal.cs new file mode 100644 index 00000000..0f768f6a --- /dev/null +++ b/StardewModdingAPI/Entities/SFarmAnimal.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StardewModdingAPI.Entities +{ + class SFarmAnimal + { + } +} diff --git a/StardewModdingAPI/Entities/SNpc.cs b/StardewModdingAPI/Entities/SNpc.cs new file mode 100644 index 00000000..02242d20 --- /dev/null +++ b/StardewModdingAPI/Entities/SNpc.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StardewModdingAPI.Entities +{ + class SNpc + { + } +} diff --git a/StardewModdingAPI/Entities/SPlayer.cs b/StardewModdingAPI/Entities/SPlayer.cs new file mode 100644 index 00000000..ae4e9472 --- /dev/null +++ b/StardewModdingAPI/Entities/SPlayer.cs @@ -0,0 +1,37 @@ +using StardewModdingAPI.Inheritance; +using StardewValley; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StardewModdingAPI.Entities +{ + public static class SPlayer + { + public static List AllFarmers + { + get + { + return SGame.getAllFarmers(); + } + } + + public static Farmer CurrentFarmer + { + get + { + return SGame.player; + } + } + + public static GameLocation CurrentFarmerLocation + { + get + { + return SGame.player.currentLocation; + } + } + } +} diff --git a/StardewModdingAPI/Inheritance/SObject.cs b/StardewModdingAPI/Inheritance/SObject.cs index 28254c24..3dcddb9e 100644 --- a/StardewModdingAPI/Inheritance/SObject.cs +++ b/StardewModdingAPI/Inheritance/SObject.cs @@ -65,17 +65,18 @@ namespace StardewModdingAPI.Inheritance } public override void draw(SpriteBatch spriteBatch, int x, int y, float alpha = 1) - { + { if (Texture != null) { - int targSize = Game1.tileSize; - - Vector2 local = Game1.GlobalToLocal(Game1.viewport, new Vector2(x,y)); - Rectangle targ = new Rectangle((int)local.X, (int)local.Y, targSize, targSize); - spriteBatch.Draw(Texture, targ, null, new Color(255, 255, 255, 255f * alpha)); + spriteBatch.Draw(Texture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(((x * Game1.tileSize) + (Game1.tileSize / 2)) + ((this.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0)), (float)(((y * Game1.tileSize) + (Game1.tileSize / 2)) + ((this.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0)))), new Rectangle?(Game1.currentLocation.getSourceRectForObject(this.ParentSheetIndex)), (Color)(Color.White * alpha), 0f, new Vector2(8f, 8f), (this.scale.Y > 1f) ? this.getScale().Y : ((float)Game1.pixelZoom), this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (this.isPassable() ? ((float)this.getBoundingBox(new Vector2((float)x, (float)y)).Top) : ((float)this.getBoundingBox(new Vector2((float)x, (float)y)).Bottom)) / 10000f); } } + public void drawAsProp(SpriteBatch b) + { + + } + public override void draw(SpriteBatch spriteBatch, int xNonTile, int yNonTile, float layerDepth, float alpha = 1) { Log.Debug("THIS DRAW FUNCTION IS NOT IMPLEMENTED I WANT TO KNOW WHERE IT IS CALLED"); diff --git a/StardewModdingAPI/Program.cs b/StardewModdingAPI/Program.cs index f1ccd936..61770f8e 100644 --- a/StardewModdingAPI/Program.cs +++ b/StardewModdingAPI/Program.cs @@ -89,7 +89,7 @@ namespace StardewModdingAPI //TODO: Have an app.config and put the paths inside it so users can define locations to load mods from _modPaths.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "StardewValley", "Mods")); _modPaths.Add(Path.Combine(Constants.ExecutionPath, "Mods")); - _modPaths.Add(Path.Combine(Constants.ExecutionPath, "Mods", "Content")); + _modContentPaths.Add(Path.Combine(Constants.ExecutionPath, "Mods", "Content")); _modContentPaths.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "StardewValley", "Mods", "Content")); //Checks that all defined modpaths exist as directories @@ -359,25 +359,25 @@ namespace StardewModdingAPI DebugPixel.SetData(new Color[] { Color.White }); #if DEBUG - Log.Verbose("REGISTERING BASE CUSTOM ITEM"); + StardewModdingAPI.Log.Verbose("REGISTERING BASE CUSTOM ITEM"); SObject so = new SObject(); so.Name = "Mario Block"; so.CategoryName = "SMAPI Test Mod"; so.Description = "It's a block from Mario!\nLoaded in realtime by SMAPI."; - so.Texture = Texture2D.FromStream(Game1.graphics.GraphicsDevice, new FileStream(ModContentPaths[0] + "\\Test.png", FileMode.Open)); + so.Texture = Texture2D.FromStream(Game1.graphics.GraphicsDevice, new FileStream(_modContentPaths[0] + "\\Test.png", FileMode.Open)); so.IsPassable = true; so.IsPlaceable = true; - Log.Verbose("REGISTERED WITH ID OF: " + SGame.RegisterModItem(so)); - - Log.Verbose("REGISTERING SECOND CUSTOM ITEM"); - SObject so2 = new SObject(); - so2.Name = "Mario Painting"; - so2.CategoryName = "SMAPI Test Mod"; - so2.Description = "It's a painting of a creature from Mario!\nLoaded in realtime by SMAPI."; - so2.Texture = Texture2D.FromStream(Game1.graphics.GraphicsDevice, new FileStream(ModContentPaths[0] + "\\PaintingTest.png", FileMode.Open)); - so2.IsPassable = true; - so2.IsPlaceable = true; - Log.Verbose("REGISTERED WITH ID OF: " + SGame.RegisterModItem(so2)); + StardewModdingAPI.Log.Verbose("REGISTERED WITH ID OF: " + SGame.RegisterModItem(so)); + + //StardewModdingAPI.Log.Verbose("REGISTERING SECOND CUSTOM ITEM"); + //SObject so2 = new SObject(); + //so2.Name = "Mario Painting"; + //so2.CategoryName = "SMAPI Test Mod"; + //so2.Description = "It's a painting of a creature from Mario!\nLoaded in realtime by SMAPI."; + //so2.Texture = Texture2D.FromStream(Game1.graphics.GraphicsDevice, new FileStream(_modContentPaths[0] + "\\PaintingTest.png", FileMode.Open)); + //so2.IsPassable = true; + //so2.IsPlaceable = true; + //StardewModdingAPI.Log.Verbose("REGISTERED WITH ID OF: " + SGame.RegisterModItem(so2)); Command.CallCommand("load"); #endif diff --git a/StardewModdingAPI/StardewModdingAPI.csproj b/StardewModdingAPI/StardewModdingAPI.csproj index 6d70b1c5..5b962d44 100644 --- a/StardewModdingAPI/StardewModdingAPI.csproj +++ b/StardewModdingAPI/StardewModdingAPI.csproj @@ -61,6 +61,9 @@ x86 bin\x86\Debug\ false + + + true x86 @@ -99,6 +102,11 @@ + + + + + diff --git a/TrainerMod/TrainerMod.cs b/TrainerMod/TrainerMod.cs index 9f918ce4..e2482c5d 100644 --- a/TrainerMod/TrainerMod.cs +++ b/TrainerMod/TrainerMod.cs @@ -762,12 +762,10 @@ namespace TrainerMod static void RegisterNewItem(object sender, EventArgsCommand e) { #if DEBUG - Log.Error("Experimental code cannot be run in user mode."); - return; -#endif SObject s = SGame.PullModItemFromDict(0, true); s.Stack = 999; Game1.player.addItemToInventory(s); +#endif } } } diff --git a/TrainerMod/TrainerMod.csproj b/TrainerMod/TrainerMod.csproj index 8753bc1b..3cd42786 100644 --- a/TrainerMod/TrainerMod.csproj +++ b/TrainerMod/TrainerMod.csproj @@ -17,7 +17,7 @@ true full false - bin\Debug\ + ..\StardewModdingAPI\bin\x86\Debug\Mods\ DEBUG;TRACE prompt 4 @@ -41,7 +41,7 @@ False - $(SteamInstallPath)\steamapps\common\Stardew Valley\Stardew Valley.exe + ..\..\..\..\Games\SteamLibrary\steamapps\common\Stardew Valley\Stardew Valley.exe False @@ -53,7 +53,7 @@ - $(SteamInstallPath)\steamapps\common\Stardew Valley\xTile.dll + ..\..\..\..\Games\SteamLibrary\steamapps\common\Stardew Valley\xTile.dll False -- cgit From eebbab0e1e955824128ff117351048913014a952 Mon Sep 17 00:00:00 2001 From: ClxS Date: Mon, 7 Mar 2016 17:37:08 +0000 Subject: Updated version, and stopped TrainerMod spamming the window with "Cyan" --- StardewModdingAPI/Command.cs | 2 +- StardewModdingAPI/Constants.cs | 2 +- TrainerMod/TrainerMod.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'TrainerMod/TrainerMod.csproj') diff --git a/StardewModdingAPI/Command.cs b/StardewModdingAPI/Command.cs index 71a2483b..164263d6 100644 --- a/StardewModdingAPI/Command.cs +++ b/StardewModdingAPI/Command.cs @@ -62,7 +62,7 @@ namespace StardewModdingAPI } RegisteredCommands.Add(c); - Log.Verbose(ConsoleColor.Cyan, "Registered command: " + command); + Log.Verbose("Registered command: " + command); return c; } diff --git a/StardewModdingAPI/Constants.cs b/StardewModdingAPI/Constants.cs index f8b913f7..b8fe3389 100644 --- a/StardewModdingAPI/Constants.cs +++ b/StardewModdingAPI/Constants.cs @@ -35,7 +35,7 @@ namespace StardewModdingAPI public const int MinorVersion = 37; - public const int PatchVersion = 1; + public const int PatchVersion = 2; public const string Build = "Alpha"; diff --git a/TrainerMod/TrainerMod.csproj b/TrainerMod/TrainerMod.csproj index 3cd42786..9c2f10a4 100644 --- a/TrainerMod/TrainerMod.csproj +++ b/TrainerMod/TrainerMod.csproj @@ -18,7 +18,7 @@ full false ..\StardewModdingAPI\bin\x86\Debug\Mods\ - DEBUG;TRACE + TRACE prompt 4 x86 -- cgit From dbe648486d8253d9c3785ebcb9c2b8935ea55d8b Mon Sep 17 00:00:00 2001 From: James Finlay Date: Mon, 7 Mar 2016 19:02:53 -0800 Subject: Use choose to select build location - Supports by reference & env var --- StardewModdingAPI/StardewModdingAPI.csproj | 16 ++++++++++++++-- TrainerMod/TrainerMod.csproj | 16 ++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) (limited to 'TrainerMod/TrainerMod.csproj') diff --git a/StardewModdingAPI/StardewModdingAPI.csproj b/StardewModdingAPI/StardewModdingAPI.csproj index c2da6299..523ab7bd 100644 --- a/StardewModdingAPI/StardewModdingAPI.csproj +++ b/StardewModdingAPI/StardewModdingAPI.csproj @@ -36,6 +36,18 @@ true + + + + $(SteamInstallPath) + + + + + ..\..\..\..\Games\SteamLibrary + + + x86 true @@ -80,7 +92,7 @@ False - ..\..\..\..\Games\SteamLibrary\steamapps\common\Stardew Valley\Stardew Valley.exe + $(SteamPath)\steamapps\common\Stardew Valley\Stardew Valley.exe @@ -93,7 +105,7 @@ False - ..\..\..\..\Games\SteamLibrary\steamapps\common\Stardew Valley\xTile.dll + $(SteamPath)\steamapps\common\Stardew Valley\xTile.dll diff --git a/TrainerMod/TrainerMod.csproj b/TrainerMod/TrainerMod.csproj index 9c2f10a4..ddf1b317 100644 --- a/TrainerMod/TrainerMod.csproj +++ b/TrainerMod/TrainerMod.csproj @@ -33,6 +33,18 @@ 4 false + + + + $(SteamInstallPath) + + + + + ..\..\..\..\Games\SteamLibrary + + + False @@ -41,7 +53,7 @@ False - ..\..\..\..\Games\SteamLibrary\steamapps\common\Stardew Valley\Stardew Valley.exe + $(SteamPath)\steamapps\common\Stardew Valley\Stardew Valley.exe False @@ -53,7 +65,7 @@ - ..\..\..\..\Games\SteamLibrary\steamapps\common\Stardew Valley\xTile.dll + $(SteamPath)\steamapps\common\Stardew Valley\xTile.dll False -- cgit