Merge remote-tracking branch 'upstream/main'

This commit is contained in:
Ne_Eo
2024-11-03 20:01:10 +01:00
10 changed files with 92 additions and 57 deletions
+2 -2
View File
@@ -12,8 +12,8 @@ Also, the command `.\cne test` uses the source assets folder instead of the expo
## Codename Engine
Codename Engine is a new Friday Night Funkin' Engine aimed at simplifying modding, along with extensiblity and ease of use.<br>
Make sure to read the wiki and join the Discord server linked there!<br>
#### It includes many new features, as seen [here](FEATURES.md)<br>
### Before making issues or need help with something, check our website [HERE](https://fnf-cne-devs.github.io/) (it contains a wiki of how to mod with EXAMPLES, an api, lists of mods made with Codename Engine and more)!!!
#### The Engine includes many new features, as seen [here](FEATURES.md)<br>
#### Wanna see the new features added in the most recent update? Click [here](PATCHNOTES.md)<br>
## How to download
-7
View File
@@ -1,7 +0,0 @@
<!DOCTYPE codename-mod-credits>
<!-- TEMPLATE FOR CUSTOM CREDITS!!! -->
<menu name="Mod Credits" desc="Modify mod credits here">
<!-- \/ You can also set the portrait shader as false as you can see below in the github one -->
<credit name="Credit Example" desc="Click me to know more about me!" icon="credit icon example" size="130" url="https://youtu.be/fugtxz1znVw"/>
<github user="NexIsDumb" customName="Nex is Dumb" desc="The bitch who made these credits menus" size="100" portrait="false" color="#808080"/>
</menu>
-15
View File
@@ -1,15 +0,0 @@
<!DOCTYPE codename-mod-options>
<!-- TEMPLATE FOR CUSTOM OPTIONS!!! -->
<menu name="Mod Options" desc="Modify mod options here">
<checkbox id="checkboxExample" name="Checkbox example" />
<number id="numberExample" name="Number example" min="0" max="10" change="1"/>
<choice id="choiceExample" name="Choice Example">
<value name="Disabled" value="disabled"/>
<value name="This only" value="thisOnly"/>
<value name="All" value="all"/>
</choice>
<menu name="Submenu Example" desc="Submenu test">
<checkbox id="levelOfIdk2" name="Level of idk" />
</menu>
</menu>
+66 -24
View File
@@ -11,8 +11,7 @@ class Logs {
public static var nativeTrace = Log.trace;
public static function init() {
Log.trace = function(v : Dynamic, ?infos : Null<haxe.PosInfos>) {
Log.trace = function(v:Dynamic, ?infos:Null<haxe.PosInfos>) {
var data = [
logText('${infos.fileName}:${infos.lineNumber}: ', CYAN),
logText(Std.string(v))
@@ -28,22 +27,48 @@ class Logs {
__showInConsole(prepareColoredTrace(data, TRACE));
};
LogFrontEnd.onLogs = function(Data, Style, FireOnce) {
LogFrontEnd.onLogs = function(data, style, fireOnce) {
var prefix = "[FLIXEL]";
var color:ConsoleColor = LIGHTGRAY;
var level:Level = INFO;
if (Style == LogStyle.CONSOLE) {prefix = "> "; color = WHITE; level = INFO; } else
if (Style == LogStyle.ERROR) {prefix = "[FLIXEL]"; color = RED; level = ERROR; } else
if (Style == LogStyle.NORMAL) {prefix = "[FLIXEL]"; color = WHITE; level = INFO; } else
if (Style == LogStyle.NOTICE) {prefix = "[FLIXEL]"; color = GREEN; level = VERBOSE;} else
if (Style == LogStyle.WARNING) {prefix = "[FLIXEL]"; color = YELLOW; level = WARNING;}
if (style == LogStyle.CONSOLE) // cant place a switch here as these arent inline values - Nex
{
prefix = "> ";
color = WHITE;
level = INFO;
}
else if (style == LogStyle.ERROR)
{
prefix = "[FLIXEL]";
color = RED;
level = ERROR;
}
else if (style == LogStyle.NORMAL)
{
prefix = "[FLIXEL]";
color = WHITE;
level = INFO;
}
else if (style == LogStyle.NOTICE)
{
prefix = "[FLIXEL]";
color = GREEN;
level = VERBOSE;
}
else if (style == LogStyle.WARNING)
{
prefix = "[FLIXEL]";
color = YELLOW;
level = WARNING;
}
var d:Dynamic = Data;
var d:Dynamic = data;
if (!(d is Array))
d = [d];
var a:Array<Dynamic> = d;
var strs = [for(e in a) Std.string(e)];
for(e in strs) {
for(e in strs)
{
Logs.trace('$prefix $e', level, color);
}
};
@@ -55,12 +80,18 @@ class Logs {
logText('[ '),
logText('${Std.string(time.getHours()).addZeros(2)}:${Std.string(time.getMinutes()).addZeros(2)}:${Std.string(time.getSeconds()).addZeros(2)}', DARKMAGENTA),
logText(' |'),
switch(level) {
case WARNING: logText(' WARNING ', DARKYELLOW);
case ERROR: logText(' ERROR ', DARKRED);
case TRACE: logText(' TRACE ', GRAY);
case VERBOSE: logText(' VERBOSE ', DARKMAGENTA);
default: logText(' INFORMATION ', CYAN);
switch (level)
{
case WARNING:
logText(' WARNING ', DARKYELLOW);
case ERROR:
logText(' ERROR ', DARKRED);
case TRACE:
logText(' TRACE ', GRAY);
case VERBOSE:
logText(' VERBOSE ', DARKMAGENTA);
default:
logText(' INFORMATION ', CYAN);
},
logText('] ')
];
@@ -77,7 +108,7 @@ class Logs {
}
public static function __showInConsole(text:Array<LogText>) {
#if sys
#if (sys && !mobile)
while(__showing) {
Sys.sleep(0.05);
}
@@ -89,20 +120,30 @@ class Logs {
NativeAPI.setConsoleColors();
Sys.print("\r\n");
__showing = false;
#elseif mobile
while(__showing) {
Sys.sleep(0.05);
}
__showing = true;
@:privateAccess
Sys.print([for(t in text) t.text].join(""));
__showing = false;
#else
@:privateAccess
nativeTrace([for(t in text) t.text].join(""));
#end
}
public static function traceColored(text:Array<LogText>, level:Level = INFO) {
public static function traceColored(text:Array<LogText>, level:Level = INFO)
__showInConsole(prepareColoredTrace(text, level));
}
public static function trace(text:String, level:Level = INFO, color:ConsoleColor = LIGHTGRAY) {
traceColored([{
text: text,
color: color
}], level);
traceColored([
{
text: text,
color: color
}
], level);
}
}
@@ -113,7 +154,8 @@ enum abstract Level(Int) {
var TRACE = 3;
var VERBOSE = 4;
}
typedef LogText = {
var text:String;
var color:ConsoleColor;
}
}
+4 -1
View File
@@ -721,7 +721,10 @@ class CoolUtil
*/
@:noUsing public static inline function openURL(url:String) {
#if linux
Sys.command('/usr/bin/xdg-open', [url]);
// generally `xdg-open` should work in every distro
var cmd = Sys.command("xdg-open", [url]);
// run old command JUST IN CASE it fails, which it shouldn't
if (cmd != 0) cmd = Sys.command("/usr/bin/xdg-open", [url]);
#else
FlxG.openURL(url);
#end
+4 -2
View File
@@ -140,14 +140,16 @@ class MemoryUtil {
reg.match(process.stdout.readAll().toString());
if (process.exitCode() == 0) return reg.matched(1);
#elseif linux
var process = new HiddenProcess("sudo", ["dmidecode", "--type", "17"]);
/*var process = new HiddenProcess("sudo", ["dmidecode", "--type", "17"]);
if (process.exitCode() != 0) return "Unknown";
var lines = process.stdout.readAll().toString().split("\n");
for (line in lines) {
if (line.startsWith("Type:")) {
return line.substring("Type:".length).trim();
}
}
}*/
// TODO: sort of unsafe? also requires users to use `sudo`
// when launching the engine through the CLI, REIMPLEMENT LATER.
#end
return "Unknown";
}
@@ -89,7 +89,7 @@ class DialogueCutscene extends Cutscene {
musicVolume: node.has.musicVolume ? (volume = Std.parseFloat(node.att.speed).getDefault(0.8)) : null,
changeMusic: node.has.changeMusic ? FlxG.sound.load(Paths.music(node.att.changeMusic), volume, true) : null,
playSound: node.has.playSound ? FlxG.sound.load(Paths.sound(node.att.playSound)) : null,
nextSound: node.has.nextSound ? FlxG.sound.load(Paths.music(node.att.nextSound)) : null,
nextSound: node.has.nextSound ? FlxG.sound.load(Paths.sound(node.att.nextSound)) : null,
textSound: null
};
@@ -215,4 +215,4 @@ typedef DialogueLine = {
var nextSound:FlxSound;
var textSound:FlxSound;
var changeDefAnim:String;
}
}
+1 -1
View File
@@ -158,7 +158,7 @@ class MainMenuState extends MusicBeatState
var event = event("onSelectItem", EventManager.get(NameEvent).recycle(daChoice));
if (event.cancelled) return;
switch (daChoice)
switch (event.name)
{
case 'story mode': FlxG.switchState(new StoryMenuState());
case 'freeplay': FlxG.switchState(new FreeplayState());
+9 -2
View File
@@ -114,6 +114,12 @@ class StoryMenuState extends MusicBeatState {
}
}
// default difficulty should be the middle difficulty in the array
// to be consistent with base game and whatnot, you know the drill
curDifficulty = Math.floor(weeks[0].difficulties.length * 0.5);
// debug stuff lol
Logs.trace('Middle Difficulty for Week 1 is ${weeks[0].difficulties[curDifficulty]} (ID: $curDifficulty)');
changeWeek(0, true);
DiscordUtil.call("onMenuLoaded", ["Story Menu"]);
@@ -163,6 +169,7 @@ class StoryMenuState extends MusicBeatState {
if (!force) CoolUtil.playMenuSFX();
for(k=>e in weekSprites.members) {
e.targetY = k - curWeek;
e.alpha = k == curWeek ? 1.0 : 0.6;
}
tracklist.text = 'TRACKS\n\n${[for(e in weeks[curWeek].songs) if (!e.hide) e.name.toUpperCase()].join('\n')}';
weekTitle.text = weeks[curWeek].name.getDefault("");
@@ -343,13 +350,13 @@ class StoryMenuState extends MusicBeatState {
if (char.animation.exists("confirm"))
char.animation.play("confirm");
PlayState.loadWeek(weeks[curWeek], weeks[curWeek].difficulties[curDifficulty]);
PlayState.loadWeek(event.week, event.difficulty);
new FlxTimer().start(1, function(tmr:FlxTimer)
{
FlxG.switchState(new PlayState());
});
weekSprites.members[curWeek].startFlashing();
weekSprites.members[event.weekID].startFlashing();
}
}
+4 -1
View File
@@ -367,7 +367,10 @@ class System
#elseif mac
Sys.command("/usr/bin/open", [path]);
#elseif linux
Sys.command("/usr/bin/xdg-open", [path]);
// generally `xdg-open` should work in every distro
var cmd = Sys.command("xdg-open", [path, "&"]);
// run old command JUST IN CASE it fails, which it shouldn't
if (cmd != 0) cmd = Sys.command("/usr/bin/xdg-open", [path, "&"]);
#elseif (js && html5)
Browser.window.open(path, "_blank");
#elseif flash