Skip to content

Commit

Permalink
Merge branch 'develop' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
Pathoschild committed Nov 5, 2024
2 parents fd43bc3 + 79fb337 commit 6a1eb71
Show file tree
Hide file tree
Showing 11 changed files with 86 additions and 15 deletions.
2 changes: 1 addition & 1 deletion build/common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repo. It imports the other MSBuild files as needed.
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!--set general build properties -->
<Version>4.1.2</Version>
<Version>4.1.3</Version>
<Product>SMAPI</Product>
<LangVersion>latest</LangVersion>
<AssemblySearchPaths>$(AssemblySearchPaths);{GAC}</AssemblySearchPaths>
Expand Down
5 changes: 5 additions & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
[README](README.md)

# Release notes
## 4.1.3
Released 04 November 2024 for Stardew Valley 1.6.10 or later.

* Improved compatibility rewriters for Stardew Valley 1.6.9+.

## 4.1.2
Released 04 November 2024 for Stardew Valley 1.6.10 or later.

Expand Down
5 changes: 4 additions & 1 deletion docs/technical/mod-package-release-notes.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
&larr; [mod build config](./mod-build-config.md)

## Release notes
## Upcoming release
## 4.3.1
Released 04 November 2024 for SMAPI 4.1.0 or later.

* Removed build warnings for implicit net field conversions, which were removed in Stardew Valley 1.6.9.
* Fixed zip structure on Linux/macOS after 4.3.0.

## 4.3.0
Released 06 October 2024 for SMAPI 3.13.0 or later.
Expand Down
3 changes: 3 additions & 0 deletions src/SMAPI.ModBuildConfig/DeployModTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,9 @@ private void CreateReleaseZip(IDictionary<string, IModFileManager> modPackages,
foreach (var file in mod.Value.GetFiles())
{
string relativePath = file.Key;
if (relativePath.Contains('\\'))
relativePath = string.Join("/", PathUtilities.GetSegments(relativePath)); // zip files use forward slashes regardless of OS

FileInfo fileInfo = file.Value;

string archivePath = modPackages.Count == 1
Expand Down
2 changes: 1 addition & 1 deletion src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<!--NuGet package-->
<PackageId>Pathoschild.Stardew.ModBuildConfig</PackageId>
<Title>Build package for SMAPI mods</Title>
<Version>4.3.0</Version>
<Version>4.3.1</Version>
<Authors>Pathoschild</Authors>
<Description>Automates the build configuration for crossplatform Stardew Valley SMAPI mods. For SMAPI 3.13.0 or later.</Description>
<PackageReadmeFile>mod-package.md</PackageReadmeFile>
Expand Down
4 changes: 2 additions & 2 deletions src/SMAPI.Mods.ConsoleCommands/manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"Name": "Console Commands",
"Author": "SMAPI",
"Version": "4.1.2",
"Version": "4.1.3",
"Description": "Adds SMAPI console commands that let you manipulate the game.",
"UniqueID": "SMAPI.ConsoleCommands",
"EntryDll": "ConsoleCommands.dll",
"MinimumApiVersion": "4.1.2"
"MinimumApiVersion": "4.1.3"
}
4 changes: 2 additions & 2 deletions src/SMAPI.Mods.SaveBackup/manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"Name": "Save Backup",
"Author": "SMAPI",
"Version": "4.1.2",
"Version": "4.1.3",
"Description": "Automatically backs up all your saves once per day into its folder.",
"UniqueID": "SMAPI.SaveBackup",
"EntryDll": "SaveBackup.dll",
"MinimumApiVersion": "4.1.2"
"MinimumApiVersion": "4.1.3"
}
2 changes: 1 addition & 1 deletion src/SMAPI/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ internal static class EarlyConstants
internal static int? LogScreenId { get; set; }

/// <summary>SMAPI's current raw semantic version.</summary>
internal static string RawApiVersion = "4.1.2";
internal static string RawApiVersion = "4.1.3";
}

/// <summary>Contains SMAPI's constants and assumptions.</summary>
Expand Down
5 changes: 4 additions & 1 deletion src/SMAPI/Framework/ModLoading/Framework/RewriteHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ public static string GetFullCecilName(Type type)
return $"{type.Namespace}.{type.Name}<{string.Join(",", genericTypes.Select(RewriteHelper.GetFullCecilName))}>";
}

return $"{type.Namespace}.{type.Name}";
Type? parentType = type.DeclaringType;
return parentType != null
? $"{RewriteHelper.GetFullCecilName(parentType)}/{type.Name}"
: $"{type.Namespace}.{type.Name}";
}

/// <summary>Get the resolved type for a Cecil type reference.</summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Xna.Framework;
using Netcode;
using StardewModdingAPI.Framework.ModLoading.Framework;
Expand All @@ -7,6 +8,7 @@
using StardewValley.Buildings;
using StardewValley.Extensions;
using StardewValley.Objects;
using xTile;
using xTile.Dimensions;

namespace StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6;
Expand Down Expand Up @@ -80,6 +82,24 @@ public string GetSeasonForLocation()
return base.GetSeasonKey();
}

/// <remarks>Changed in Stardew Valley 1.6.9.</remarks>
public int getTileIndexAt(Location p, string layer)
{
return base.getTileIndexAt(p, layer);
}

/// <remarks>Changed in Stardew Valley 1.6.9.</remarks>
public int getTileIndexAt(Point p, string layer)
{
return base.getTileIndexAt(p.X, p.Y, layer);
}

