summaryrefslogtreecommitdiff
path: root/src/SMAPI/Events/WarpedEventArgs.cs
blob: 92a8ea77563b38f90f9b605904577aeff5c1b367 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#nullable disable

using System;
using StardewValley;

namespace StardewModdingAPI.Events
{
    /// <summary>Event arguments for an <see cref="IPlayerEvents.Warped"/> event.</summary>
    public class WarpedEventArgs : EventArgs
    {
        /*********
        ** Accessors
        *********/
        /// <summary>The player who warped to a new location.</summary>
        public Farmer Player { get; }

        /// <summary>The player's previous location.</summary>
        public GameLocation OldLocation { get; }

        /// <summary>The player's current location.</summary>
        public GameLocation NewLocation { get; }

        /// <summary>Whether the affected player is the local one.</summary>
        public bool IsLocalPlayer => this.Player.IsLocalPlayer;


        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="player">The player who warped to a new location.</param>
        /// <param name="oldLocation">The player's previous location.</param>
        /// <param name="newLocation">The player's current location.</param>
        internal WarpedEventArgs(Farmer player, GameLocation oldLocation, GameLocation newLocation)
        {
            this.Player = player;
            this.NewLocation = newLocation;
            this.OldLocation = oldLocation;
        }
    }
}