From 4381c0f25195d7f8d2a96eea78fe094352c4caeb Mon Sep 17 00:00:00 2001 From: MaybeMaru <97055307+MaybeMaru@users.noreply.github.com> Date: Tue, 26 Dec 2023 18:07:21 +0100 Subject: [PATCH] add docs --- example_mods/TemplateScript.hx | 40 ++++++++++++++++++------ source/funkin/objects/NotesGroup.hx | 12 +++---- source/funkin/util/modding/FunkScript.hx | 2 ++ 3 files changed, 38 insertions(+), 16 deletions(-) diff --git a/example_mods/TemplateScript.hx b/example_mods/TemplateScript.hx index dcb86589..77857831 100644 --- a/example_mods/TemplateScript.hx +++ b/example_mods/TemplateScript.hx @@ -26,11 +26,14 @@ PixelDialogueBox FunkinSprite FunkinText Character -Note Alphabet TypedAlphabet MenuAlphabet +// Gameplay objects +Note +Sustain + // Haxe Std Math @@ -158,6 +161,13 @@ existsGroup(groupTag:String); */ cacheCharacter(charName:String); +/* + Runs a PlayState song event + @param eventName --> Name of the event to call + @param eventValues --> Values of the event to call (OPTIONAL) +*/ +runEvent(eventName:String, ?eventValues:Array); + /* Returns a BlendMode type @param blendModeName --> Name of the blend mode EX: 'multiply' @@ -254,6 +264,16 @@ pauseSounds(); */ resumeSounds(); +/* + Changes the current Discord client presence + @param details --> Small text of the Discord presence + @param title --> Big text of the Discord presence + @param smallImage --> Small image key of the Discord presence (OPTIONAL) + @param hasTime --> If to display the time on the presence (OPTIONAL) + @param endTime --> Time length to display on the presence (OPTIONAL) +*/ +changeDiscordPresence(details:String, title:String, ?smallImage:String, ?hasTime:Bool, ?endTime:Float); + /* Switches the state to a custom state class @param stateName --> Name of the state in data/scripts/customStates to switch to @@ -519,10 +539,10 @@ function noteHit(note:Note, isPlayer:Bool) // isPlayer --> If the note is from the player lane } -function sustainPress(note:Note, isPlayer:Bool) +function sustainPress(sustain:Sustain, isPlayer:Bool) { - // Called every frame a sustain note from any lane is beaing pressed - // note --> Note pressed + // Called every frame a sustain from any lane is beaing pressed + // sustain --> Sustain pressed // isPlayer --> If the note is from the player lane } @@ -532,10 +552,10 @@ function goodNoteHit(note:Note) // note --> Note hit by the player } -function goodSustainPress(note:Note) +function goodSustainPress(sustain:Sustain) { - // Called every frame a sustain note is being pressed by the player - // note --> Note pressed by the player + // Called every frame a sustain is being pressed by the player + // sustain --> Sustain pressed by the player } function badNoteHit(direction:Int) @@ -557,10 +577,10 @@ function opponentNoteHit(note:Note) // daNote --> Note hit by the opponent } -function opponentSustainPress(note:Note) +function opponentSustainPress(sustain:Sustain) { - // Called every frame a sustain note is being pressed by the opponent - // note --> Note pressed by the opponent + // Called every frame a sustain is being pressed by the opponent + // sustain --> Sustain pressed by the opponent } function updateScore(songScore:Int) diff --git a/source/funkin/objects/NotesGroup.hx b/source/funkin/objects/NotesGroup.hx index 66a6403a..bcd7aa71 100644 --- a/source/funkin/objects/NotesGroup.hx +++ b/source/funkin/objects/NotesGroup.hx @@ -74,20 +74,20 @@ class NotesGroup extends FlxGroup note.targetStrum.playStrumAnim('confirm', true); } - function pressSustain(note:Sustain, ?character:Character, botplayCheck:Bool = false, prefBot:Bool = false) { + function pressSustain(sustain:Sustain, ?character:Character, botplayCheck:Bool = false, prefBot:Bool = false) { if (isPlayState) { - character.sing(note.noteData, note.altAnim, false); + character.sing(sustain.noteData, sustain.altAnim, false); Conductor.vocals.volume = 1; } if (!botplayCheck || prefBot) { - if (isPlayState) PlayState.instance.health += note.hitHealth[1] * (FlxG.elapsed * 5); + if (isPlayState) PlayState.instance.health += sustain.hitHealth[1] * (FlxG.elapsed * 5); } else { - note.pressSustain(); + sustain.pressSustain(); } - botplayCheck ? if (!getPref('vanilla-ui')) playStrumAnim(note) : - note.targetStrum.playStrumAnim('confirm', true); + botplayCheck ? if (!getPref('vanilla-ui')) playStrumAnim(sustain) : + sustain.targetStrum.playStrumAnim('confirm', true); } public function new(_SONG:SwagSong, isPlayState:Bool = true) { diff --git a/source/funkin/util/modding/FunkScript.hx b/source/funkin/util/modding/FunkScript.hx index fa7d1a0e..3277e8bc 100644 --- a/source/funkin/util/modding/FunkScript.hx +++ b/source/funkin/util/modding/FunkScript.hx @@ -79,7 +79,9 @@ class FunkScript extends hscript.Script implements IFlxDestroyable { set('FunkinSprite', FunkinSprite); set('FunkinText', FunkinText); set('Character', Character); + set('Note', Note); + set('Sustain', Sustain); set('Alphabet', Alphabet); set('TypedAlphabet', TypedAlphabet);