Skip to content

Commit

Permalink
Update for Stardew Valley 1.5 and 64-bit SMAPI, minor fixes (#22)
Browse files Browse the repository at this point in the history
* fix hardcoded paths

* fix button suppression in Pong

* update NuGet packages

* update for Stardew Valley 1.5

* update for 64-bit SMAPI

* update sprinkler & scarecrow range for Stardew Valley 1.5

* remove unneeded dependency on SMAPI toolkit
  • Loading branch information
Pathoschild authored Apr 25, 2021
1 parent 05bcd20 commit 233c360
Show file tree
Hide file tree
Showing 52 changed files with 151 additions and 648 deletions.
9 changes: 2 additions & 7 deletions AutoStacker/AutoStacker.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AssemblyName>AutoStacker</AssemblyName>
<RootNamespace>AutoStacker</RootNamespace>
<Version>1.3.0</Version>
<TargetFramework>net452</TargetFramework>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0" />
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.3.0" />
</ItemGroup>

</Project>
</Project>
13 changes: 3 additions & 10 deletions BetterArtisanGoodIcons/BetterArtisanGoodIcons.csproj
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AssemblyName>BetterArtisanGoodIcons</AssemblyName>
<RootNamespace>BetterArtisanGoodIcons</RootNamespace>
<Version>1.5.0</Version>
<TargetFramework>net452</TargetFramework>
<PlatformTarget>x86</PlatformTarget>

<EnableHarmony>true</EnableHarmony>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0" />
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.3.0" />
</ItemGroup>

<ItemGroup>
<Reference Include="Newtonsoft.Json">
<HintPath>D:\Steam\SteamApps\common\Stardew Valley\smapi-internal\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json" HintPath="$(GamePath)\smapi-internal\Newtonsoft.Json.dll" />
</ItemGroup>

</Project>
</Project>
9 changes: 2 additions & 7 deletions BetterAutomaticGates/BetterAutomaticGates.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AssemblyName>BetterAutomaticGates</AssemblyName>
<RootNamespace>BetterAutomaticGates</RootNamespace>
<Version>1.0.0</Version>
<TargetFramework>net452</TargetFramework>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0" />
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.3.0" />
</ItemGroup>

</Project>
</Project>
15 changes: 2 additions & 13 deletions BetterDoors/BetterDoors.csproj
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AssemblyName>BetterDoors</AssemblyName>
<RootNamespace>BetterDoors</RootNamespace>
<Version>1.0.0</Version>
<TargetFramework>net452</TargetFramework>
<PlatformTarget>x86</PlatformTarget>

<EnableHarmony>true</EnableHarmony>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0" />
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.3.0" />
</ItemGroup>

<ItemGroup>
<Reference Include="SMAPI.Toolkit">
<HintPath>D:\Steam\SteamApps\common\Stardew Valley\smapi-internal\SMAPI.Toolkit.dll</HintPath>
</Reference>
</ItemGroup>

</Project>
</Project>
1 change: 0 additions & 1 deletion BetterDoors/Framework/ContentPacks/ContentPackLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using SemanticVersion = StardewModdingAPI.Toolkit.SemanticVersion;

namespace BetterDoors.Framework.ContentPacks
{
Expand Down
1 change: 0 additions & 1 deletion BetterDoors/Framework/Mapping/Properties/MapDoorVersion.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using StardewModdingAPI;
using SemanticVersion = StardewModdingAPI.Toolkit.SemanticVersion;

namespace BetterDoors.Framework.Mapping.Properties
{
Expand Down
9 changes: 2 additions & 7 deletions BetterFruitTrees/BetterFruitTrees.csproj
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AssemblyName>BetterFruitTrees</AssemblyName>
<RootNamespace>BetterFruitTrees</RootNamespace>
<Version>2.6.0</Version>
<TargetFramework>net452</TargetFramework>
<PlatformTarget>x86</PlatformTarget>

<EnableHarmony>true</EnableHarmony>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0" />
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.3.0" />
</ItemGroup>

</Project>
</Project>
25 changes: 3 additions & 22 deletions BetterFruitTrees/GrowHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ private void OnSaving(object sender, SavingEventArgs e)
foreach (GameLocation l in Game1.locations)
foreach (KeyValuePair<Vector2, TerrainFeature> fruitTree in l.terrainFeatures.Pairs.Where(
item => item.Value is FruitTree))
if (!this.CanFruitTreeGrow(l, fruitTree.Key))
if (FruitTree.IsGrowthBlocked(fruitTree.Key, l))
this.SimulateFruitTreeDayUpdate(l, fruitTree.Value as FruitTree);
}

Expand All @@ -44,31 +44,12 @@ private void SimulateFruitTreeDayUpdate(GameLocation l, FruitTree tree)
//We only want to add a fruit to the tree if our simulated growth caused the tree to fully mature. If it is already mature, the game would have already added a fruit.
if (oldGrowthStage != 4 && !tree.stump.Value && tree.growthStage.Value == 4 &&
(tree.struckByLightningCountdown.Value > 0 && !Game1.IsWinter ||
Game1.currentSeason.Equals(tree.fruitSeason.Value) || l.Name.ToLower().Contains("greenhouse")))
tree.IsInSeasonHere(l) || l.SeedsIgnoreSeasonsHere()))
{
tree.fruitsOnTree.Value = Math.Min(3, tree.fruitsOnTree.Value + 1);
if (l.Name.ToLower().Contains("greenhouse"))
if (l.IsGreenhouse)
tree.GreenHouseTree = true;
}
}

