From e57e47617c5e9a8d76f2658e5b9613c44b914c5f Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 9 Feb 2025 11:15:33 -0500 Subject: [PATCH] Closes #10302 --- core/src/mindustry/game/Team.java | 36 +++++++++++++++++-------------- core/src/mindustry/mod/Mods.java | 5 +---- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/core/src/mindustry/game/Team.java b/core/src/mindustry/game/Team.java index f27f099eca..57c5808132 100644 --- a/core/src/mindustry/game/Team.java +++ b/core/src/mindustry/game/Team.java @@ -17,7 +17,7 @@ import static mindustry.Vars.*; public class Team implements Comparable, Senseable{ public final int id; public final Color color; - public final Color[] palette; + public final Color[] palette = {new Color(), new Color(), new Color()}; public final int[] palettei = new int[3]; public String emoji = ""; public boolean hasPalette; @@ -64,27 +64,15 @@ public class Team implements Comparable, Senseable{ if(id < 6) baseTeams[id] = this; all[id] = this; - palette = new Color[3]; - palette[0] = color; - palette[1] = color.cpy().mul(0.75f); - palette[2] = color.cpy().mul(0.5f); - - for(int i = 0; i < 3; i++){ - palettei[i] = palette[i].rgba(); - } + setPalette(color); } /** Specifies a 3-color team palette. */ protected Team(int id, String name, Color color, Color pal1, Color pal2, Color pal3){ this(id, name, color); - palette[0] = pal1; - palette[1] = pal2; - palette[2] = pal3; - for(int i = 0; i < 3; i++){ - palettei[i] = palette[i].rgba(); - } - hasPalette = true; + setPalette(pal1, pal2, pal3); + this.color.set(color); } /** @return the core items for this team, or an empty item module. @@ -144,6 +132,22 @@ public class Team implements Comparable, Senseable{ return emoji + "[#" + color + "]" + localized() + "[]"; } + public void setPalette(Color color){ + setPalette(color, color.cpy().mul(0.75f), color.cpy().mul(0.5f)); + hasPalette = false; + } + + public void setPalette(Color pal1, Color pal2, Color pal3){ + color.set(pal1); + palette[0].set(pal1); + palette[1].set(pal2); + palette[2].set(pal3); + for(int i = 0; i < 3; i++){ + palettei[i] = palette[i].rgba(); + } + hasPalette = true; + } + @Override public int compareTo(Team team){ return Integer.compare(id, team.id); diff --git a/core/src/mindustry/mod/Mods.java b/core/src/mindustry/mod/Mods.java index 572f4ceee1..e114511658 100644 --- a/core/src/mindustry/mod/Mods.java +++ b/core/src/mindustry/mod/Mods.java @@ -208,10 +208,7 @@ public class Mods implements Loadable{ regionName = baseName.contains(".") ? baseName.substring(0, baseName.indexOf(".")) : baseName; if(!prefix && !Core.atlas.has(regionName)){ - Log.warn("Sprite '@' in mod '@' attempts to override a non-existent sprite. Ignoring.", regionName, mod.name); - continue; - - //(horrible code below) + Log.warn("Sprite '@' in mod '@' attempts to override a non-existent sprite.", regionName, mod.name); } //read and bleed pixmaps in parallel