Stardew_Valley_Mods/GeneralMods/AutoSpeed/AutoSpeed.cs

43 lines
1.3 KiB
C#
Raw Normal View History

using Omegasis.AutoSpeed.Framework;
2017-07-28 08:28:39 +08:00
using StardewModdingAPI;
using StardewModdingAPI.Events;
using StardewValley;
2017-07-28 08:28:39 +08:00
namespace Omegasis.AutoSpeed
{
/// <summary>The mod entry point.</summary>
public class AutoSpeed : Mod
{
/*********
** Properties
*********/
/// <summary>The mod configuration.</summary>
private ModConfig Config;
/*********
** Public methods
*********/
/// <summary>The mod entry point, called after the mod is first loaded.</summary>
/// <param name="helper">Provides simplified APIs for writing mods.</param>
public override void Entry(IModHelper helper)
{
2019-01-06 15:21:06 +08:00
helper.Events.GameLoop.UpdateTicked += this.OnUpdateTicked;
this.Config = helper.ReadConfig<ModConfig>();
}
/*********
** Private methods
*********/
2019-01-06 15:21:06 +08:00
/// <summary>Raised after the game state is updated (≈60 times per second).</summary>
/// <param name="sender">The event sender.</param>
2019-01-06 15:21:06 +08:00
/// <param name="e">The event arguments.</param>
private void OnUpdateTicked(object sender, UpdateTickedEventArgs e)
{
if (Context.IsPlayerFree)
Game1.player.addedSpeed = this.Config.Speed;
}
}
}