-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModMuseum.cs
More file actions
60 lines (49 loc) · 2 KB
/
Copy pathModMuseum.cs
File metadata and controls
60 lines (49 loc) · 2 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using HarmonyLib;
using OWML.Common;
using OWML.ModHelper;
using System.Reflection;
namespace ModMuseum
{
public class ModMuseum : ModBehaviour
{
public static ModMuseum Instance;
public INewHorizons NewHorizons;
// custom variables
private bool hasWokeUp;
public void Awake()
{
Instance = this;
// You won't be able to access OWML's mod helper in Awake.
// So you probably don't want to do anything here.
// Use Start() instead.
}
public void Start()
{
// Starting here, you'll have access to OWML's mod helper.
ModHelper.Console.WriteLine($"My mod {nameof(ModMuseum)} is loaded!", MessageType.Success);
// Get the New Horizons API and load configs
NewHorizons = ModHelper.Interaction.TryGetModApi<INewHorizons>("xen.NewHorizons");
NewHorizons.LoadConfigs(this);
new Harmony("Samster68OW.ModMuseum").PatchAll(Assembly.GetExecutingAssembly());
// Example of accessing game code.
OnCompleteSceneLoad(OWScene.TitleScreen, OWScene.TitleScreen); // We start on title screen
LoadManager.OnCompleteSceneLoad += OnCompleteSceneLoad;
}
// funny death when player talks to scientist
public void Update()
{
if (DialogueConditionManager.SharedInstance.GetConditionState("THETRUTH_REVEALED") && !hasWokeUp)
{
Locator.GetDeathManager().KillPlayer(DeathType.Energy); // kills player
hasWokeUp = true; // sets bool to true so it doesn't run again
}
}
public void OnCompleteSceneLoad(OWScene previousScene, OWScene newScene)
{
if (newScene != OWScene.SolarSystem) return;
ModHelper.Console.WriteLine("Loaded into solar system!", MessageType.Success);
// sets this to false at the start of the loop
hasWokeUp = false;
}
}
}