diff options
author | ClxS <slxxls92@gmail.com> | 2016-03-06 23:28:32 +0000 |
---|---|---|
committer | ClxS <slxxls92@gmail.com> | 2016-03-06 23:28:32 +0000 |
commit | 49090c98fcdc11ca536de42875f50b763e83ce63 (patch) | |
tree | 184c24f76dc30e4e2ea6383b58b9e33cdd5db93d /StardewModdingAPI | |
parent | 8bf9e7409692a59c880158cf851f55da35f3022e (diff) | |
download | SMAPI-49090c98fcdc11ca536de42875f50b763e83ce63.tar.gz SMAPI-49090c98fcdc11ca536de42875f50b763e83ce63.tar.bz2 SMAPI-49090c98fcdc11ca536de42875f50b763e83ce63.zip |
Fixed mod content path not being set correctly. Fixed object draw code. Custom objects can now be placed and show up correctly.
Diffstat (limited to 'StardewModdingAPI')
-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 |
8 files changed, 114 insertions, 20 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" />
|