forked from Mekadrom/IFramesInMines
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIFramesInMines.cs
31 lines (27 loc) · 959 Bytes
/
IFramesInMines.cs
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
using StardewModdingAPI;
using StardewModdingAPI.Events;
namespace IFramesInMines
{
internal sealed class IFramesInMinesMod : Mod
{
private ModConfig Config;
public override void Entry(IModHelper helper)
{
this.Config = this.Helper.ReadConfig<ModConfig>();
int InvincibilityDuration = this.Config.InvincibilityDuration;
helper.Events.Player.Warped += this.OnWarped;
}
private void OnWarped(object sender, WarpedEventArgs e)
{
if (e.NewLocation != e.OldLocation && e.NewLocation.NameOrUniqueName.ToLower().StartsWith("undergroundmine"))
{
e.Player.currentTemporaryInvincibilityDuration = Config.InvincibilityDuration;
e.Player.temporarilyInvincible = true;
}
}
}
public sealed class ModConfig
{
public int InvincibilityDuration { get; set; } = 1500;
}
}