Skip to content

Commit d1ae20e

Browse files
committed
community category
1 parent 39059a8 commit d1ae20e

File tree

4 files changed

+162
-3
lines changed

4 files changed

+162
-3
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Community Articles
2+
3+
This series of articles dictates tutorials for **custom** content, meaning not supported by the game (or provided).
4+
5+
Though community members have created this content to make modding easier, so you can view it in this series.
6+
7+
> Author: [Kade](https://github.com/Kade-github)
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Menu Core
2+
<img width="640" height="360" alt="image" src="https://github.com/user-attachments/assets/52320c53-0084-4494-8376-c11ec65e7125" />
3+
4+
5+
A Friday Night Funkin' mod to enable a custom menu at the start of the game. This menu will allow the user to switch between different mods and their own custom menus, to allow for custom mod content to be enabled/disabled, or grouped together.
6+
7+
## Setting up
8+
9+
Download the latest version of MenuCore, [here](https://github.com/Kade-github/Menu-Core/releases/latest).
10+
11+
Then extract the folder into your `mods/` directory.
12+
13+
You are now ready to start using menu core
14+
15+
## Using Menu Core
16+
17+
Inside of your *mod* (not MenuCore), create a new Module:
18+
19+
```haxe
20+
package kade.hex;
21+
22+
import kade.hex.states.HexMainMenu;
23+
24+
import funkin.modding.module.Module;
25+
import funkin.modding.module.ModuleHandler;
26+
27+
import flixel.FlxState;
28+
29+
class HMenuCore extends Module {
30+
var addedVersion:Bool = false;
31+
32+
var modName = "VS Hex";
33+
var modDescription = "V.S Hex v3";
34+
var modAssetKey = "mc_hex";
35+
36+
var modState = null;
37+
38+
public function new() {
39+
// Priority is set to 3 here.
40+
super("HMenuCore", 3);
41+
}
42+
43+
public function addVersion()
44+
{
45+
var mcHandle = ModuleHandler.getModule("MC_Data");
46+
if (mcHandle == null) {
47+
trace("MenuCore: MC_Data not found!");
48+
return;
49+
}
50+
51+
if (mcHandle.versions.indexOf(modName) != -1) {
52+
// Already added
53+
return;
54+
}
55+
56+
modState = new HexMainMenu();
57+
58+
mcHandle.addVersion(modName, modAssetKey, modDescription, modState);
59+
}
60+
61+
public override function onStateChangeBegin(event:StateChangeScriptEvent):Void {
62+
super.onStateChangeBegin(event);
63+
64+
addVersion();
65+
}
66+
67+
public override function onCreate(event):Void {
68+
super.onCreate(event);
69+
70+
addVersion();
71+
}
72+
}
73+
```
74+
75+
You will create a module like so, name it whatever. Make sure it's `priority` is after **2**! After that, copy the three other non-constructor functions and change the top properties to what you'd like!
76+
77+
```haxe
78+
var modName = "VS Hex";
79+
var modDescription = "V.S Hex v3";
80+
var modAssetKey = "mc_hex";
81+
```
82+
83+
Then at the bottom (in the `addVersion` method) you'll see
84+
```haxe
85+
modState = new HexMainMenu();
86+
```
87+
88+
This will be what state will be created by MenuCore (and where the user will be sent too). To find out more about how to create states like this, please check out the [Scripted States](../Expert/03.ScriptedStates.md) article.
89+
90+
> Author: [Kade](https://github.com/Kade-github)
Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,65 @@
1-
[tags]: / "expert,hscript,module"
1+
[tags]: / "expert,hscript"
22

33
# Scripted States
44

5-
todo :P
5+
Creating scripted states is the most powerful thing in the modding framework, it basically lets you create entirely custom... *things*. Be it a menu, object, or entirely different game!
66

7-
> Author: [Kade](https://github.com/Kade-github)
7+
## Creating a custom menu
8+
9+
A typical custom MusicBeatState (Menu) might look like this:
10+
11+
```haxe
12+
package kade.menucore.states;
13+
14+
import flixel.FlxSprite;
15+
import flixel.text.FlxText;
16+
17+
import funkin.ui.MusicBeatState;
18+
import funkin.ui.FullScreenScaleMode;
19+
20+
class MenuSwitch extends MusicBeatState {
21+
22+
public function new():Void {
23+
super();
24+
}
25+
26+
public override function create():Void {
27+
super.create();
28+
29+
var bg = new FlxSprite();
30+
// ... bg code
31+
add(bg);
32+
33+
var chooseBlackBar = new FlxSprite(0, 0);
34+
// ... black bar code
35+
add(chooseBlackBar);
36+
37+
var choose = new FlxText(Math.max(FullScreenScaleMode.gameNotchSize.x, 6), 2, FlxG.width, "CHOOSE THE VERSION");
38+
// ... choose text code
39+
add(choose);
40+
41+
var topRightText = new FlxText(0, 15, FlxG.width / 2, "");
42+
// ... top right text code
43+
add(topRightText);
44+
45+
// Middle black bar of bg
46+
var blackBar = new FlxSprite(0, 0);
47+
// ... middle bar code
48+
add(blackBar);
49+
50+
// ...
51+
}
52+
53+
public override function update(elapsed:Float):Void {
54+
super.update(elapsed);
55+
}
56+
}
57+
```
58+
59+
Looking at this code, it looks scarily similar to the actual source code of the game - and that's the point. You're basically given the tools to create your own states, in which you control entirely. This allows for custom menus, and different games entirely.
60+
61+
The limit really, is your imagination.
62+
63+
For community examples of custom states/objects/helpers, check out [here](../Community/Community.md)
64+
65+
> Author: [Kade](https://github.com/Kade-github)

src/Generator.hx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ class Generator {
6161
sitemap.remove(expertCategory);
6262
sitemap.push(expertCategory);
6363

64+
var communityCategory = sitemap.filter(function(c) return c.title.toLowerCase() == "community")[0];
65+
sitemap.remove(communityCategory);
66+
sitemap.push(communityCategory);
67+
6468
// add overview page for each category
6569
addCategoryPages(sitemap);
6670

0 commit comments

Comments
 (0)