h
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
[Common]
|
||||
Name="baconeggandcheese"
|
||||
Description="who gaf"
|
||||
APIVersion="uhmmmm probs like 2"
|
||||
DownloadedFrom="https://yourmom.org"
|
||||
Dependencies=[
|
||||
"linkA",
|
||||
"linkB",
|
||||
"linkC"
|
||||
]
|
||||
Icon64="path/to/icon64.png"
|
||||
Icon32="path/to/icon32.png"
|
||||
Icon16="path/to/icon16.png"
|
||||
Icon="path/to/icon.ico"
|
||||
|
||||
[Flags]
|
||||
UseNoteRendererV2=false
|
||||
UseAway3D=false
|
||||
UseDiscordRPCIntegration=true
|
||||
UseLocalization=false
|
||||
UseLegacyFlixelAnimateHitbox=false
|
||||
|
||||
[Discord]
|
||||
ClientID="1027994136193810442",
|
||||
LogoKey="icon"
|
||||
@@ -1,6 +1,7 @@
|
||||
package funkin.backend.system;
|
||||
|
||||
import flixel.util.FlxColor;
|
||||
import funkin.backend.assets.ModsFolder;
|
||||
import funkin.backend.assets.IModsAssetLibrary;
|
||||
import funkin.backend.assets.ScriptedAssetLibrary;
|
||||
import funkin.backend.system.macros.GitCommitMacro;
|
||||
@@ -13,6 +14,9 @@ import lime.utils.AssetType;
|
||||
*/
|
||||
@:build(funkin.backend.system.macros.FlagMacro.build())
|
||||
class Flags {
|
||||
// -- Codename's Addon Config --
|
||||
@:bypass public static var addonFlags:Map<String, Dynamic> = [];
|
||||
|
||||
// -- Codename's Mod Config --
|
||||
public static var MOD_NAME:String = "";
|
||||
public static var MOD_DESCRIPTION:String = "";
|
||||
@@ -27,6 +31,7 @@ class Flags {
|
||||
|
||||
public static var MOD_DISCORD_CLIENT_ID:String = "";
|
||||
public static var MOD_DISCORD_LOGO_KEY:String = "";
|
||||
public static var MOD_DISCORD_LOGO_TEXT:String = "";
|
||||
// -- Codename's Default Flags --
|
||||
public static var COMMIT_NUMBER:Int = GitCommitMacro.commitNumber;
|
||||
public static var COMMIT_HASH:String = GitCommitMacro.commitHash;
|
||||
@@ -219,16 +224,42 @@ class Flags {
|
||||
* Loads the flags from the assets.
|
||||
**/
|
||||
public static function load(?libs:Array<LimeAssetLibrary> = null) {
|
||||
if (libs == null)
|
||||
libs = Paths.assetsTree.libraries;
|
||||
final flagsPath = Paths.getPath("flags.ini");
|
||||
var datas:Array<String> = [
|
||||
for(lib in libs)
|
||||
if(lib.exists(flagsPath, AssetType.TEXT))
|
||||
lib.getAsset(flagsPath, AssetType.TEXT)
|
||||
];
|
||||
if (libs == null) {
|
||||
libs = Paths.assetsTree.libraries.copy();
|
||||
libs.reverse();
|
||||
}
|
||||
for(lib in libs) {
|
||||
var l = lib;
|
||||
if (l is openfl.utils.AssetLibrary) {
|
||||
@:privateAccess
|
||||
l = cast(l, openfl.utils.AssetLibrary).__proxy;
|
||||
}
|
||||
|
||||
var flags:Map<String, String> = loadFromDatas(datas);
|
||||
parseFlags(flags);
|
||||
if (l is IModsAssetLibrary) {
|
||||
var flagsTxt = "";
|
||||
if (l.exists(Paths.getPath("data/config/modpack.ini"), AssetType.TEXT))
|
||||
flagsTxt = l.getAsset(Paths.getPath("data/config/modpack.ini"), AssetType.TEXT);
|
||||
if (cast(l, IModsAssetLibrary).modName == "assets") continue;
|
||||
|
||||
if (cast(l, IModsAssetLibrary).modName == ModsFolder.currentModFolder) {
|
||||
var flags:Map<String, String> = [];
|
||||
loadFromData(flags, flagsTxt);
|
||||
parseFlags(flags);
|
||||
}
|
||||
else {
|
||||
var flags:Map<String, String> = [];
|
||||
loadFromData(flags, flagsTxt);
|
||||
addonFlags.set(cast(l, IModsAssetLibrary).modName.toLowerCase().replace(" ", "").trim(), flags);
|
||||
}
|
||||
}
|
||||
else {
|
||||
var flagsTxt = "";
|
||||
if (l.exists(Paths.getPath("data/config/flags.ini"), AssetType.TEXT))
|
||||
flagsTxt = l.getAsset(Paths.getPath("data/config/flags.ini"), AssetType.TEXT);
|
||||
var flags:Map<String, String> = [];
|
||||
loadFromData(flags, flagsTxt);
|
||||
parseFlags(flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -89,6 +89,10 @@ class DiscordUtil
|
||||
config.logoKey = config.logoKey.getDefault(Flags.DEFAULT_DISCORD_LOGO_KEY);
|
||||
config.logoText = config.logoText.getDefault(Flags.DEFAULT_DISCORD_LOGO_TEXT);
|
||||
config.clientID = config.clientID.getDefault(Flags.DEFAULT_DISCORD_CLIENT_ID);
|
||||
|
||||
if (Flags.MOD_DISCORD_CLIENT_ID.length > 0) config.clientID = Flags.MOD_DISCORD_CLIENT_ID;
|
||||
if (Flags.MOD_DISCORD_LOGO_KEY.length > 0) config.logoKey = Flags.MOD_DISCORD_LOGO_KEY;
|
||||
if (Flags.MOD_DISCORD_LOGO_TEXT.length > 0) config.logoText = Flags.MOD_DISCORD_LOGO_TEXT;
|
||||
currentID = config.clientID;
|
||||
#end
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package funkin.editors;
|
||||
|
||||
class ModConfigWarning extends UIState {
|
||||
|
||||
var libraryToMakeConfigIn:Dynamic = null;
|
||||
public static var defaultModConfigText =
|
||||
'[Common]
|
||||
MOD_NAME="YOUR MOD NAME HERE"
|
||||
MOD_DESCRIPTION="YOUR MOD DESCRIPTION HERE"
|
||||
|
||||
# DO NOT EDIT!! this is used to check for version compatibility!
|
||||
MOD_API_VERSION=1
|
||||
|
||||
MOD_DOWNLOADED_LINK="YOUR MOD PAGE LINK HERE"
|
||||
|
||||
# Not supported yet
|
||||
;MOD_ICON64="path/to/icon64.png"
|
||||
;MOD_ICON32="path/to/icon32.png"
|
||||
;MOD_ICON16="path/to/icon16.png"
|
||||
;MOD_ICON="path/to/icon.ico"
|
||||
|
||||
[Flags]
|
||||
DISABLE_BETA_WARNING_SCREEN=true
|
||||
|
||||
[Discord]
|
||||
MOD_DISCORD_CLIENT_ID=""
|
||||
MOD_DISCORD_LOGO_KEY=""';
|
||||
|
||||
public function new(library) {
|
||||
super();
|
||||
|
||||
libraryToMakeConfigIn = library;
|
||||
}
|
||||
|
||||
override function create() {
|
||||
super.create();
|
||||
|
||||
openSubState(new UIWarningSubstate("Missing mod config!", "Your mod is currently missing a mod config file!\n\n\nWould you like to automatically generate one?\n\n(PS: If this is not your mod please disable Developer mode to stop this popup from appearing.)",
|
||||
[
|
||||
{
|
||||
label: "Not Now",
|
||||
color: 0x969533,
|
||||
onClick: function (_) {
|
||||
funkin.menus.MainMenuState.hadPopup = true;
|
||||
MusicBeatState.skipTransIn = false;
|
||||
MusicBeatState.skipTransOut = false;
|
||||
FlxG.switchState(new funkin.menus.MainMenuState());
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "Yes",
|
||||
onClick: function(_) {
|
||||
trace(libraryToMakeConfigIn.getPath("data/config/modpack.ini"));
|
||||
sys.io.File.saveContent(libraryToMakeConfigIn.getPath("data/config/modpack.ini"), defaultModConfigText);
|
||||
openSubState(new UIWarningSubstate("Created mod config!", "Your mod config file has been created at " + libraryToMakeConfigIn.getPath("data/config/modpack.ini") + "!", [
|
||||
{
|
||||
label: "Ok",
|
||||
onClick: function (_) {
|
||||
funkin.menus.MainMenuState.hadPopup = true;
|
||||
MusicBeatState.skipTransIn = false;
|
||||
MusicBeatState.skipTransOut = false;
|
||||
FlxG.switchState(new funkin.menus.MainMenuState());
|
||||
}
|
||||
},
|
||||
], false));
|
||||
}
|
||||
}
|
||||
], false));
|
||||
}
|
||||
|
||||
override function update(elapsed) {
|
||||
super.update(elapsed);
|
||||
}
|
||||
}
|
||||
@@ -27,8 +27,11 @@ class MainMenuState extends MusicBeatState
|
||||
|
||||
public var canAccessDebugMenus:Bool = !Flags.DISABLE_EDITORS;
|
||||
|
||||
public static var hadPopup = false;
|
||||
|
||||
override function create()
|
||||
{
|
||||
|
||||
super.create();
|
||||
|
||||
DiscordUtil.call("onMenuLoaded", ["Main Menu"]);
|
||||
@@ -79,6 +82,23 @@ class MainMenuState extends MusicBeatState
|
||||
add(versionText);
|
||||
|
||||
changeItem();
|
||||
|
||||
if (Options.devMode && !MainMenuState.hadPopup)
|
||||
for (i in Paths.assetsTree.libraries) {
|
||||
var l = i;
|
||||
if (l is openfl.utils.AssetLibrary) {
|
||||
@:privateAccess
|
||||
l = cast(l, openfl.utils.AssetLibrary).__proxy;
|
||||
}
|
||||
if (cast(l, funkin.backend.assets.IModsAssetLibrary).modName == funkin.backend.assets.ModsFolder.currentModFolder) {
|
||||
if (!l.exists(Paths.getPath("data/config/modpack.ini"), lime.utils.AssetType.TEXT)) {
|
||||
MusicBeatState.skipTransIn = true;
|
||||
MusicBeatState.skipTransOut = true;
|
||||
FlxG.switchState(new funkin.editors.ModConfigWarning(l));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var selectedSomethin:Bool = false;
|
||||
|
||||
Reference in New Issue
Block a user