diff options
-rw-r--r-- | StardewModdingAPI/Entities/SCharacter.cs | 12 | ||||
-rw-r--r-- | StardewModdingAPI/Entities/SFarm.cs | 12 | ||||
-rw-r--r-- | StardewModdingAPI/Entities/SFarmAnimal.cs | 12 | ||||
-rw-r--r-- | StardewModdingAPI/Entities/SNpc.cs | 12 | ||||
-rw-r--r-- | StardewModdingAPI/Entities/SPlayer.cs | 37 | ||||
-rw-r--r-- | StardewModdingAPI/Inheritance/SObject.cs | 13 | ||||
-rw-r--r-- | StardewModdingAPI/Program.cs | 28 | ||||
-rw-r--r-- | StardewModdingAPI/StardewModdingAPI.csproj | 8 | ||||
-rw-r--r-- | TrainerMod/TrainerMod.cs | 4 | ||||
-rw-r--r-- | TrainerMod/TrainerMod.csproj | 6 |
10 files changed, 118 insertions, 26 deletions
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<Farmer> 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 @@ <PlatformTarget>x86</PlatformTarget>
<OutputPath>bin\x86\Debug\</OutputPath>
<Prefer32Bit>false</Prefer32Bit>
+ <DefineConstants>
+ </DefineConstants>
+ <UseVSHostingProcess>true</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<PlatformTarget>x86</PlatformTarget>
@@ -99,6 +102,11 @@ <ItemGroup>
<Compile Include="Command.cs" />
<Compile Include="Constants.cs" />
+ <Compile Include="Entities\SCharacter.cs" />
+ <Compile Include="Entities\SFarm.cs" />
+ <Compile Include="Entities\SFarmAnimal.cs" />
+ <Compile Include="Entities\SNpc.cs" />
+ <Compile Include="Entities\SPlayer.cs" />
<Compile Include="Events\Controls.cs" />
<Compile Include="Events\EventArgs.cs" />
<Compile Include="Events\Game.cs" />
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 @@ <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
+ <OutputPath>..\StardewModdingAPI\bin\x86\Debug\Mods\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -41,7 +41,7 @@ <Private>False</Private>
</Reference>
<Reference Include="Stardew Valley">
- <HintPath>$(SteamInstallPath)\steamapps\common\Stardew Valley\Stardew Valley.exe</HintPath>
+ <HintPath>..\..\..\..\Games\SteamLibrary\steamapps\common\Stardew Valley\Stardew Valley.exe</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
@@ -53,7 +53,7 @@ <Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="xTile">
- <HintPath>$(SteamInstallPath)\steamapps\common\Stardew Valley\xTile.dll</HintPath>
+ <HintPath>..\..\..\..\Games\SteamLibrary\steamapps\common\Stardew Valley\xTile.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
|