Fixed an issue where dialogue scripts were not being reloaded

This commit is contained in:
EliteMasterEric 2023-07-13 20:26:56 -04:00
parent 00cfeeff72
commit ba53957191
5 changed files with 47 additions and 21 deletions

View file

@ -14,6 +14,16 @@ import funkin.util.macro.MacroUtil;
import funkin.util.WindowUtil;
import funkin.play.PlayStatePlaylist;
import openfl.display.BitmapData;
import funkin.data.level.LevelRegistry;
import funkin.data.notestyle.NoteStyleRegistry;
import funkin.play.event.SongEventData.SongEventParser;
import funkin.play.cutscene.dialogue.ConversationDataParser;
import funkin.play.cutscene.dialogue.DialogueBoxDataParser;
import funkin.play.cutscene.dialogue.SpeakerDataParser;
import funkin.play.song.SongData.SongDataParser;
import funkin.play.stage.StageData.StageDataParser;
import funkin.play.character.CharacterData.CharacterDataParser;
import funkin.modding.module.ModuleHandler;
#if discord_rpc
import Discord.DiscordClient;
#end
@ -180,18 +190,22 @@ class InitState extends FlxTransitionableState
//
// GAME DATA PARSING
//
funkin.data.level.LevelRegistry.instance.loadEntries();
funkin.play.event.SongEventData.SongEventParser.loadEventCache();
funkin.play.cutscene.dialogue.ConversationDataParser.loadConversationCache();
funkin.play.cutscene.dialogue.DialogueBoxDataParser.loadDialogueBoxCache();
funkin.play.cutscene.dialogue.SpeakerDataParser.loadSpeakerCache();
funkin.play.song.SongData.SongDataParser.loadSongCache();
funkin.play.stage.StageData.StageDataParser.loadStageCache();
funkin.play.character.CharacterData.CharacterDataParser.loadCharacterCache();
funkin.modding.module.ModuleHandler.buildModuleCallbacks();
funkin.modding.module.ModuleHandler.loadModuleCache();
funkin.modding.module.ModuleHandler.callOnCreate();
// NOTE: Registries and data parsers must be imported and not referenced with fully qualified names,
// to ensure build macros work properly.
LevelRegistry.instance.loadEntries();
NoteStyleRegistry.instance.loadEntries();
SongEventParser.loadEventCache();
ConversationDataParser.loadConversationCache();
DialogueBoxDataParser.loadDialogueBoxCache();
SpeakerDataParser.loadSpeakerCache();
SongDataParser.loadSongCache();
StageDataParser.loadStageCache();
CharacterDataParser.loadCharacterCache();
ModuleHandler.buildModuleCallbacks();
ModuleHandler.loadModuleCache();
ModuleHandler.callOnCreate();
}
/**

View file

@ -10,6 +10,11 @@ import polymod.backends.PolymodAssets.PolymodAssetType;
import polymod.format.ParseRules.TextFileFormat;
import funkin.play.event.SongEventData.SongEventParser;
import funkin.util.FileUtil;
import funkin.data.level.LevelRegistry;
import funkin.data.notestyle.NoteStyleRegistry;
import funkin.play.cutscene.dialogue.ConversationDataParser;
import funkin.play.cutscene.dialogue.DialogueBoxDataParser;
import funkin.play.cutscene.dialogue.SpeakerDataParser;
class PolymodHandler
{
@ -279,12 +284,14 @@ class PolymodHandler
// TODO: Reload event callbacks
funkin.data.level.LevelRegistry.instance.loadEntries();
// These MUST be imported at the top of the file and not referred to by fully qualified name,
// to ensure build macros work properly.
LevelRegistry.instance.loadEntries();
NoteStyleRegistry.instance.loadEntries();
SongEventParser.loadEventCache();
// TODO: Uncomment this once conversation data is implemented.
// ConversationDataParser.loadConversationCache();
// DialogueBoxDataParser.loadDialogueBoxCache();
// SpeakerDataParser.loadSpeakerCache();
ConversationDataParser.loadConversationCache();
DialogueBoxDataParser.loadDialogueBoxCache();
SpeakerDataParser.loadSpeakerCache();
SongDataParser.loadSongCache();
StageDataParser.loadStageCache();
CharacterDataParser.loadCharacterCache();

View file

@ -21,7 +21,7 @@ class DialogueBoxDataParser
/**
* Parses and preloads the game's dialogueBox data and scripts when the game starts.
*
*
* If you want to force dialogue boxes to be reloaded, you can just call this function again.
*/
public static function loadDialogueBoxCache():Void
@ -123,7 +123,7 @@ class DialogueBoxDataParser
/**
* Load a dialogueBox's JSON file, parse its data, and return it.
*
*
* @param dialogueBoxId The dialogueBox to load.
* @return The dialogueBox data, or null if validation failed.
*/

View file

@ -1,4 +1,9 @@
package funkin.play.cutscene.dialogue;
/**
* A script that can be tied to a Speaker.
* Create a scripted class that extends Speaker to use this.
* This allows you to customize how a specific conversation speaker appears.
*/
@:hscriptClass
class ScriptedSpeaker extends Speaker implements polymod.hscript.HScriptedClass {}
class ScriptedSpeaker extends funkin.play.cutscene.dialogue.Speaker implements polymod.hscript.HScriptedClass {}

View file

@ -21,7 +21,7 @@ class SpeakerDataParser
/**
* Parses and preloads the game's speaker data and scripts when the game starts.
*
*
* If you want to force speakers to be reloaded, you can just call this function again.
*/
public static function loadSpeakerCache():Void
@ -123,7 +123,7 @@ class SpeakerDataParser
/**
* Load a speaker's JSON file, parse its data, and return it.
*
*
* @param speakerId The speaker to load.
* @return The speaker data, or null if validation failed.
*/