Skip to content

Commit

Permalink
rename stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
lemz1 committed May 31, 2024
1 parent e39cddf commit 9652623
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions source/funkin/InitState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import funkin.data.dialogue.speaker.SpeakerRegistry;
import funkin.data.freeplay.album.AlbumRegistry;
import funkin.data.song.SongRegistry;
import funkin.play.character.CharacterData.CharacterDataParser;
import funkin.play.notes.notekind.NoteKindScriptManager;
import funkin.play.notes.notekind.NoteKindManager;
import funkin.modding.module.ModuleHandler;
import funkin.ui.title.TitleState;
import funkin.util.CLIUtil;
Expand Down Expand Up @@ -175,7 +175,7 @@ class InitState extends FlxState
// Move it to use a BaseRegistry.
CharacterDataParser.loadCharacterCache();

NoteKindScriptManager.loadScripts();
NoteKindManager.loadScripts();

ModuleHandler.buildModuleCallbacks();
ModuleHandler.loadModuleCache();
Expand Down
4 changes: 2 additions & 2 deletions source/funkin/play/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import funkin.play.notes.NoteSprite;
import funkin.play.notes.notestyle.NoteStyle;
import funkin.play.notes.Strumline;
import funkin.play.notes.SustainTrail;
import funkin.play.notes.notekind.NoteKindScriptManager;
import funkin.play.notes.notekind.NoteKindManager;
import funkin.play.scoring.Scoring;
import funkin.play.song.Song;
import funkin.play.stage.Stage;
Expand Down Expand Up @@ -1174,7 +1174,7 @@ class PlayState extends MusicBeatSubState
if (Std.isOfType(event, NoteScriptEvent))
{
var noteEvent:NoteScriptEvent = cast(event, NoteScriptEvent);
NoteKindScriptManager.callEvent(noteEvent.note.noteData.kind, noteEvent);
NoteKindManager.callEvent(noteEvent.note.noteData.kind, noteEvent);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import funkin.modding.events.ScriptEvent;
/**
* Class for note scripts
*/
class NoteKindScript implements INoteScriptedClass
class NoteKind implements INoteScriptedClass
{
/**
* the name of the note kind
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ import funkin.modding.events.ScriptEventDispatcher;
import funkin.modding.events.ScriptEvent;
import funkin.ui.debug.charting.util.ChartEditorDropdowns;

class NoteKindScriptManager
class NoteKindManager
{
static var noteKindScripts:Map<String, NoteKindScript> = [];
static var noteKinds:Map<String, NoteKind> = [];

public static function loadScripts():Void
{
var scriptedClassName:Array<String> = ScriptedNoteKindScript.listScriptClasses();
var scriptedClassName:Array<String> = ScriptedNoteKind.listScriptClasses();
if (scriptedClassName.length > 0)
{
trace('Instantiating ${scriptedClassName.length} scripted note kind...');
for (scriptedClass in scriptedClassName)
{
try
{
var script:NoteKindScript = ScriptedNoteKindScript.init(scriptedClass, "unknown");
var script:NoteKind = ScriptedNoteKind.init(scriptedClass, "unknown");
trace(' Initialized scripted note kind: ${script.noteKind}');
noteKindScripts.set(script.noteKind, script);
noteKinds.set(script.noteKind, script);
ChartEditorDropdowns.NOTE_KINDS.set(script.noteKind, script.description);
}
catch (e)
Expand All @@ -34,13 +34,13 @@ class NoteKindScriptManager

public static function callEvent(noteKind:String, event:ScriptEvent):Void
{
var noteKindScript:NoteKindScript = noteKindScripts.get(noteKind);
var noteKind:NoteKind = noteKinds.get(noteKind);

if (noteKindScript == null)
if (noteKind == null)
{
return;
}

ScriptEventDispatcher.callEvent(noteKindScript, event);
ScriptEventDispatcher.callEvent(noteKind, event);
}
}
9 changes: 9 additions & 0 deletions source/funkin/play/notes/notekind/ScriptedNoteKind.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package funkin.play.notes.notekind;

/**
* A script that can be tied to a NoteKind.
* Create a scripted class that extends NoteKind,
* then call `super('noteKind')` in the constructor to use this.
*/
@:hscriptClass
class ScriptedNoteKind extends NoteKind implements polymod.hscript.HScriptedClass {}
9 changes: 0 additions & 9 deletions source/funkin/play/notes/notekind/ScriptedNoteKindScript.hx

This file was deleted.

0 comments on commit 9652623

Please sign in to comment.