modcharts are in
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
function beatHit(curBeat:Int) {
|
||||
switch(curBeat) {
|
||||
case 168:
|
||||
camZoomingInterval = 1;
|
||||
case 200:
|
||||
camZoomingInterval = 4;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1 +1 @@
|
||||
269
|
||||
275
|
||||
@@ -34,6 +34,12 @@ class Note extends FlxSprite
|
||||
public var isSustainNote:Bool = false;
|
||||
|
||||
public var noteScore:Float = 1;
|
||||
public var noteTypeID:Int = 0;
|
||||
|
||||
public var noteType(get, null):String;
|
||||
private function get_noteType() {
|
||||
return PlayState.instance.getNoteType(noteTypeID);
|
||||
}
|
||||
|
||||
public static var swagWidth:Float = 160 * 0.7;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package funkin.game;
|
||||
|
||||
import funkin.scripting.Script;
|
||||
import flixel.util.FlxDestroyUtil;
|
||||
#if desktop
|
||||
import Discord.DiscordClient;
|
||||
@@ -39,6 +40,7 @@ import flixel.util.FlxSort;
|
||||
import flixel.util.FlxStringUtil;
|
||||
import flixel.util.FlxTimer;
|
||||
import haxe.Json;
|
||||
import haxe.io.Path;
|
||||
import lime.utils.Assets;
|
||||
import openfl.display.BlendMode;
|
||||
import openfl.display.StageQuality;
|
||||
@@ -47,6 +49,7 @@ import funkin.system.Conductor;
|
||||
import funkin.system.Song;
|
||||
|
||||
import funkin.menus.*;
|
||||
import funkin.scripting.events.*;
|
||||
|
||||
using StringTools;
|
||||
|
||||
@@ -201,6 +204,21 @@ class PlayState extends MusicBeatState
|
||||
// TODO: Custom Stage Loading
|
||||
add(new Stage(SONG.stage));
|
||||
|
||||
|
||||
switch(SONG.song) {
|
||||
// case "":
|
||||
// ADD YOUR HARDCODED SCRIPTS HERE!
|
||||
default:
|
||||
var content = Paths.getFolderContent('charts/${SONG.song.toLowerCase()}/', false, true, !fromMods);
|
||||
trace(content);
|
||||
for(file in content) {
|
||||
var ext = Path.extension(file).toLowerCase();
|
||||
if (Script.scriptExtensions.contains(ext)) {
|
||||
scripts.add(Script.create(file));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scripts.load();
|
||||
scripts.call("create");
|
||||
|
||||
@@ -1091,7 +1109,6 @@ class PlayState extends MusicBeatState
|
||||
private function popUpScore(strumtime:Float):Void
|
||||
{
|
||||
var noteDiff:Float = Math.abs(strumtime - Conductor.songPosition);
|
||||
// boyfriend.playAnim('hey');
|
||||
vocals.volume = 1;
|
||||
|
||||
var placement:String = Std.string(combo);
|
||||
@@ -1320,6 +1337,11 @@ class PlayState extends MusicBeatState
|
||||
}
|
||||
}
|
||||
|
||||
public function getNoteType(id:Int) {
|
||||
// TODO: Note Types
|
||||
return null;
|
||||
}
|
||||
|
||||
function goodNoteHit(note:Note):Void
|
||||
{
|
||||
if (!note.wasGoodHit)
|
||||
@@ -1327,11 +1349,11 @@ class PlayState extends MusicBeatState
|
||||
camZooming = true;
|
||||
if (note.mustPress) {
|
||||
// TODO: See TODO above
|
||||
scripts.call("onPlayerHit", [note]);
|
||||
scripts.event("onPlayerHit", new NoteHitEvent(note, note.mustPress ? boyfriend : dad, note.mustPress, note.noteType));
|
||||
if (!note.isSustainNote)
|
||||
{
|
||||
popUpScore(note.strumTime);
|
||||
combo++;
|
||||
popUpScore(note.strumTime);
|
||||
}
|
||||
|
||||
if (note.noteData >= 0)
|
||||
|
||||
@@ -149,7 +149,7 @@ class FreeplayState extends MusicBeatState
|
||||
|
||||
#if PRELOAD_ALL
|
||||
var autoplayElapsed:Float = 0;
|
||||
var songInstPlaying:Bool = false;
|
||||
var songInstPlaying:Bool = true;
|
||||
var curPlayingInst:String = null;
|
||||
#end
|
||||
|
||||
|
||||
@@ -121,6 +121,8 @@ class ModsAssetLibrary extends AssetLibrary {
|
||||
if (!FileSystem.isDirectory('$path$e'))
|
||||
result.push(e);
|
||||
return result;
|
||||
} catch(e) {
|
||||
// woops!!
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package funkin.scripting;
|
||||
|
||||
import funkin.scripting.events.CancellableEvent;
|
||||
|
||||
@:access(CancellableEvent)
|
||||
class ScriptPack extends Script {
|
||||
public var scripts:Array<Script> = [];
|
||||
public var additionalDefaultVariables:Map<String, Dynamic> = [];
|
||||
@@ -28,6 +29,7 @@ class ScriptPack extends Script {
|
||||
public function event<T:CancellableEvent>(func:String, event:T):T {
|
||||
for(e in scripts) {
|
||||
e.call(func, [event]);
|
||||
@:privateAccess
|
||||
if (event.cancelled && event.__continueCalls) break;
|
||||
}
|
||||
return event;
|
||||
|
||||
@@ -27,4 +27,10 @@ class CancellableEvent {
|
||||
public function new(continueCalls:Bool) {
|
||||
__continueCalls = continueCalls;
|
||||
}
|
||||
|
||||
public function toString():String {
|
||||
var rep = '[CancellableEvent ${cancelled ? "(Cancelled)" : ""} - ]';
|
||||
// TODO: List all fields
|
||||
return rep;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package funkin.scripting.events;
|
||||
|
||||
import funkin.game.Note;
|
||||
import funkin.game.Character;
|
||||
|
||||
class NoteHitEvent extends CancellableEvent {
|
||||
public var note:Note;
|
||||
public var character:Character;
|
||||
public var player:Bool;
|
||||
public var noteType:String;
|
||||
|
||||
public function new(note:Note, char:Character, player:Bool, ?noteType:String) {
|
||||
super(true);
|
||||
|
||||
this.note = note;
|
||||
this.character = char;
|
||||
this.player = player;
|
||||
this.noteType = noteType;
|
||||
}
|
||||
}
|
||||
@@ -148,15 +148,16 @@ class Paths
|
||||
return FlxAtlasFrames.fromSpriteSheetPacker(image(key, library), file('images/$key.txt', library));
|
||||
}
|
||||
|
||||
inline static public function getFolderContent(key:String, includeSource:Bool = true, scanSource:Bool = false):Array<String> {
|
||||
inline static public function getFolderContent(key:String, includeSource:Bool = true, addPath:Bool = false, scanSource:Bool = false):Array<String> {
|
||||
// designed to work both on windows and web
|
||||
|
||||
if (!key.endsWith("/")) key = key + "/";
|
||||
|
||||
if (ModsFolder.currentModFolder == null)
|
||||
return getFolderContent(key, false, true);
|
||||
return getFolderContent(key, false, addPath, true);
|
||||
|
||||
var libThing = new LimeLibrarySymbol(scanSource ? getPreloadPath(key) : getLibraryPathForce(key, 'mods/${ModsFolder.currentModFolder}'));
|
||||
var folderPath:String = scanSource ? getPreloadPath(key) : getLibraryPathForce(key, 'mods/${ModsFolder.currentModFolder}');
|
||||
var libThing = new LimeLibrarySymbol(folderPath);
|
||||
var library = libThing.library;
|
||||
|
||||
if (library is openfl.utils.AssetLibrary) {
|
||||
@@ -171,22 +172,30 @@ class Paths
|
||||
// easy task, can immediatly scan for files!
|
||||
var lib = cast(library, funkin.mods.ModsAssetLibrary);
|
||||
content = lib.getFiles(libThing.symbolName);
|
||||
} else
|
||||
#end
|
||||
if (library is lime.utils.AssetLibrary) {
|
||||
if (addPath)
|
||||
for(i in 0...content.length)
|
||||
content[i] = '$folderPath${content[i]}';
|
||||
} else #end
|
||||
if (library is lime.utils.AssetLibrary) {
|
||||
var lib = cast(library, lime.utils.AssetLibrary);
|
||||
@:privateAccess
|
||||
for(k=>e in lib.paths) {
|
||||
if (k.startsWith(libThing.symbolName)) {
|
||||
var barebonesFileName = k.substr(libThing.symbolName.length);
|
||||
if (!barebonesFileName.contains("/"))
|
||||
content.push(barebonesFileName);
|
||||
if (addPath) {
|
||||
content.push('${libThing.libraryName}:$k');
|
||||
} else {
|
||||
var barebonesFileName = k.substr(libThing.symbolName.length);
|
||||
if (!barebonesFileName.contains("/"))
|
||||
content.push(barebonesFileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (includeSource) {
|
||||
var sourceResult = getFolderContent(key, false, true);
|
||||
var sourceResult = getFolderContent(key, false, addPath, true);
|
||||
for(e in sourceResult)
|
||||
if (!content.contains(e))
|
||||
content.push(e);
|
||||
|
||||
@@ -27,7 +27,7 @@ class Song
|
||||
public static function loadFromJson(songName:String, ?difficulty:String = "normal"):SwagSong
|
||||
{
|
||||
var assetPath = Paths.chart(songName, difficulty);
|
||||
PlayState.fromMods = !assetPath.startsWith("mods");
|
||||
PlayState.fromMods = assetPath.startsWith("mods");
|
||||
var rawJson = Assets.getText(assetPath).trim();
|
||||
|
||||
while (!rawJson.endsWith("}"))
|
||||
|
||||
Reference in New Issue
Block a user