You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Readme.md
+20-7Lines changed: 20 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -76,7 +76,7 @@ Note: ModHelper can not be used in Awake, it's not initialized at that time.
76
76
77
77
### Events
78
78
79
-
Start in your ModBehaviour will be called when the game starts (at the title menu), which is usually too early for what you want to do. The mod helper contains events we can use to know when certain behaviours start. Here we add an event for when Flashlight has loaded, which is after the player has "woken up":
79
+
Start in your ModBehaviour will be called when the game starts (at the title menu), which is usually too early for what you want to do. The mod helper contains events we can use to know when certain things happen. Here we add an event for when Flashlight has started, which is after the player has "woken up":
Your mod can contain more MonoBehaviors which can be added dynamically:
101
103
~~~~
102
104
AddComponent<SomeBehaviour>();
103
105
~~~~
104
106
105
-
Listen for inputs:
107
+
#### Listen for inputs
106
108
~~~~
107
109
private void Update()
108
110
{
@@ -113,19 +115,30 @@ private void Update()
113
115
}
114
116
~~~~
115
117
116
-
Decompile the game with [dnSpy](https://github.com/0xd4d/dnSpy). Open {gamePath}\OuterWilds_Data\Managed\Assembly-CSharp.dll in dnSpy to learn how the game works and find what you want to change.
118
+
#### Decompile the game
119
+
120
+
Use [dnSpy](https://github.com/0xd4d/dnSpy) to browse the game code and learn how the game ticks. Open {gamePath}\OuterWilds_Data\Managed\Assembly-CSharp.dll in dnSpy.
121
+
122
+
#### Reflection
117
123
118
124
Change private variables with [reflection](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/reflection). Example:
Modify existing game methods with [Harmony](https://github.com/pardeike/Harmony). The mod helper contains a wrapper for Harmony, making some of the functionality easy to use. See the source code of HarmonyHelper and ModEvents. As an example, here we remove the contents of DebugInputManagers Awake method which makes sure the debug mode isn't disabled:
129
+
OWML.Events.dll contains extension methods for easy reflection. Get and set private variables like this:
If you develop new functionality using Harmony, please consider working with me to expand the mod helper classes, to aid other modders as well.
136
+
#### Patch game methods
137
+
138
+
Modify existing game methods with [Harmony](https://github.com/pardeike/Harmony). The mod helper contains a wrapper for Harmony, making some of the functionality easy to use. See the source code of HarmonyHelper and ModEvents. Here we remove the contents of DebugInputManagers Awake method which makes sure the debug mode isn't disabled:
0 commit comments