modcharts!!

This commit is contained in:
Yoshman29
2022-10-09 23:21:25 +02:00
parent abee99f94c
commit 9009916ce6
9 changed files with 107 additions and 69 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ class HScript extends Script {
var code:String = Assets.getText(path);
var parser = new hscript.Parser();
parser.allowJSON = parser.allowMetadata = parser.allowTypes = true;
// interp.errorHandler = _errorHandler;
interp.errorHandler = _errorHandler;
try {
expr = parser.parseString(code, fileName);
} catch(e) {
@@ -5,7 +5,7 @@ import funkin.scripting.ScriptPack;
@:allow(ScriptPack)
class CancellableEvent {
@:dox(hide) public var cancelled:Bool = false;
@:dox(hide) private var __continueCalls:Bool = false;
@:dox(hide) private var __continueCalls:Bool = true;
/**
* Additional data if used in scripts
@@ -14,19 +14,21 @@ class CancellableEvent {
/**
* Prevents default action from occuring.
* @param c Whenever the scripts following this one should be called or not. (Defaults to `true`)
*/
public function cancel() {
public function preventDefault(c:Bool = true) {
cancelled = true;
__continueCalls = c;
}
@:dox(hide)
public function cancel(c:Bool = true) {preventDefault(c);}
/**
* Creates a new cancellable event.
* This allows scripts to call `cancel()` to cancel the event.
* @param continueCalls Whenever the `ScriptPack` should continue calling functions from other scripts after a script cancelled the event.
*/
public function new(continueCalls:Bool) {
__continueCalls = continueCalls;
}
public function new() {}
public function toString():String {
var rep = '[CancellableEvent ${cancelled ? "(Cancelled)" : ""} - ]';
+24 -3
View File
@@ -4,17 +4,38 @@ import funkin.game.Note;
import funkin.game.Character;
class NoteHitEvent extends CancellableEvent {
@:dox(hide) public var animCancelled:Bool = false;
public var note:Note;
public var character:Character;
public var player:Bool;
public var noteType:String;
public var direction:Int;
public function new(note:Note, char:Character, player:Bool, ?noteType:String) {
super(true);
/**
* Creates a new NoteHitEvent with the following values:
* @param note
* @param character
* @param player
* @param noteType
*/
public function new(note:Note, character:Character, player:Bool, noteType:String, direction:Int) {
super();
this.note = note;
this.character = char;
this.character = character;
this.player = player;
this.noteType = noteType;
this.direction = direction;
}
/**
* Prevents the default sing animation from being played.
*/
public function preventAnim() {
animCancelled = true;
}
@:dox(hide)
public function cancelAnim() {preventAnim();}
}