-
-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve rewriters for Stardew Valley 1.6
- Loading branch information
1 parent
21abd0f
commit da7e709
Showing
32 changed files
with
1,091 additions
and
23 deletions.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BasicProjectileFacade.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using Microsoft.Xna.Framework; | ||
using StardewModdingAPI.Framework.ModLoading.Framework; | ||
using StardewValley; | ||
using StardewValley.Projectiles; | ||
|
||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member: This is internal code to support rewriters and shouldn't be called directly. | ||
|
||
namespace StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6 | ||
{ | ||
/// <summary>Maps Stardew Valley 1.5.6's <see cref="BasicProjectile"/> methods to their newer form to avoid breaking older mods.</summary> | ||
/// <remarks>This is public to support SMAPI rewriting and should never be referenced directly by mods. See remarks on <see cref="ReplaceReferencesRewriter"/> for more info.</remarks> | ||
[SuppressMessage("ReSharper", "IdentifierTypo", Justification = SuppressReasons.MatchesOriginal)] | ||
[SuppressMessage("ReSharper", "InconsistentNaming", Justification = SuppressReasons.MatchesOriginal)] | ||
[SuppressMessage("ReSharper", "UnusedMember.Global", Justification = SuppressReasons.UsedViaRewriting)] | ||
public class BasicProjectileFacade : BasicProjectile, IRewriteFacade | ||
{ | ||
/********* | ||
** Public methods | ||
*********/ | ||
public static BasicProjectile Constructor(int damageToFarmer, int parentSheetIndex, int bouncesTillDestruct, int tailLength, float rotationVelocity, float xVelocity, float yVelocity, Vector2 startingPosition, string collisionSound, string firingSound, bool explode, bool damagesMonsters = false, GameLocation? location = null, Character? firer = null, bool spriteFromObjectSheet = false, onCollisionBehavior? collisionBehavior = null) | ||
{ | ||
var projectile = new BasicProjectile( | ||
damageToFarmer: damageToFarmer, | ||
spriteIndex: parentSheetIndex, | ||
bouncesTillDestruct: bouncesTillDestruct, | ||
tailLength: tailLength, | ||
rotationVelocity: rotationVelocity, | ||
xVelocity: xVelocity, | ||
yVelocity: yVelocity, | ||
startingPosition: startingPosition | ||
); | ||
|
||
projectile.explode.Value = explode; | ||
projectile.collisionSound.Value = collisionSound; | ||
projectile.damagesMonsters.Value = damagesMonsters; | ||
projectile.theOneWhoFiredMe.Set(location, firer); | ||
projectile.itemId.Value = spriteFromObjectSheet ? parentSheetIndex.ToString() : null; | ||
projectile.collisionBehavior = collisionBehavior; | ||
|
||
if (!string.IsNullOrWhiteSpace(firingSound) && location != null) | ||
location.playSound(firingSound); | ||
|
||
return projectile; | ||
} | ||
|
||
public static BasicProjectile Constructor(int damageToFarmer, int parentSheetIndex, int bouncesTillDestruct, int tailLength, float rotationVelocity, float xVelocity, float yVelocity, Vector2 startingPosition) | ||
{ | ||
return Constructor(damageToFarmer, parentSheetIndex, bouncesTillDestruct, tailLength, rotationVelocity, xVelocity, yVelocity, startingPosition, "flameSpellHit", "flameSpell", true); | ||
} | ||
|
||
|
||
/********* | ||
** Private methods | ||
*********/ | ||
private BasicProjectileFacade() | ||
{ | ||
RewriteHelper.ThrowFakeConstructorCalled(); | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BoatTunnelFacade.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using StardewModdingAPI.Framework.ModLoading.Framework; | ||
using StardewValley.Locations; | ||
|
||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member: This is internal code to support rewriters and shouldn't be called directly. | ||
|
||
namespace StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6 | ||
{ | ||
/// <summary>Maps Stardew Valley 1.5.6's <see cref="BoatTunnel"/> methods to their newer form to avoid breaking older mods.</summary> | ||
/// <remarks>This is public to support SMAPI rewriting and should never be referenced directly by mods. See remarks on <see cref="ReplaceReferencesRewriter"/> for more info.</remarks> | ||
[SuppressMessage("ReSharper", "UnusedMember.Global", Justification = SuppressReasons.UsedViaRewriting)] | ||
public class BoatTunnelFacade : BoatTunnel, IRewriteFacade | ||
{ | ||
/********* | ||
** Public methods | ||
*********/ | ||
public int GetTicketPrice() | ||
{ | ||
return base.TicketPrice; | ||
} | ||
|
||
|
||
/********* | ||
** Private methods | ||
*********/ | ||
private BoatTunnelFacade() | ||
{ | ||
RewriteHelper.ThrowFakeConstructorCalled(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BuffsDisplayFacade.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using StardewModdingAPI.Framework.ModLoading.Framework; | ||
using StardewValley; | ||
using StardewValley.Menus; | ||
|
||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member: This is internal code to support rewriters and shouldn't be called directly. | ||
|
||
namespace StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6 | ||
{ | ||
/// <summary>Maps Stardew Valley 1.5.6's <see cref="BuffsDisplayFacade"/> methods to their newer form to avoid breaking older mods.</summary> | ||
/// <remarks>This is public to support SMAPI rewriting and should never be referenced directly by mods. See remarks on <see cref="ReplaceReferencesRewriter"/> for more info.</remarks> | ||
[SuppressMessage("ReSharper", "InconsistentNaming", Justification = SuppressReasons.MatchesOriginal)] | ||
[SuppressMessage("ReSharper", "UnusedMember.Global", Justification = SuppressReasons.UsedViaRewriting)] | ||
public class BuffsDisplayFacade : BuffsDisplay, IRewriteFacade | ||
{ | ||
/********* | ||
** Public methods | ||
*********/ | ||
public bool hasBuff(int which) | ||
{ | ||
return Game1.player.hasBuff(which.ToString()); | ||
} | ||
|
||
|
||
/********* | ||
** Private methods | ||
*********/ | ||
private BuffsDisplayFacade() | ||
{ | ||
RewriteHelper.ThrowFakeConstructorCalled(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/DebuffingProjectileFacade.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using Microsoft.Xna.Framework; | ||
using StardewModdingAPI.Framework.ModLoading.Framework; | ||
using StardewValley; | ||
using StardewValley.Projectiles; | ||
|
||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member: This is internal code to support rewriters and shouldn't be called directly. | ||
|
||
namespace StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6 | ||
{ | ||
/// <summary>Maps Stardew Valley 1.5.6's <see cref="DebuffingProjectile"/> methods to their newer form to avoid breaking older mods.</summary> | ||
/// <remarks>This is public to support SMAPI rewriting and should never be referenced directly by mods. See remarks on <see cref="ReplaceReferencesRewriter"/> for more info.</remarks> | ||
[SuppressMessage("ReSharper", "IdentifierTypo", Justification = SuppressReasons.MatchesOriginal)] | ||
[SuppressMessage("ReSharper", "InconsistentNaming", Justification = SuppressReasons.MatchesOriginal)] | ||
[SuppressMessage("ReSharper", "UnusedMember.Global", Justification = SuppressReasons.UsedViaRewriting)] | ||
public class DebuffingProjectileFacade : DebuffingProjectile, IRewriteFacade | ||
{ | ||
/********* | ||
** Public methods | ||
*********/ | ||
public static DebuffingProjectile Constructor(int debuff, int parentSheetIndex, int bouncesTillDestruct, int tailLength, float rotationVelocity, float xVelocity, float yVelocity, Vector2 startingPosition, GameLocation? location = null, Character? owner = null) | ||
{ | ||
return new DebuffingProjectile( | ||
debuff: debuff.ToString(), | ||
spriteIndex: parentSheetIndex, | ||
bouncesTillDestruct: bouncesTillDestruct, | ||
tailLength: tailLength, | ||
rotationVelocity: rotationVelocity, | ||
xVelocity: xVelocity, | ||
yVelocity: yVelocity, | ||
startingPosition: startingPosition, | ||
location: location, | ||
owner: owner | ||
); | ||
} | ||
|
||
|
||
/********* | ||
** Private methods | ||
*********/ | ||
private DebuffingProjectileFacade() | ||
{ | ||
RewriteHelper.ThrowFakeConstructorCalled(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.