Skip to content

Commit bf690c1

Browse files
committed
Moving around + Scripted Modules
1 parent e542048 commit bf690c1

File tree

5 files changed

+63
-1
lines changed

5 files changed

+63
-1
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
[tags]: / "expert,hscript,module"
2+
3+
# Scripted Modules
4+
5+
Most articles about scripting will cover basic functionality of overriding already existing methods. However, there is a need for completely custom functionality instead. This is where Modules step in.
6+
7+
8+
A module is a class which runs very similarly to global scripts in other game engines. They are basically mini-states that run parallel to the original state.
9+
10+
## Creating a Module
11+
12+
```haxe
13+
import funkin.modding.module.Module;
14+
15+
class KE_QOL extends Module
16+
{
17+
public function new()
18+
{
19+
// This registers a NAME for the module, which might be needed later!
20+
super("KE-QOL");
21+
}
22+
23+
public override function onScriptEvent(event:ScriptEvent)
24+
{
25+
// ...
26+
}
27+
28+
public override function onStateChangeBegin(event:StateChangeScriptEvent)
29+
{
30+
// ...
31+
}
32+
33+
public override function onNoteIncoming(event:NoteScriptEvent)
34+
{
35+
// ...
36+
}
37+
38+
public override function onSongStart(event:ScriptEvent)
39+
{
40+
// ...
41+
}
42+
43+
public override function onSongLoaded(event:SongLoadScriptEvent)
44+
{
45+
// ...
46+
}
47+
}
48+
```
49+
50+
Modules have all the events most scripts have, but the difference is. You also have access to state change events, every script event, losing/gaining focus, and sub-state changes.
51+
52+
53+
Modules also have a priority system for compatibility with other mods, in your construction method, `new()`, you can set the `priority` property (which defaults to `1000`). 1 is processed before anything else.
54+
55+
You can view a detailed list of script events and their callbacks in [here](../Advanced/6.ScriptEventCallbacks.md)
56+
57+
> Author: [Kade](https://github.com/Kade-github)

src/Generator.hx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,20 @@ class Generator {
4747
// sort categories on name for display
4848
sitemap.sort(function(a, b) return a.title > b.title ? 1 : -1);
4949

50-
// sort categories by introduction, intermediate, and advanced
50+
// sort categories by introduction, intermediate, advanced, and then expert
5151

5252
var introductionCategory = sitemap.filter(function(c) return c.title.toLowerCase() == "introduction")[0];
5353
sitemap.remove(introductionCategory);
5454
sitemap.unshift(introductionCategory);
55+
5556
var advancedCategory = sitemap.filter(function(c) return c.title.toLowerCase() == "advanced")[0];
5657
sitemap.remove(advancedCategory);
5758
sitemap.push(advancedCategory);
5859

60+
var expertCategory = sitemap.filter(function(c) return c.title.toLowerCase() == "expert")[0];
61+
sitemap.remove(expertCategory);
62+
sitemap.push(expertCategory);
63+
5964
// add overview page for each category
6065
addCategoryPages(sitemap);
6166

0 commit comments

Comments
 (0)