Skip to content
This repository has been archived by the owner on Jan 26, 2025. It is now read-only.

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
MaybeMaru committed Dec 26, 2023
1 parent 9b349da commit 4381c0f
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 16 deletions.
40 changes: 30 additions & 10 deletions example_mods/TemplateScript.hx
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@ PixelDialogueBox
FunkinSprite
FunkinText
Character
Note
Alphabet
TypedAlphabet
MenuAlphabet

// Gameplay objects
Note
Sustain

// Haxe
Std
Math
Expand Down Expand Up @@ -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<Dynamic>);

/*
Returns a BlendMode type
@param blendModeName --> Name of the blend mode EX: 'multiply'
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand All @@ -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)
Expand All @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions source/funkin/objects/NotesGroup.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions source/funkin/util/modding/FunkScript.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4381c0f

Please sign in to comment.