/// <summary>Whether a fruit tree at the given tile and game location could grow.</summary>
private bool CanFruitTreeGrow(GameLocation l, Vector2 tileLocation)
{
bool cannotGrow = false;
foreach (Vector2 surroundingTileLocations in Utility.getSurroundingTileLocationsArray(tileLocation))
{
bool flag2 = l.terrainFeatures.ContainsKey(surroundingTileLocations) &&
l.terrainFeatures[surroundingTileLocations] is HoeDirt &&
(l.terrainFeatures[surroundingTileLocations] as HoeDirt).crop == null;
if (l.isTileOccupied(surroundingTileLocations, "") && !flag2)
{
cannotGrow = true;
break;
}
}

return !cannotGrow;
}
}
}
28 changes: 18 additions & 10 deletions BetterFruitTrees/Patches/PlacementPatch.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Microsoft.Xna.Framework;
using StardewValley;
using StardewValley.Locations;
using StardewValley.TerrainFeatures;
using SObject = StardewValley.Object;

Expand All @@ -11,10 +12,12 @@ public static bool Prefix(SObject __instance, ref bool __result, GameLocation lo
Farmer who)
{
//Not a sapling
if (!__instance.Name.Contains("Sapling"))
if (!__instance.isSapling() || __instance.ParentSheetIndex == 251) // 251: tea sapling
return true;

Vector2 index1 = new Vector2((float)(x / 64), (float)(y / 64));
int tileX = x / 64;
int tileY = y / 64;
Vector2 index1 = new Vector2(tileX, tileY);

//The original code has a check for this, but execution never actually reaches here because saplings aren't allowed to be placed on dirt
//Terrain feature at the position
Expand All @@ -26,13 +29,12 @@ public static bool Prefix(SObject __instance, ref bool __result, GameLocation lo
}

bool nearbyTree = false;
Vector2 key = new Vector2();
for (int index2 = x / 64 - 2; index2 <= x / 64 + 2; ++index2)

for (int index2 = tileX - 2; index2 <= tileX + 2; ++index2)
{
for (int index3 = y / 64 - 2; index3 <= y / 64 + 2; ++index3)
for (int index3 = tileY - 2; index3 <= tileY + 2; ++index3)
{
key.X = (float)index2;
key.Y = (float)index3;
Vector2 key = new Vector2(index2, index3);
if (location.terrainFeatures.ContainsKey(key) &&
(location.terrainFeatures[key] is Tree || location.terrainFeatures[key] is FruitTree))
{
Expand All @@ -45,7 +47,7 @@ public static bool Prefix(SObject __instance, ref bool __result, GameLocation lo
break;
}

bool correctTileProperties = location is Farm ? ((location.doesTileHaveProperty((int)index1.X, (int)index1.Y, "Diggable",
bool correctTileProperties = IsFarm(location) ? ((location.doesTileHaveProperty((int)index1.X, (int)index1.Y, "Diggable",
"Back") != null ||
location.doesTileHavePropertyNoNull((int)index1.X, (int)index1.Y, "Type",
"Back").Equals("Grass")) &&
Expand All @@ -55,7 +57,7 @@ public static bool Prefix(SObject __instance, ref bool __result, GameLocation lo
location.doesTileHavePropertyNoNull((int)index1.X, (int)index1.Y, "Type",
"Back").Equals("Stone")));

bool gameValidLocation = location is Farm || location.IsGreenhouse;
bool gameValidLocation = IsFarm(location) || location.IsGreenhouse;

//If the game would return true, let it run
if (gameValidLocation && correctTileProperties && !nearbyTree)
Expand All @@ -81,16 +83,22 @@ public static bool Prefix(SObject __instance, ref bool __result, GameLocation lo
DelayedAction.playSoundAfterDelay("coin", 100);

//If the game was going to place a tree, it removed anything at the tree index, so we do the same
bool actAsGreenhouse = location.IsGreenhouse || ((__instance.ParentSheetIndex == 69 || __instance.ParentSheetIndex == 835) && location is IslandWest); // 69: banana sapling, 835: mango sapling
location.terrainFeatures.Remove(index1);
location.terrainFeatures.Add(index1, new FruitTree(__instance.ParentSheetIndex)
{
GreenHouseTree = location.IsGreenhouse,
GreenHouseTree = actAsGreenhouse,
GreenHouseTileTree = location.doesTileHavePropertyNoNull((int)index1.X, (int)index1.Y, "Type", "Back")
.Equals("Stone")
});

__result = true;
return false;
}

private static bool IsFarm(GameLocation location)
{
return location is Farm || location is IslandWest;
}
}
}
9 changes: 2 additions & 7 deletions BetterGardenPots/BetterGardenPots.csproj
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AssemblyName>BetterGardenPots</AssemblyName>
<RootNamespace>BetterGardenPots</RootNamespace>
<Version>1.6.0</Version>
<TargetFramework>net452</TargetFramework>
<PlatformTarget>x86</PlatformTarget>

<EnableHarmony>true</EnableHarmony>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0" />
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.3.0" />
</ItemGroup>

</Project>
</Project>
9 changes: 2 additions & 7 deletions BetterHay/BetterHay.csproj
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AssemblyName>BetterHay</AssemblyName>
<RootNamespace>BetterHay</RootNamespace>
<Version>3.0.0</Version>
<TargetFramework>net452</TargetFramework>
<PlatformTarget>x86</PlatformTarget>

<EnableHarmony>true</EnableHarmony>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0" />
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.3.0" />
</ItemGroup>

</Project>
</Project>
9 changes: 2 additions & 7 deletions BetterSlingshots/BetterSlingshots.csproj
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AssemblyName>BetterSlingshots</AssemblyName>
<RootNamespace>BetterSlingshots</RootNamespace>
<Version>2.0.0</Version>
<TargetFramework>net452</TargetFramework>
<PlatformTarget>x86</PlatformTarget>

<EnableHarmony>true</EnableHarmony>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0" />
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.3.0" />
</ItemGroup>

</Project>
</Project>
15 changes: 3 additions & 12 deletions BetterWorkbenches/BetterWorkbenches.csproj
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>BetterWorkbenches</AssemblyName>
<RootNamespace>BetterWorkbenches</RootNamespace>
<Version>1.0.0</Version>
<TargetFramework>net452</TargetFramework>
<PlatformTarget>x86</PlatformTarget>

<EnableHarmony>true</EnableHarmony>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0" />
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.3.0" />
</ItemGroup>

<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>

</Project>
</Project>
9 changes: 2 additions & 7 deletions CactiHurtYou/CactiHurtYou.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AssemblyName>CactiHurtYou</AssemblyName>
<RootNamespace>CactiHurtYou</RootNamespace>
<Version>1.1.1</Version>
<TargetFramework>net452</TargetFramework>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0" />
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.3.0" />
</ItemGroup>

</Project>
</Project>
Loading

0 comments on commit 233c360

Please sign in to comment.