1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-07-15 06:35:33 +00:00

Merge pull request #84 from FunkinCrew/bugfix/songeventscriptevent

Fixed an issue where SongEventScriptEvent would not be dispatched
This commit is contained in:
Cameron Taylor 2023-04-20 16:56:05 -04:00 committed by GitHub
commit 03f48289e1
5 changed files with 14 additions and 13 deletions

View file

@ -104,7 +104,7 @@
"name": "polymod",
"type": "git",
"dir": null,
"ref": "4e5b4b3",
"ref": "6594dd8",
"url": "https://github.com/larsiusprime/polymod"
},
{

View file

@ -385,12 +385,6 @@ class SongEventScriptEvent extends ScriptEvent
*/
public var event(default, null):funkin.play.song.SongData.SongEventData;
/**
* The combo count as it is with this event.
* Will be (combo) on miss events and (combo + 1) on hit events (the stored combo count won't update if the event is cancelled).
*/
public var comboCount(default, null):Int;
public function new(event:funkin.play.song.SongData.SongEventData):Void
{
super(ScriptEvent.SONG_EVENT, true);

View file

@ -72,6 +72,9 @@ class ScriptEventDispatcher
case ScriptEvent.RESUME:
t.onResume(event);
return;
case ScriptEvent.SONG_EVENT:
t.onSongEvent(cast event);
return;
case ScriptEvent.COUNTDOWN_START:
t.onCountdownStart(cast event);
return;
@ -118,7 +121,8 @@ class ScriptEventDispatcher
return;
}
throw "No function called for event type: " + event.type;
// If you get a crash on this line, that means ERIC FUCKED UP!
throw 'No function called for event type: ${event.type}';
}
public static function callEventOnAllTargets(targets:Iterator<IScriptedClass>, event:ScriptEvent):Void

View file

@ -1771,7 +1771,13 @@ class PlayState extends MusicBeatState
trace('Found ${songEventsToActivate.length} event(s) to activate.');
for (event in songEventsToActivate)
{
SongEventParser.handleEvent(event);
var eventEvent:SongEventScriptEvent = new SongEventScriptEvent(event);
dispatchEvent(eventEvent);
// Calling event.cancelEvent() skips the event. Neat!
if (!eventEvent.eventCanceled)
{
SongEventParser.handleEvent(event);
}
}
}
}
@ -2674,10 +2680,6 @@ class PlayState extends MusicBeatState
// Dispatch event to character script(s).
if (currentStage != null) currentStage.dispatchToCharacters(event);
// TODO: Dispatch event to song script
// TODO: Dispatch event to note script
}
/**

View file

@ -83,6 +83,7 @@ class CharacterDataParser
try
{
var character:SparrowCharacter = ScriptedSparrowCharacter.init(charCls, DEFAULT_CHAR_ID);
trace(' Initialized character ${character.characterName}');
characterScriptedClass.set(character.characterId, charCls);
}
catch (e)