/// <remarks>Changed in Stardew Valley 1.6.9.</remarks>
public int getTileIndexAt(int x, int y, string layer)
{
return base.getTileIndexAt(x, y, layer);
}

/// <remarks>Changed in Stardew Valley 1.6.9.</remarks>
public bool hasLightSource(int identifier)
{
Expand Down Expand Up @@ -183,6 +203,30 @@ public void removeLightSource(int identifier)
base.removeLightSource(identifier.ToString());
}

/// <remarks>Changed in Stardew Valley 1.6.9.</remarks>
public void setAnimatedMapTile(int tileX, int tileY, int[] animationTileIndexes, long interval, string layer, string action, int whichTileSheet = 0)
{
if (GameLocationFacade.TryGetTileSheetId(this, whichTileSheet, out string? tilesheetId))
base.setAnimatedMapTile(tileX, tileY, animationTileIndexes, interval, layer, tilesheetId, action);
}

/// <remarks>Changed in Stardew Valley 1.6.9.</remarks>
public void setMapTile(int tileX, int tileY, int index, string layer, string action, int whichTileSheet = 0)
{
if (GameLocationFacade.TryGetTileSheetId(this, whichTileSheet, out string? tilesheetId))
base.setMapTile(tileX, tileY, index, layer, tilesheetId, action);
}

/// <remarks>Changed in Stardew Valley 1.6.9.</remarks>
public void setMapTileIndex(int tileX, int tileY, int index, string layer, int whichTileSheet = 0)
{
if (index == -1)
base.removeMapTile(tileX, tileY, layer);

else if (GameLocationFacade.TryGetTileSheetId(this, whichTileSheet, out string? tilesheetId))
base.setMapTile(tileX, tileY, index, layer, tilesheetId);
}


/*********
** Private methods
Expand All @@ -191,4 +235,23 @@ private GameLocationFacade()
{
RewriteHelper.ThrowFakeConstructorCalled();
}

/// <summary>Get the ID for the tilesheet at the given index in this location's <see cref="Map.TileSheets"/>.</summary>
/// <param name="location">The location whose tilesheets to search.</param>
/// <param name="index">The index to check.</param>
/// <param name="id">The ID of the tilesheet, if found.</param>
/// <returns>Returns whether the index was within the bounds of the tilesheet list.</returns>
private static bool TryGetTileSheetId(GameLocation location, int index, [NotNullWhen(true)] out string? id)
{
var tilesheets = location.map?.TileSheets;

if (tilesheets is not null && index >= 0 && index < tilesheets.Count)
{
id = tilesheets[index].Id;
return true;
}

id = null;
return false;
}
}
6 changes: 0 additions & 6 deletions src/SMAPI/Metadata/InstructionMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,6 @@ public IEnumerable<IInstructionHandler> GetHandlers(bool paranoidMode, bool rewr
.MapFacade<WateringCan, WateringCanFacade>()
.MapFacade<WorldDate, WorldDateFacade>()

// Mono.Cecil seems to have trouble resolving rewritten signatures which include a nested type like `StardewValley.BellsAndWhistles.SpriteText/ScrollTextAlignment`
.MapMethod("System.Void StardewValley.BellsAndWhistles.SpriteText::drawString(Microsoft.Xna.Framework.Graphics.SpriteBatch,System.String,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Single,System.Single,System.Boolean,System.Int32,System.String,System.Int32,StardewValley.BellsAndWhistles.SpriteText/ScrollTextAlignment)", typeof(SpriteTextFacade), nameof(SpriteTextFacade.drawString))
.MapMethod("System.Void StardewValley.BellsAndWhistles.SpriteText::drawStringWithScrollBackground(Microsoft.Xna.Framework.Graphics.SpriteBatch,System.String,System.Int32,System.Int32,System.String,System.Single,System.Int32,StardewValley.BellsAndWhistles.SpriteText/ScrollTextAlignment)", typeof(SpriteTextFacade), nameof(SpriteTextFacade.drawStringWithScrollBackground))
.MapMethod("System.Void StardewValley.Projectiles.BasicProjectile::.ctor(System.Int32,System.Int32,System.Int32,System.Int32,System.Single,System.Single,System.Single,Microsoft.Xna.Framework.Vector2,System.String,System.String,System.Boolean,System.Boolean,StardewValley.GameLocation,StardewValley.Character,System.Boolean,StardewValley.Projectiles.BasicProjectile/onCollisionBehavior)", typeof(BasicProjectileFacade), nameof(BasicProjectileFacade.Constructor), new[] { typeof(int), typeof(int), typeof(int), typeof(int), typeof(float), typeof(float), typeof(float), typeof(Vector2), typeof(string), typeof(string), typeof(bool), typeof(bool), typeof(GameLocation), typeof(Character), typeof(bool), typeof(onCollisionBehavior) })
.MapMethod("System.String StardewValley.LocalizedContentManager::LanguageCodeString(StardewValley.LocalizedContentManager/LanguageCode)", typeof(LocalizedContentManagerFacade), nameof(LocalizedContentManager.LanguageCodeString))

// BuildableGameLocation merged into GameLocation
.MapFacade("StardewValley.Locations.BuildableGameLocation", typeof(BuildableGameLocationFacade))
.MapField("Netcode.NetCollection`1<StardewValley.Buildings.Building> StardewValley.Locations.BuildableGameLocation::buildings", typeof(GameLocation), nameof(GameLocation.buildings))
Expand Down

0 comments on commit 6a1eb71

Please sign in to comment.