Fixed mod content path not being set correctly. Fixed object draw code. Custom objects can now be placed and show up correctly.
This commit is contained in:
parent
8bf9e74096
commit
49090c98fc
|
@ -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
|
||||
{
|
||||
}
|
||||
}
|
|
@ -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
|
||||
{
|
||||
}
|
||||
}
|
|
@ -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
|
||||
{
|
||||
}
|
||||
}
|
|
@ -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
|
||||
{
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -68,14 +68,15 @@ namespace StardewModdingAPI.Inheritance
|
|||
{
|
||||
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");
|
||||
|
|
|
@ -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));
|
||||
StardewModdingAPI.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("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
|
||||
|
|
|
@ -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" />
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue