Skip to content

Commit 5bf1c09

Browse files
committed
ModuleScript: Added OnAwake
1 parent d464206 commit 5bf1c09

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

Documentation/KeepCoding_ModuleScript.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Implements [IDump](KeepCoding_IDump.md 'KeepCoding.IDump'), [ILog](KeepCoding_IL
4444
| [Log&lt;T&gt;(T, object[])](KeepCoding_ModuleScript_Log_T_(T_object__).md 'KeepCoding.ModuleScript.Log&lt;T&gt;(T, object[])') | Logs multiple entries, but formats it to be compliant with the Logfile Analyzer.<br/> |
4545
| [LogMultiple(string[])](KeepCoding_ModuleScript_LogMultiple(string__).md 'KeepCoding.ModuleScript.LogMultiple(string[])') | Logs multiple entries to the console.<br/> |
4646
| [OnActivate()](KeepCoding_ModuleScript_OnActivate().md 'KeepCoding.ModuleScript.OnActivate()') | Called when the lights turn on.<br/> |
47+
| [OnAwake()](KeepCoding_ModuleScript_OnAwake().md 'KeepCoding.ModuleScript.OnAwake()') | Called when the module instantiates, well before the lights turn on.<br/> |
4748
| [OnColorblindChanged(bool)](KeepCoding_ModuleScript_OnColorblindChanged(bool).md 'KeepCoding.ModuleScript.OnColorblindChanged(bool)') | Called when colorblind support needs to be updated for the module. Do not call `base.OnColorblindChanged()`.<br/> |
4849
| [OnModuleStrike(string)](KeepCoding_ModuleScript_OnModuleStrike(string).md 'KeepCoding.ModuleScript.OnModuleStrike(string)') | Called when any module on the current bomb has issued a strike.<br/> |
4950
| [OnNeedySolved(string)](KeepCoding_ModuleScript_OnNeedySolved(string).md 'KeepCoding.ModuleScript.OnNeedySolved(string)') | Called when any [KMNeedyModule](https://docs.microsoft.com/en-us/dotnet/api/KMNeedyModule 'KMNeedyModule') on the current bomb has been solved.<br/> |
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#### [KeepCoding](index.md 'index')
2+
### [KeepCoding](KeepCoding.md 'KeepCoding').[ModuleScript](KeepCoding_ModuleScript.md 'KeepCoding.ModuleScript')
3+
## ModuleScript.OnAwake() Method
4+
Called when the module instantiates, well before the lights turn on.
5+
```csharp
6+
public virtual void OnAwake();
7+
```

Source/MonoBehaviours/ModuleScript.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,11 @@ public void Strike(params string[] logs)
237237
Module.Strike();
238238
}
239239

240+
/// <summary>
241+
/// Called when the module instantiates, well before the lights turn on.
242+
/// </summary>
243+
public virtual void OnAwake() { }
244+
240245
/// <summary>
241246
/// Called when the lights turn on.
242247
/// </summary>
@@ -409,6 +414,8 @@ protected void Awake()
409414

410415
StartCoroutine(CheckForUpdates());
411416
StartCoroutine(WaitForBomb());
417+
418+
OnAwake();
412419
}
413420

414421
private void HookModules()

0 commit comments

Comments
 (0)