summaryrefslogtreecommitdiff
path: root/src/SMAPI/Events
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2018-08-01 11:07:29 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2018-08-01 11:07:29 -0400
commit60b41195778af33fd609eab66d9ae3f1d1165e8f (patch)
tree7128b906d40e94c56c34ed6058f27bc31c31a08b /src/SMAPI/Events
parentb9bc1a6d17cafa0a97b46ffecda432cfc2f23b51 (diff)
parent52cf953f685c65b2b6814e375ec9a5ffa03c440a (diff)
downloadSMAPI-60b41195778af33fd609eab66d9ae3f1d1165e8f.tar.gz
SMAPI-60b41195778af33fd609eab66d9ae3f1d1165e8f.tar.bz2
SMAPI-60b41195778af33fd609eab66d9ae3f1d1165e8f.zip
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI/Events')
-rw-r--r--src/SMAPI/Events/ControlEvents.cs36
-rw-r--r--src/SMAPI/Events/EventArgsGameLocationsChanged.cs27
-rw-r--r--src/SMAPI/Events/EventArgsInput.cs125
-rw-r--r--src/SMAPI/Events/EventArgsIntChanged.cs3
-rw-r--r--src/SMAPI/Events/EventArgsInventoryChanged.cs12
-rw-r--r--src/SMAPI/Events/EventArgsLocationBuildingsChanged.cs39
-rw-r--r--src/SMAPI/Events/EventArgsLocationObjectsChanged.cs41
-rw-r--r--src/SMAPI/Events/EventArgsLocationsChanged.cs33
-rw-r--r--src/SMAPI/Events/EventArgsPlayerWarped.cs (renamed from src/SMAPI/Events/EventArgsCurrentLocationChanged.cs)13
-rw-r--r--src/SMAPI/Events/GameLoopLaunchedEventArgs.cs7
-rw-r--r--src/SMAPI/Events/GameLoopUpdatedEventArgs.cs36
-rw-r--r--src/SMAPI/Events/GameLoopUpdatingEventArgs.cs36
-rw-r--r--src/SMAPI/Events/IGameLoopEvents.cs17
-rw-r--r--src/SMAPI/Events/IInputEvents.cs20
-rw-r--r--src/SMAPI/Events/IModEvents.cs15
-rw-r--r--src/SMAPI/Events/IWorldEvents.cs29
-rw-r--r--src/SMAPI/Events/InputButtonPressedEventArgs.cs60
-rw-r--r--src/SMAPI/Events/InputButtonReleasedEventArgs.cs60
-rw-r--r--src/SMAPI/Events/InputCursorMovedEventArgs.cs30
-rw-r--r--src/SMAPI/Events/InputEvents.cs8
-rw-r--r--src/SMAPI/Events/InputMouseWheelScrolledEventArgs.cs38
-rw-r--r--src/SMAPI/Events/LocationEvents.cs24
-rw-r--r--src/SMAPI/Events/MultiplayerEvents.cs58
-rw-r--r--src/SMAPI/Events/PlayerEvents.cs10
-rw-r--r--src/SMAPI/Events/WorldBuildingListChangedEventArgs.cs39
-rw-r--r--src/SMAPI/Events/WorldDebrisListChangedEventArgs.cs38
-rw-r--r--src/SMAPI/Events/WorldLargeTerrainFeatureListChangedEventArgs.cs39
-rw-r--r--src/SMAPI/Events/WorldLocationListChangedEventArgs.cs33
-rw-r--r--src/SMAPI/Events/WorldNpcListChangedEventArgs.cs38
-rw-r--r--src/SMAPI/Events/WorldObjectListChangedEventArgs.cs40
-rw-r--r--src/SMAPI/Events/WorldTerrainFeatureListChangedEventArgs.cs40
31 files changed, 833 insertions, 211 deletions
diff --git a/src/SMAPI/Events/ControlEvents.cs b/src/SMAPI/Events/ControlEvents.cs
index 973bb245..a3994d1d 100644
--- a/src/SMAPI/Events/ControlEvents.cs
+++ b/src/SMAPI/Events/ControlEvents.cs
@@ -20,57 +20,57 @@ namespace StardewModdingAPI.Events
/// <summary>Raised when the <see cref="KeyboardState"/> changes. That happens when the player presses or releases a key.</summary>
public static event EventHandler<EventArgsKeyboardStateChanged> KeyboardChanged
{
- add => ControlEvents.EventManager.Control_KeyboardChanged.Add(value);
- remove => ControlEvents.EventManager.Control_KeyboardChanged.Remove(value);
+ add => ControlEvents.EventManager.Legacy_Control_KeyboardChanged.Add(value);
+ remove => ControlEvents.EventManager.Legacy_Control_KeyboardChanged.Remove(value);
}
- /// <summary>Raised when the player presses a keyboard key.</summary>
+ /// <summary>Raised after the player presses a keyboard key.</summary>
public static event EventHandler<EventArgsKeyPressed> KeyPressed
{
- add => ControlEvents.EventManager.Control_KeyPressed.Add(value);
- remove => ControlEvents.EventManager.Control_KeyPressed.Remove(value);
+ add => ControlEvents.EventManager.Legacy_Control_KeyPressed.Add(value);
+ remove => ControlEvents.EventManager.Legacy_Control_KeyPressed.Remove(value);
}
- /// <summary>Raised when the player releases a keyboard key.</summary>
+ /// <summary>Raised after the player releases a keyboard key.</summary>
public static event EventHandler<EventArgsKeyPressed> KeyReleased
{
- add => ControlEvents.EventManager.Control_KeyReleased.Add(value);
- remove => ControlEvents.EventManager.Control_KeyReleased.Remove(value);
+ add => ControlEvents.EventManager.Legacy_Control_KeyReleased.Add(value);
+ remove => ControlEvents.EventManager.Legacy_Control_KeyReleased.Remove(value);
}
/// <summary>Raised when the <see cref="MouseState"/> changes. That happens when the player moves the mouse, scrolls the mouse wheel, or presses/releases a button.</summary>
public static event EventHandler<EventArgsMouseStateChanged> MouseChanged
{
- add => ControlEvents.EventManager.Control_MouseChanged.Add(value);
- remove => ControlEvents.EventManager.Control_MouseChanged.Remove(value);
+ add => ControlEvents.EventManager.Legacy_Control_MouseChanged.Add(value);
+ remove => ControlEvents.EventManager.Legacy_Control_MouseChanged.Remove(value);
}
/// <summary>The player pressed a controller button. This event isn't raised for trigger buttons.</summary>
public static event EventHandler<EventArgsControllerButtonPressed> ControllerButtonPressed
{
- add => ControlEvents.EventManager.Control_ControllerButtonPressed.Add(value);
- remove => ControlEvents.EventManager.Control_ControllerButtonPressed.Remove(value);
+ add => ControlEvents.EventManager.Legacy_Control_ControllerButtonPressed.Add(value);
+ remove => ControlEvents.EventManager.Legacy_Control_ControllerButtonPressed.Remove(value);
}
/// <summary>The player released a controller button. This event isn't raised for trigger buttons.</summary>
public static event EventHandler<EventArgsControllerButtonReleased> ControllerButtonReleased
{
- add => ControlEvents.EventManager.Control_ControllerButtonReleased.Add(value);
- remove => ControlEvents.EventManager.Control_ControllerButtonReleased.Remove(value);
+ add => ControlEvents.EventManager.Legacy_Control_ControllerButtonReleased.Add(value);
+ remove => ControlEvents.EventManager.Legacy_Control_ControllerButtonReleased.Remove(value);
}
/// <summary>The player pressed a controller trigger button.</summary>
public static event EventHandler<EventArgsControllerTriggerPressed> ControllerTriggerPressed
{
- add => ControlEvents.EventManager.Control_ControllerTriggerPressed.Add(value);
- remove => ControlEvents.EventManager.Control_ControllerTriggerPressed.Remove(value);
+ add => ControlEvents.EventManager.Legacy_Control_ControllerTriggerPressed.Add(value);
+ remove => ControlEvents.EventManager.Legacy_Control_ControllerTriggerPressed.Remove(value);
}
/// <summary>The player released a controller trigger button.</summary>
public static event EventHandler<EventArgsControllerTriggerReleased> ControllerTriggerReleased
{
- add => ControlEvents.EventManager.Control_ControllerTriggerReleased.Add(value);
- remove => ControlEvents.EventManager.Control_ControllerTriggerReleased.Remove(value);
+ add => ControlEvents.EventManager.Legacy_Control_ControllerTriggerReleased.Add(value);
+ remove => ControlEvents.EventManager.Legacy_Control_ControllerTriggerReleased.Remove(value);
}
diff --git a/src/SMAPI/Events/EventArgsGameLocationsChanged.cs b/src/SMAPI/Events/EventArgsGameLocationsChanged.cs
deleted file mode 100644
index 78ba38fa..00000000
--- a/src/SMAPI/Events/EventArgsGameLocationsChanged.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using System;
-using System.Collections.Generic;
-using StardewValley;
-
-namespace StardewModdingAPI.Events
-{
- /// <summary>Event arguments for a <see cref="LocationEvents.LocationsChanged"/> event.</summary>
- public class EventArgsGameLocationsChanged : EventArgs
- {
- /*********
- ** Accessors
- *********/
- /// <summary>The current list of game locations.</summary>
- public IList<GameLocation> NewLocations { get; }
-
-
- /*********
- ** Public methods
- *********/
- /// <summary>Construct an instance.</summary>
- /// <param name="newLocations">The current list of game locations.</param>
- public EventArgsGameLocationsChanged(IList<GameLocation> newLocations)
- {
- this.NewLocations = newLocations;
- }
- }
-}
diff --git a/src/SMAPI/Events/EventArgsInput.cs b/src/SMAPI/Events/EventArgsInput.cs
index 75b9b8cd..0cafdba5 100644
--- a/src/SMAPI/Events/EventArgsInput.cs
+++ b/src/SMAPI/Events/EventArgsInput.cs
@@ -1,8 +1,5 @@
using System;
-using System.Linq;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Input;
-using StardewValley;
+using System.Collections.Generic;
namespace StardewModdingAPI.Events
{
@@ -10,6 +7,13 @@ namespace StardewModdingAPI.Events
public class EventArgsInput : EventArgs
{
/*********
+ ** Properties
+ *********/
+ /// <summary>The buttons to suppress.</summary>
+ private readonly HashSet<SButton> SuppressButtons;
+
+
+ /*********
** Accessors
*********/
/// <summary>The button on the controller, keyboard, or mouse.</summary>
@@ -18,20 +22,14 @@ namespace StardewModdingAPI.Events
/// <summary>The current cursor position.</summary>
public ICursorPosition Cursor { get; }
-#if !STARDEW_VALLEY_1_3
- /// <summary>Whether the input is considered a 'click' by the game for enabling action.</summary>
- [Obsolete("Use " + nameof(EventArgsInput.IsActionButton) + " or " + nameof(EventArgsInput.IsUseToolButton) + " instead")] // deprecated in SMAPI 2.1
- public bool IsClick => this.IsActionButton;
-#endif
-
/// <summary>Whether the input should trigger actions on the affected tile.</summary>
- public bool IsActionButton { get; }
+ public bool IsActionButton => this.Button.IsActionButton();
/// <summary>Whether the input should use tools on the affected tile.</summary>
- public bool IsUseToolButton { get; }
+ public bool IsUseToolButton => this.Button.IsUseToolButton();
/// <summary>Whether a mod has indicated the key was already handled.</summary>
- public bool IsSuppressed { get; private set; }
+ public bool IsSuppressed => this.SuppressButtons.Contains(this.Button);
/*********
@@ -40,17 +38,15 @@ namespace StardewModdingAPI.Events
/// <summary>Construct an instance.</summary>
/// <param name="button">The button on the controller, keyboard, or mouse.</param>
/// <param name="cursor">The cursor position.</param>
- /// <param name="isActionButton">Whether the input should trigger actions on the affected tile.</param>
- /// <param name="isUseToolButton">Whether the input should use tools on the affected tile.</param>
- public EventArgsInput(SButton button, ICursorPosition cursor, bool isActionButton, bool isUseToolButton)
+ /// <param name="suppressButtons">The buttons to suppress.</param>
+ public EventArgsInput(SButton button, ICursorPosition cursor, HashSet<SButton> suppressButtons)
{
this.Button = button;
this.Cursor = cursor;
- this.IsActionButton = isActionButton;
- this.IsUseToolButton = isUseToolButton;
+ this.SuppressButtons = suppressButtons;
}
- /// <summary>Prevent the game from handling the vurrent button press. This doesn't prevent other mods from receiving the event.</summary>
+ /// <summary>Prevent the game from handling the current button press. This doesn't prevent other mods from receiving the event.</summary>
public void SuppressButton()
{
this.SuppressButton(this.Button);
@@ -60,96 +56,7 @@ namespace StardewModdingAPI.Events
/// <param name="button">The button to suppress.</param>
public void SuppressButton(SButton button)
{
- if (button == this.Button)
- this.IsSuppressed = true;
-
- // keyboard
- if (button.TryGetKeyboard(out Keys key))
- Game1.oldKBState = new KeyboardState(Game1.oldKBState.GetPressedKeys().Union(new[] { key }).ToArray());
-
- // controller
- else if (button.TryGetController(out Buttons controllerButton))
- {
- var newState = GamePad.GetState(PlayerIndex.One);
- var thumbsticks = Game1.oldPadState.ThumbSticks;
- var triggers = Game1.oldPadState.Triggers;
- var buttons = Game1.oldPadState.Buttons;
- var dpad = Game1.oldPadState.DPad;
-
- switch (controllerButton)
- {
- // d-pad
- case Buttons.DPadDown:
- dpad = new GamePadDPad(dpad.Up, newState.DPad.Down, dpad.Left, dpad.Right);
- break;
- case Buttons.DPadLeft:
- dpad = new GamePadDPad(dpad.Up, dpad.Down, newState.DPad.Left, dpad.Right);
- break;
- case Buttons.DPadRight:
- dpad = new GamePadDPad(dpad.Up, dpad.Down, dpad.Left, newState.DPad.Right);
- break;
- case Buttons.DPadUp:
- dpad = new GamePadDPad(newState.DPad.Up, dpad.Down, dpad.Left, dpad.Right);
- break;
-
- // trigger
- case Buttons.LeftTrigger:
- triggers = new GamePadTriggers(newState.Triggers.Left, triggers.Right);
- break;
- case Buttons.RightTrigger:
- triggers = new GamePadTriggers(triggers.Left, newState.Triggers.Right);
- break;
-
- // thumbstick
- case Buttons.LeftThumbstickDown:
- case Buttons.LeftThumbstickLeft:
- case Buttons.LeftThumbstickRight:
- case Buttons.LeftThumbstickUp:
- thumbsticks = new GamePadThumbSticks(newState.ThumbSticks.Left, thumbsticks.Right);
- break;
- case Buttons.RightThumbstickDown:
- case Buttons.RightThumbstickLeft:
- case Buttons.RightThumbstickRight:
- case Buttons.RightThumbstickUp:
- thumbsticks = new GamePadThumbSticks(newState.ThumbSticks.Right, thumbsticks.Left);
- break;
-
- // buttons
- default:
- var mask =
- (buttons.A == ButtonState.Pressed ? Buttons.A : 0)
- | (buttons.B == ButtonState.Pressed ? Buttons.B : 0)
- | (buttons.Back == ButtonState.Pressed ? Buttons.Back : 0)
- | (buttons.BigButton == ButtonState.Pressed ? Buttons.BigButton : 0)
- | (buttons.LeftShoulder == ButtonState.Pressed ? Buttons.LeftShoulder : 0)
- | (buttons.LeftStick == ButtonState.Pressed ? Buttons.LeftStick : 0)
- | (buttons.RightShoulder == ButtonState.Pressed ? Buttons.RightShoulder : 0)
- | (buttons.RightStick == ButtonState.Pressed ? Buttons.RightStick : 0)
- | (buttons.Start == ButtonState.Pressed ? Buttons.Start : 0)
- | (buttons.X == ButtonState.Pressed ? Buttons.X : 0)
- | (buttons.Y == ButtonState.Pressed ? Buttons.Y : 0);
- mask = mask ^ controllerButton;
- buttons = new GamePadButtons(mask);
- break;
- }
-
- Game1.oldPadState = new GamePadState(thumbsticks, triggers, buttons, dpad);
- }
-
- // mouse
- else if (button == SButton.MouseLeft || button == SButton.MouseMiddle || button == SButton.MouseRight || button == SButton.MouseX1 || button == SButton.MouseX2)
- {
- Game1.oldMouseState = new MouseState(
- x: Game1.oldMouseState.X,
- y: Game1.oldMouseState.Y,
- scrollWheel: Game1.oldMouseState.ScrollWheelValue,
- leftButton: button == SButton.MouseLeft ? ButtonState.Pressed : Game1.oldMouseState.LeftButton,
- middleButton: button == SButton.MouseMiddle ? ButtonState.Pressed : Game1.oldMouseState.MiddleButton,
- rightButton: button == SButton.MouseRight ? ButtonState.Pressed : Game1.oldMouseState.RightButton,
- xButton1: button == SButton.MouseX1 ? ButtonState.Pressed : Game1.oldMouseState.XButton1,
- xButton2: button == SButton.MouseX2 ? ButtonState.Pressed : Game1.oldMouseState.XButton2
- );
- }
+ this.SuppressButtons.Add(button);
}
}
}
diff --git a/src/SMAPI/Events/EventArgsIntChanged.cs b/src/SMAPI/Events/EventArgsIntChanged.cs
index 0c742d12..a018695c 100644
--- a/src/SMAPI/Events/EventArgsIntChanged.cs
+++ b/src/SMAPI/Events/EventArgsIntChanged.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
namespace StardewModdingAPI.Events
{
@@ -14,6 +14,7 @@ namespace StardewModdingAPI.Events
/// <summary>The current value.</summary>
public int NewInt { get; }
+
/*********
** Public methods
*********/
diff --git a/src/SMAPI/Events/EventArgsInventoryChanged.cs b/src/SMAPI/Events/EventArgsInventoryChanged.cs
index b85ae9db..1fdca834 100644
--- a/src/SMAPI/Events/EventArgsInventoryChanged.cs
+++ b/src/SMAPI/Events/EventArgsInventoryChanged.cs
@@ -12,11 +12,7 @@ namespace StardewModdingAPI.Events
** Accessors
*********/
/// <summary>The player's inventory.</summary>
-#if STARDEW_VALLEY_1_3
public IList<Item> Inventory { get; }
-#else
- public List<Item> Inventory { get; }
-#endif
/// <summary>The added items.</summary>
public List<ItemStackChange> Added { get; }
@@ -34,13 +30,7 @@ namespace StardewModdingAPI.Events
/// <summary>Construct an instance.</summary>
/// <param name="inventory">The player's inventory.</param>
/// <param name="changedItems">The inventory changes.</param>
- public EventArgsInventoryChanged(
-#if STARDEW_VALLEY_1_3
- IList<Item> inventory,
-#else
- List<Item> inventory,
-#endif
- List<ItemStackChange> changedItems)
+ public EventArgsInventoryChanged(IList<Item> inventory, List<ItemStackChange> changedItems)
{
this.Inventory = inventory;
this.Added = changedItems.Where(n => n.ChangeType == ChangeType.Added).ToList();
diff --git a/src/SMAPI/Events/EventArgsLocationBuildingsChanged.cs b/src/SMAPI/Events/EventArgsLocationBuildingsChanged.cs
new file mode 100644
index 00000000..e8184ebe
--- /dev/null
+++ b/src/SMAPI/Events/EventArgsLocationBuildingsChanged.cs
@@ -0,0 +1,39 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using StardewValley;
+using StardewValley.Buildings;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for a <see cref="LocationEvents.BuildingsChanged"/> event.</summary>
+ public class EventArgsLocationBuildingsChanged : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The location which changed.</summary>
+ public GameLocation Location { get; }
+
+ /// <summary>The buildings added to the location.</summary>
+ public IEnumerable<Building> Added { get; }
+
+ /// <summary>The buildings removed from the location.</summary>
+ public IEnumerable<Building> Removed { get; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="location">The location which changed.</param>
+ /// <param name="added">The buildings added to the location.</param>
+ /// <param name="removed">The buildings removed from the location.</param>
+ public EventArgsLocationBuildingsChanged(GameLocation location, IEnumerable<Building> added, IEnumerable<Building> removed)
+ {
+ this.Location = location;
+ this.Added = added.ToArray();
+ this.Removed = removed.ToArray();
+ }
+ }
+}
diff --git a/src/SMAPI/Events/EventArgsLocationObjectsChanged.cs b/src/SMAPI/Events/EventArgsLocationObjectsChanged.cs
index 180e9d78..3bb387d5 100644
--- a/src/SMAPI/Events/EventArgsLocationObjectsChanged.cs
+++ b/src/SMAPI/Events/EventArgsLocationObjectsChanged.cs
@@ -1,43 +1,40 @@
using System;
-using Microsoft.Xna.Framework;
-#if STARDEW_VALLEY_1_3
using System.Collections.Generic;
-using Netcode;
-#else
+using System.Linq;
+using Microsoft.Xna.Framework;
using StardewValley;
-#endif
-using Object = StardewValley.Object;
+using SObject = StardewValley.Object;
namespace StardewModdingAPI.Events
{
- /// <summary>Event arguments for a <see cref="LocationEvents.LocationObjectsChanged"/> event.</summary>
+ /// <summary>Event arguments for a <see cref="LocationEvents.ObjectsChanged"/> event.</summary>
public class EventArgsLocationObjectsChanged : EventArgs
{
/*********
** Accessors
*********/
- /// <summary>The current list of objects in the current location.</summary>
-#if STARDEW_VALLEY_1_3
- public IDictionary<Vector2, NetRef<Object>> NewObjects { get; }
-#else
- public SerializableDictionary<Vector2, Object> NewObjects { get; }
-#endif
+ /// <summary>The location which changed.</summary>
+ public GameLocation Location { get; }
+
+ /// <summary>The objects added to the location.</summary>
+ public IEnumerable<KeyValuePair<Vector2, SObject>> Added { get; }
+
+ /// <summary>The objects removed from the location.</summary>
+ public IEnumerable<KeyValuePair<Vector2, SObject>> Removed { get; }
/*********
** Public methods
*********/
/// <summary>Construct an instance.</summary>
- /// <param name="newObjects">The current list of objects in the current location.</param>
- public EventArgsLocationObjectsChanged(
-#if STARDEW_VALLEY_1_3
- IDictionary<Vector2, NetRef<Object>> newObjects
-#else
- SerializableDictionary<Vector2, Object> newObjects
-#endif
- )
+ /// <param name="location">The location which changed.</param>
+ /// <param name="added">The objects added to the location.</param>
+ /// <param name="removed">The objects removed from the location.</param>
+ public EventArgsLocationObjectsChanged(GameLocation location, IEnumerable<KeyValuePair<Vector2, SObject>> added, IEnumerable<KeyValuePair<Vector2, SObject>> removed)
{
- this.NewObjects = newObjects;
+ this.Location = location;
+ this.Added = added.ToArray();
+ this.Removed = removed.ToArray();
}
}
}
diff --git a/src/SMAPI/Events/EventArgsLocationsChanged.cs b/src/SMAPI/Events/EventArgsLocationsChanged.cs
new file mode 100644
index 00000000..20984f45
--- /dev/null
+++ b/src/SMAPI/Events/EventArgsLocationsChanged.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using StardewValley;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for a <see cref="LocationEvents.LocationsChanged"/> event.</summary>
+ public class EventArgsLocationsChanged : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The added locations.</summary>
+ public IEnumerable<GameLocation> Added { get; }
+
+ /// <summary>The removed locations.</summary>
+ public IEnumerable<GameLocation> Removed { get; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="added">The added locations.</param>
+ /// <param name="removed">The removed locations.</param>
+ public EventArgsLocationsChanged(IEnumerable<GameLocation> added, IEnumerable<GameLocation> removed)
+ {
+ this.Added = added.ToArray();
+ this.Removed = removed.ToArray();
+ }
+ }
+}
diff --git a/src/SMAPI/Events/EventArgsCurrentLocationChanged.cs b/src/SMAPI/Events/EventArgsPlayerWarped.cs
index 25d3ebf3..93026aea 100644
--- a/src/SMAPI/Events/EventArgsCurrentLocationChanged.cs
+++ b/src/SMAPI/Events/EventArgsPlayerWarped.cs
@@ -1,19 +1,20 @@
-using System;
+using System;
using StardewValley;
namespace StardewModdingAPI.Events
{
- /// <summary>Event arguments for a <see cref="LocationEvents.CurrentLocationChanged"/> event.</summary>
- public class EventArgsCurrentLocationChanged : EventArgs
+ /// <summary>Event arguments for a <see cref="PlayerEvents.Warped"/> event.</summary>
+ public class EventArgsPlayerWarped : EventArgs
{
/*********
** Accessors
*********/
+ /// <summary>The player's previous location.</summary>
+ public GameLocation PriorLocation { get; }
+
/// <summary>The player's current location.</summary>
public GameLocation NewLocation { get; }
- /// <summary>The player's previous location.</summary>
- public GameLocation PriorLocation { get; }
/*********
@@ -22,7 +23,7 @@ namespace StardewModdingAPI.Events
/// <summary>Construct an instance.</summary>
/// <param name="priorLocation">The player's previous location.</param>
/// <param name="newLocation">The player's current location.</param>
- public EventArgsCurrentLocationChanged(GameLocation priorLocation, GameLocation newLocation)
+ public EventArgsPlayerWarped(GameLocation priorLocation, GameLocation newLocation)
{
this.NewLocation = newLocation;
this.PriorLocation = priorLocation;
diff --git a/src/SMAPI/Events/GameLoopLaunchedEventArgs.cs b/src/SMAPI/Events/GameLoopLaunchedEventArgs.cs
new file mode 100644
index 00000000..6a42e4f9
--- /dev/null
+++ b/src/SMAPI/Events/GameLoopLaunchedEventArgs.cs
@@ -0,0 +1,7 @@
+using System;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for an <see cref="IGameLoopEvents.Launched"/> event.</summary>
+ public class GameLoopLaunchedEventArgs : EventArgs { }
+}
diff --git a/src/SMAPI/Events/GameLoopUpdatedEventArgs.cs b/src/SMAPI/Events/GameLoopUpdatedEventArgs.cs
new file mode 100644
index 00000000..3ad34b69
--- /dev/null
+++ b/src/SMAPI/Events/GameLoopUpdatedEventArgs.cs
@@ -0,0 +1,36 @@
+using System;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for an <see cref="IGameLoopEvents.Updated"/> event.</summary>
+ public class GameLoopUpdatedEventArgs : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The number of ticks elapsed since the game started, including the current tick.</summary>
+ public uint Ticks { get; }
+
+ /// <summary>Whether <see cref="Ticks"/> is a multiple of 60, which happens approximately once per second.</summary>
+ public bool IsOneSecond { get; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="ticks">The number of ticks elapsed since the game started, including the current tick.</param>
+ public GameLoopUpdatedEventArgs(uint ticks)
+ {
+ this.Ticks = ticks;
+ this.IsOneSecond = this.IsMultipleOf(60);
+ }
+
+ /// <summary>Get whether <see cref="Ticks"/> is a multiple of the given <paramref name="number"/>. This is mainly useful if you want to run logic intermittently (e.g. <code>e.IsMultipleOf(30)</code> for every half-second).</summary>
+ /// <param name="number">The factor to check.</param>
+ public bool IsMultipleOf(uint number)
+ {
+ return this.Ticks % number == 0;
+ }
+ }
+}
diff --git a/src/SMAPI/Events/GameLoopUpdatingEventArgs.cs b/src/SMAPI/Events/GameLoopUpdatingEventArgs.cs
new file mode 100644
index 00000000..d6a8b5c2
--- /dev/null
+++ b/src/SMAPI/Events/GameLoopUpdatingEventArgs.cs
@@ -0,0 +1,36 @@
+using System;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for an <see cref="IGameLoopEvents.Updating"/> event.</summary>
+ public class GameLoopUpdatingEventArgs : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The number of ticks elapsed since the game started, including the current tick.</summary>
+ public uint Ticks { get; }
+
+ /// <summary>Whether <see cref="Ticks"/> is a multiple of 60, which happens approximately once per second.</summary>
+ public bool IsOneSecond { get; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="ticks">The number of ticks elapsed since the game started, including the current tick.</param>
+ public GameLoopUpdatingEventArgs(uint ticks)
+ {
+ this.Ticks = ticks;
+ this.IsOneSecond = this.IsMultipleOf(60);
+ }
+
+ /// <summary>Get whether <see cref="Ticks"/> is a multiple of the given <paramref name="number"/>. This is mainly useful if you want to run logic intermittently (e.g. <code>e.IsMultipleOf(30)</code> for every half-second).</summary>
+ /// <par