summaryrefslogtreecommitdiff
path: root/src/SMAPI
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2018-12-30 18:14:41 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2018-12-30 18:14:41 -0500
commit79c616600576acf16f70daad68cc60a22cbbbf74 (patch)
tree5a146e05975f1f4b40d2e1897d314f02b6d033c2 /src/SMAPI
parentf046091fe637963fd6a8cc8c1324daf81b64899f (diff)
parent72888fe2edf165580130fb37efdb562c8e3f78bb (diff)
downloadSMAPI-79c616600576acf16f70daad68cc60a22cbbbf74.tar.gz
SMAPI-79c616600576acf16f70daad68cc60a22cbbbf74.tar.bz2
SMAPI-79c616600576acf16f70daad68cc60a22cbbbf74.zip
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI')
-rw-r--r--src/SMAPI/Constants.cs2
-rw-r--r--src/SMAPI/Events/OneSecondUpdateTickedEventArgs.cs4
-rw-r--r--src/SMAPI/Events/OneSecondUpdateTickingEventArgs.cs6
-rw-r--r--src/SMAPI/Events/UnvalidatedUpdateTickedEventArgs.cs6
-rw-r--r--src/SMAPI/Events/UnvalidatedUpdateTickingEventArgs.cs8
-rw-r--r--src/SMAPI/Events/UpdateTickedEventArgs.cs6
-rw-r--r--src/SMAPI/Events/UpdateTickingEventArgs.cs8
-rw-r--r--src/SMAPI/Framework/SGame.cs24
8 files changed, 35 insertions, 29 deletions
diff --git a/src/SMAPI/Constants.cs b/src/SMAPI/Constants.cs
index 9ceaf11d..a0ba67ab 100644
--- a/src/SMAPI/Constants.cs
+++ b/src/SMAPI/Constants.cs
@@ -29,7 +29,7 @@ namespace StardewModdingAPI
** Public
****/
/// <summary>SMAPI's current semantic version.</summary>
- public static ISemanticVersion ApiVersion { get; } = new Toolkit.SemanticVersion("2.10.0");
+ public static ISemanticVersion ApiVersion { get; } = new Toolkit.SemanticVersion("2.10.1");
/// <summary>The minimum supported version of Stardew Valley.</summary>
public static ISemanticVersion MinimumGameVersion { get; } = new GameVersion("1.3.32");
diff --git a/src/SMAPI/Events/OneSecondUpdateTickedEventArgs.cs b/src/SMAPI/Events/OneSecondUpdateTickedEventArgs.cs
index dadbb71a..48e08e5e 100644
--- a/src/SMAPI/Events/OneSecondUpdateTickedEventArgs.cs
+++ b/src/SMAPI/Events/OneSecondUpdateTickedEventArgs.cs
@@ -1,5 +1,5 @@
using System;
-using StardewValley;
+using StardewModdingAPI.Framework;
namespace StardewModdingAPI.Events
{
@@ -10,7 +10,7 @@ namespace StardewModdingAPI.Events
** Accessors
*********/
/// <summary>The number of ticks elapsed since the game started, including the current tick.</summary>
- public uint Ticks => (uint)Game1.ticks;
+ public uint Ticks => SGame.TicksElapsed;
/*********
diff --git a/src/SMAPI/Events/OneSecondUpdateTickingEventArgs.cs b/src/SMAPI/Events/OneSecondUpdateTickingEventArgs.cs
index e9bb46c6..58cf802a 100644
--- a/src/SMAPI/Events/OneSecondUpdateTickingEventArgs.cs
+++ b/src/SMAPI/Events/OneSecondUpdateTickingEventArgs.cs
@@ -1,5 +1,5 @@
using System;
-using StardewValley;
+using StardewModdingAPI.Framework;
namespace StardewModdingAPI.Events
{
@@ -9,8 +9,8 @@ namespace StardewModdingAPI.Events
/*********
** Accessors
*********/
- /// <summary>The number of ticks elapsed since the game started, including the current tick.</summary>
- public uint Ticks => (uint)Game1.ticks;
+ /// <summary>The number of ticks elapsed since the game started, excluding the upcoming tick.</summary>
+ public uint Ticks => SGame.TicksElapsed;
/*********
diff --git a/src/SMAPI/Events/UnvalidatedUpdateTickedEventArgs.cs b/src/SMAPI/Events/UnvalidatedUpdateTickedEventArgs.cs
index d15e9531..13c367a0 100644
--- a/src/SMAPI/Events/UnvalidatedUpdateTickedEventArgs.cs
+++ b/src/SMAPI/Events/UnvalidatedUpdateTickedEventArgs.cs
@@ -1,5 +1,5 @@
using System;
-using StardewValley;
+using StardewModdingAPI.Framework;
namespace StardewModdingAPI.Events
{
@@ -10,10 +10,10 @@ namespace StardewModdingAPI.Events
** Accessors
*********/
/// <summary>The number of ticks elapsed since the game started, including the current tick.</summary>
- public uint Ticks => (uint)Game1.ticks;
+ public uint Ticks => SGame.TicksElapsed;
/// <summary>Whether <see cref="Ticks"/> is a multiple of 60, which happens approximately once per second.</summary>
- public bool IsOneSecond => Game1.ticks % 60 == 0;
+ public bool IsOneSecond => this.Ticks % 60 == 0;
/*********
diff --git a/src/SMAPI/Events/UnvalidatedUpdateTickingEventArgs.cs b/src/SMAPI/Events/UnvalidatedUpdateTickingEventArgs.cs
index 577f0776..c2e60f25 100644
--- a/src/SMAPI/Events/UnvalidatedUpdateTickingEventArgs.cs
+++ b/src/SMAPI/Events/UnvalidatedUpdateTickingEventArgs.cs
@@ -1,5 +1,5 @@
using System;
-using StardewValley;
+using StardewModdingAPI.Framework;
namespace StardewModdingAPI.Events
{
@@ -9,11 +9,11 @@ namespace StardewModdingAPI.Events
/*********
** Accessors
*********/
- /// <summary>The number of ticks elapsed since the game started, including the current tick.</summary>
- public uint Ticks => (uint)Game1.ticks;
+ /// <summary>The number of ticks elapsed since the game started, excluding the upcoming tick.</summary>
+ public uint Ticks => SGame.TicksElapsed;
/// <summary>Whether <see cref="Ticks"/> is a multiple of 60, which happens approximately once per second.</summary>
- public bool IsOneSecond => Game1.ticks % 60 == 0;
+ public bool IsOneSecond => this.Ticks % 60 == 0;
/*********
diff --git a/src/SMAPI/Events/UpdateTickedEventArgs.cs b/src/SMAPI/Events/UpdateTickedEventArgs.cs
index aa710b44..4f3329ac 100644
--- a/src/SMAPI/Events/UpdateTickedEventArgs.cs
+++ b/src/SMAPI/Events/UpdateTickedEventArgs.cs
@@ -1,5 +1,5 @@
using System;
-using StardewValley;
+using StardewModdingAPI.Framework;
namespace StardewModdingAPI.Events
{
@@ -10,10 +10,10 @@ namespace StardewModdingAPI.Events
** Accessors
*********/
/// <summary>The number of ticks elapsed since the game started, including the current tick.</summary>
- public uint Ticks => (uint)Game1.ticks;
+ public uint Ticks => SGame.TicksElapsed;
/// <summary>Whether <see cref="Ticks"/> is a multiple of 60, which happens approximately once per second.</summary>
- public bool IsOneSecond => Game1.ticks % 60 == 0;
+ public bool IsOneSecond => this.Ticks % 60 == 0;
/*********
diff --git a/src/SMAPI/Events/UpdateTickingEventArgs.cs b/src/SMAPI/Events/UpdateTickingEventArgs.cs
index cacf5a54..0d3187cd 100644
--- a/src/SMAPI/Events/UpdateTickingEventArgs.cs
+++ b/src/SMAPI/Events/UpdateTickingEventArgs.cs
@@ -1,5 +1,5 @@
using System;
-using StardewValley;
+using StardewModdingAPI.Framework;
namespace StardewModdingAPI.Events
{
@@ -9,11 +9,11 @@ namespace StardewModdingAPI.Events
/*********
** Accessors
*********/
- /// <summary>The number of ticks elapsed since the game started, including the current tick.</summary>
- public uint Ticks => (uint)Game1.ticks;
+ /// <summary>The number of ticks elapsed since the game started, excluding the upcoming tick.</summary>
+ public uint Ticks => SGame.TicksElapsed;
/// <summary>Whether <see cref="Ticks"/> is a multiple of 60, which happens approximately once per second.</summary>
- public bool IsOneSecond => Game1.ticks % 60 == 0;
+ public bool IsOneSecond => this.Ticks % 60 == 0;
/*********
diff --git a/src/SMAPI/Framework/SGame.cs b/src/SMAPI/Framework/SGame.cs
index e2835a70..25ffcabd 100644
--- a/src/SMAPI/Framework/SGame.cs
+++ b/src/SMAPI/Framework/SGame.cs
@@ -109,6 +109,9 @@ namespace StardewModdingAPI.Framework
/// <summary>Static state to use while <see cref="Game1"/> is initialising, which happens before the <see cref="SGame"/> constructor runs.</summary>
internal static SGameConstructorHack ConstructorHack { get; set; }
+ /// <summary>The number of update ticks which have already executed. This is similar to <see cref="Game1.ticks"/>, but incremented more consistently for every tick.</summary>
+ internal static uint TicksElapsed { get; private set; }
+
/// <summary>SMAPI's content manager.</summary>
public ContentCoordinator ContentCore { get; private set; }
@@ -339,6 +342,7 @@ namespace StardewModdingAPI.Framework
if (Game1._newDayTask != null || Game1.gameMode == Game1.loadingMode)
{
events.UnvalidatedUpdateTicking.RaiseEmpty();
+ SGame.TicksElapsed++;
base.Update(gameTime);
events.UnvalidatedUpdateTicked.RaiseEmpty();
#if !SMAPI_3_0_STRICT
@@ -431,6 +435,7 @@ namespace StardewModdingAPI.Framework
// suppress non-save events
events.UnvalidatedUpdateTicking.RaiseEmpty();
+ SGame.TicksElapsed++;
base.Update(gameTime);
events.UnvalidatedUpdateTicked.RaiseEmpty();
#if !SMAPI_3_0_STRICT
@@ -874,7 +879,7 @@ namespace StardewModdingAPI.Framework
** Game update
*********/
// game launched
- bool isFirstTick = Game1.ticks == 0;
+ bool isFirstTick = SGame.TicksElapsed == 0;
if (isFirstTick)
events.GameLaunched.Raise(new GameLaunchedEventArgs());
@@ -883,7 +888,7 @@ namespace StardewModdingAPI.Framework
this.OnLoadStageChanged(LoadStage.Loaded);
// update tick
- bool isOneSecond = Game1.ticks % 60 == 0;
+ bool isOneSecond = SGame.TicksElapsed % 60 == 0;
events.UnvalidatedUpdateTicking.RaiseEmpty();
events.UpdateTicking.RaiseEmpty();
if (isOneSecond)
@@ -891,6 +896,7 @@ namespace StardewModdingAPI.Framework
try
{
this.Input.UpdateSuppression();
+ SGame.TicksElapsed++;
base.Update(gameTime);
}
catch (Exception ex)
@@ -910,17 +916,17 @@ namespace StardewModdingAPI.Framework
if (isFirstTick)
events.Legacy_FirstUpdateTick.Raise();
events.Legacy_UpdateTick.Raise();
- if (Game1.ticks % 2 == 0)
+ if (SGame.TicksElapsed % 2 == 0)
events.Legacy_SecondUpdateTick.Raise();
- if (Game1.ticks % 4 == 0)
+ if (SGame.TicksElapsed % 4 == 0)
events.Legacy_FourthUpdateTick.Raise();
- if (Game1.ticks % 8 == 0)
+ if (SGame.TicksElapsed % 8 == 0)
events.Legacy_EighthUpdateTick.Raise();
- if (Game1.ticks % 15 == 0)
+ if (SGame.TicksElapsed % 15 == 0)
events.Legacy_QuarterSecondTick.Raise();
- if (Game1.ticks % 30 == 0)
+ if (SGame.TicksElapsed % 30 == 0)
events.Legacy_HalfSecondTick.Raise();
- if (Game1.ticks % 60 == 0)
+ if (SGame.TicksElapsed % 60 == 0)
events.Legacy_OneSecondTick.Raise();
#endif
@@ -1384,7 +1390,7 @@ namespace StardewModdingAPI.Framework
}
Game1.drawPlayerHeldObject(Game1.player);
}
- label_129:
+ label_129:
if ((Game1.player.UsingTool || Game1.pickingTool) && Game1.player.CurrentTool != null && ((!Game1.player.CurrentTool.Name.Equals("Seeds") || Game1.pickingTool) && (Game1.currentLocation.Map.GetLayer("Front").PickTile(new Location(Game1.player.getStandingX(), (int)Game1.player.Position.Y - 38), Game1.viewport.Size) != null && Game1.currentLocation.Map.GetLayer("Front").PickTile(new Location(Game1.player.getStandingX(), Game1.player.getStandingY()), Game1.viewport.Size) == null)))
Game1.drawTool(Game1.player);
if (Game1.currentLocation.Map.GetLayer("AlwaysFront") != null)