This commit is contained in:
Anuken
2020-06-21 10:33:08 -04:00
parent a0f0640729
commit 6517eaf62f
22 changed files with 5111 additions and 4859 deletions

View File

@@ -357,7 +357,7 @@ public class TechTree implements ContentList{
this.content = content;
this.requirements = requirements;
this.depth = parent == null ? 0 : parent.depth + 1;
this.progress = Core.settings.getFloat("research-" + content.name, 0f);
this.progress = Core.settings == null ? 0 : Core.settings.getFloat("research-" + content.name, 0f);
map.put(content, this);
context = this;

View File

@@ -29,7 +29,7 @@ public abstract class UnlockableContent extends MappableContent{
this.localizedName = Core.bundle.get(getContentType() + "." + this.name + ".name", this.name);
this.description = Core.bundle.getOrNull(getContentType() + "." + this.name + ".description");
this.unlocked = Core.settings.getBool(name + "-unlocked", false);
this.unlocked = Core.settings != null && Core.settings.getBool(name + "-unlocked", false);
}
public String displayDescription(){

View File

@@ -741,6 +741,16 @@ abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc, QuadTree
public void draw(){
Draw.rect(block.region, x, y, block.rotate ? rotdeg() : 0);
drawTeamTop();
}
public void drawTeamTop(){
if(block.teamRegion.found()){
if(block.teamRegions[team.uid] == block.teamRegion) Draw.color(team.color);
Draw.rect(block.teamRegions[team.uid], x, y);
Draw.color();
}
}
public void drawLight(){
@@ -761,7 +771,7 @@ abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc, QuadTree
}
public void drawTeam(){
Draw.color(team().color);
Draw.color(team.color);
Draw.rect("block-border", x - block.size * tilesize / 2f + 4, y - block.size * tilesize / 2f + 4);
Draw.color();
}

View File

@@ -17,6 +17,8 @@ public class Team implements Comparable<Team>{
public final byte id;
public final int uid;
public final Color color;
public final Color[] palette;
public boolean hasPalette;
public String name;
/** All 256 registered teams. */
@@ -26,8 +28,10 @@ public class Team implements Comparable<Team>{
public final static Team
derelict = new Team(0, "derelict", Color.valueOf("4d4e58")),
sharded = new Team(1, "sharded", Pal.accent.cpy()),
crux = new Team(2, "crux", Color.valueOf("f25555")),
sharded = new Team(1, "sharded", Pal.accent.cpy(),
Color.valueOf("ffd37f"), Color.valueOf("eab678"), Color.valueOf("d4816b")),
crux = new Team(2, "crux", Color.valueOf("f25555"),
Color.valueOf("fc8e6c"), Color.valueOf("f25555"), Color.valueOf("a04553")),
green = new Team(3, "green", Color.valueOf("4dd98b")),
purple = new Team(4, "purple", Color.valueOf("9a4bdf")),
blue = new Team(5, "blue", Color.royal.cpy());
@@ -54,6 +58,21 @@ public class Team implements Comparable<Team>{
uid = us;
if(us < 6) baseTeams[us] = this;
all[us] = this;
palette = new Color[3];
palette[0] = color;
palette[1] = color.cpy().mul(0.75f);
palette[2] = color.cpy().mul(0.5f);
}
/** 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;
hasPalette = true;
}
/** @return the team-specific rules. */

View File

@@ -178,7 +178,10 @@ public class Block extends UnlockableContent{
//TODO move
protected TextureRegion[] generatedIcons;
protected TextureRegion[] variantRegions, editorVariantRegions;
public TextureRegion region, editorIcon;
public @Load("@-team") TextureRegion teamRegion;
public TextureRegion[] teamRegions;
//TODO move
public static TextureRegion[][] cracks;
@@ -622,6 +625,16 @@ public class Block extends UnlockableContent{
}
ContentRegions.loadRegions(this);
//load specific team regions
teamRegions = new TextureRegion[Team.all.length];
for(Team team : Team.all){
if(team.hasPalette){
teamRegions[team.uid] = Core.atlas.find(name + "-team-" + team.name);
}else{
teamRegions[team.uid] = teamRegion;
}
}
}
@Override