-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathCore.cs
More file actions
40 lines (34 loc) · 1.34 KB
/
Core.cs
File metadata and controls
40 lines (34 loc) · 1.34 KB
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
using CommonLib.Config;
using PlayerCorpse.Entities;
using PlayerCorpse.Items;
using Vintagestory.API.Common;
namespace PlayerCorpse
{
public class Core : ModSystem
{
public static Config Config { get; private set; } = null!;
public override void Start(ICoreAPI api)
{
var configs = api.ModLoader.GetModSystem<ConfigManager>();
Config = configs.GetConfig<Config>();
api.World.Config.SetBool($"{Mod.Info.ModID}:CorpseCompassEnabled", Config.CorpseCompassEnabled);
api.RegisterEntity("EntityPlayerCorpse", typeof(EntityPlayerCorpse));
api.RegisterItemClass("ItemCorpseCompass", typeof(ItemCorpseCompass));
}
public override void AssetsLoaded(ICoreAPI api)
{
if (Config.CreateWaypoint == Config.CreateWaypointMode.Auto)
{
Config.CreateWaypoint = Config.CreateWaypointMode.Always;
var hasDeathWaypointsMods = api.Assets.Get<string[]>($"{Mod.Info.ModID}:config/hasdeathwaypointsmods.json");
foreach (var modid in hasDeathWaypointsMods)
{
if (api.ModLoader.IsModEnabled(modid))
{
Config.CreateWaypoint = Config.CreateWaypointMode.None;
}
}
}
}
}
}