From e3ccd5cc2c727df7c46fb2d5f460a36b7730f827 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D1=80=D0=BA=D0=BD=D0=B5=D1=81=D1=81=233729?= <79508138+Darkness6030@users.noreply.github.com> Date: Mon, 29 May 2023 20:09:56 +0300 Subject: [PATCH] Load content icons on a headless server (#8650) * Update build.gradle * Update Fonts.java * Update ServerLauncher.java * Update ServerLauncher.java * s stands for shiza * Update build.gradle --- core/src/mindustry/ui/Fonts.java | 23 +++++++++++++++++-- server/build.gradle | 4 +++- .../src/mindustry/server/ServerLauncher.java | 5 ++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/core/src/mindustry/ui/Fonts.java b/core/src/mindustry/ui/Fonts.java index 5cbfce3f42..753a2e7534 100644 --- a/core/src/mindustry/ui/Fonts.java +++ b/core/src/mindustry/ui/Fonts.java @@ -156,10 +156,29 @@ public class Fonts{ }); for(Team team : Team.baseTeams){ - if(Core.atlas.has("team-" + team.name)){ - team.emoji = stringIcons.get(team.name, ""); + team.emoji = stringIcons.get(team.name, ""); + } + } + + public static void loadContentIconsHeadless(){ + try(Scanner scan = new Scanner(Core.files.internal("icons/icons.properties").read(512))){ + while(scan.hasNextLine()){ + String line = scan.nextLine(); + String[] split = line.split("="); + String[] nametex = split[1].split("\\|"); + String character = split[0]; + int ch = Integer.parseInt(character); + + unicodeIcons.put(nametex[0], ch); + stringIcons.put(nametex[0], ((char)ch) + ""); } } + + stringIcons.put("alphachan", stringIcons.get("alphaaaa")); + + for(Team team : Team.baseTeams){ + team.emoji = stringIcons.get(team.name, ""); + } } /** Called from a static context for use in the loading screen.*/ diff --git a/server/build.gradle b/server/build.gradle index a15d067065..7359fdac3c 100644 --- a/server/build.gradle +++ b/server/build.gradle @@ -39,11 +39,13 @@ task dist(type: Jar, dependsOn: configurations.runtimeClasspath){ exclude("music/**") exclude("sounds/**") exclude("fonts/**") - exclude("icons/**") exclude("bundles/**") exclude("cubemaps/**") exclude("cursors/**") exclude("shaders/**") + exclude("icons/icon.icns") + exclude("icons/icon.ico") + exclude("icons/icon_64.png") manifest{ attributes 'Main-Class': project.mainClassName diff --git a/server/src/mindustry/server/ServerLauncher.java b/server/src/mindustry/server/ServerLauncher.java index 413ee39e91..1aea11b2cc 100644 --- a/server/src/mindustry/server/ServerLauncher.java +++ b/server/src/mindustry/server/ServerLauncher.java @@ -11,6 +11,7 @@ import mindustry.mod.*; import mindustry.mod.Mods.*; import mindustry.net.Net; import mindustry.net.*; +import mindustry.ui.*; import java.time.*; @@ -45,11 +46,15 @@ public class ServerLauncher implements ApplicationListener{ Vars.loadSettings(); Vars.init(); + UI.loadColors(); + Fonts.loadContentIconsHeadless(); + content.createBaseContent(); mods.loadScripts(); content.createModContent(); content.init(); + if(mods.hasContentErrors()){ err("Error occurred loading mod content:"); for(LoadedMod mod : mods.list()){