-
Notifications
You must be signed in to change notification settings - Fork 3
/
PoTMod.cs
59 lines (49 loc) · 1.61 KB
/
PoTMod.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using System.Diagnostics;
using ReLogic.Content.Sources;
using System.IO;
using PathOfTerraria.Common.Systems.Networking;
using PathOfTerraria.Core.Sources;
namespace PathOfTerraria;
/// <summary>
/// Path of Terraria <see cref="Mod"/> implementation.
/// </summary>
public sealed class PoTMod : Mod
{
/// <summary>
/// The internal name of the mod.
/// </summary>
public const string ModName = "PathOfTerraria";
/// <summary>
/// A static reference to the current instance of the mod.
/// </summary>
internal static PoTMod Instance => ModContent.GetInstance<PoTMod>();
/// <summary>
/// Determines if any cheat mod is active. This is used to load certain cheat items, such as the spawn triggers for boss domains.
/// </summary>
public static bool CheatModEnabled => ModLoader.HasMod("CheatSheet") || ModLoader.HasMod("HerosMod") || ModLoader.HasMod("DragonLens");
public override void Load()
{
base.Load();
NPCUtils.NPCUtils.TryLoadBestiaryHelper();
Debug.Assert(Name == ModName, "Internal mod name does not match expected contsant.");
}
public override void Unload()
{
NPCUtils.NPCUtils.UnloadBestiaryHelper();
}
public override void HandlePacket(BinaryReader reader, int whoAmI)
{
Networking.HandlePacket(reader);
}
public override IContentSource CreateDefaultContentSource()
{
// Use our own SmartContentSource which wraps IContentSource with additional
// behavior.
var source = new SmartContentSource(base.CreateDefaultContentSource());
{
// Redirects requests for ModName/Content/... to ModName/Assets/...
source.AddDirectoryRedirect("Content", "Assets");
}
return source;
}
}