Mission icons

This commit is contained in:
Anuken 2018-11-02 19:38:08 -04:00
parent 0391ed3e63
commit 761ae4b816
11 changed files with 988 additions and 951 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 187 B

After

Width:  |  Height:  |  Size: 192 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 99 KiB

View File

@ -33,8 +33,7 @@ import static io.anuke.mindustry.Vars.*;
public class Fire extends TimedEntity implements SaveTrait, SyncTrait, Poolable{ public class Fire extends TimedEntity implements SaveTrait, SyncTrait, Poolable{
private static final IntMap<Fire> map = new IntMap<>(); private static final IntMap<Fire> map = new IntMap<>();
private static final float baseLifetime = 1000f; private static final float baseLifetime = 1000f, spreadChance = 0.05f, fireballChance = 0.07f;
private static final float spreadChance = 0.05f, fireballChance = 0.07f;
private int loadedPosition = -1; private int loadedPosition = -1;
private Tile tile; private Tile tile;
@ -42,15 +41,10 @@ public class Fire extends TimedEntity implements SaveTrait, SyncTrait, Poolable{
private float baseFlammability = -1, puddleFlammability; private float baseFlammability = -1, puddleFlammability;
private float lifetime; private float lifetime;
/** /**Deserialization use only!*/
* Deserialization use only! public Fire(){}
*/
public Fire(){
}
/** /**Start a fire on the tile. If there already is a file there, refreshes its lifetime.*/
* Start a fire on the tile. If there already is a file there, refreshes its lifetime.
*/
public static void create(Tile tile){ public static void create(Tile tile){
if(Net.client() || tile == null) return; //not clientside. if(Net.client() || tile == null) return; //not clientside.
@ -70,7 +64,11 @@ public class Fire extends TimedEntity implements SaveTrait, SyncTrait, Poolable{
} }
public static boolean has(int x, int y){ public static boolean has(int x, int y){
return Structs.inBounds(x, y, world.width(), world.height()) && map.containsKey(x + y * world.width()); if(!Structs.inBounds(x, y, world.width(), world.height()) || !map.containsKey(x + y * world.width())){
return false;
}
Fire fire = map.get(x + y * world.width());
return fire.isAdded() && fire.fin() < 1f && fire.tile != null && fire.tile.x == x && fire.tile.y == y;
} }
/** /**

View File

@ -225,8 +225,8 @@ public class Sectors{
/**Generates a mission for a sector. This is deterministic and the same for each client.*/ /**Generates a mission for a sector. This is deterministic and the same for each client.*/
private void generate(Sector sector){ private void generate(Sector sector){
//25% chance for no missions, empty sector //empty sector
if(Mathf.randomSeed(sector.getSeed() + 213) < 0.4){ if(Mathf.randomSeed(sector.getSeed() + 213) < 0.2){
return; return;
} }

View File

@ -13,6 +13,11 @@ import static io.anuke.mindustry.Vars.*;
public class BattleMission extends Mission{ public class BattleMission extends Mission{
final int spacing = 30; final int spacing = 30;
@Override
public String getIcon(){
return "icon-mission-battle";
}
@Override @Override
public GameMode getMode(){ public GameMode getMode(){
return GameMode.noWaves; return GameMode.noWaves;

View File

@ -17,7 +17,7 @@ import static io.anuke.mindustry.Vars.*;
public abstract class Mission{ public abstract class Mission{
private String extraMessage; private String extraMessage;
private boolean showComplete =true; private boolean showComplete = true;
public abstract boolean isComplete(); public abstract boolean isComplete();
@ -29,6 +29,10 @@ public abstract class Mission{
return displayString(); return displayString();
} }
public String getIcon(){
return "icon-mission-defense";
}
public GameMode getMode(){ public GameMode getMode(){
return GameMode.noWaves; return GameMode.noWaves;
} }

View File

@ -134,15 +134,25 @@ public class SectorsDialog extends FloatingDialog{
Sector sector = world.sectors.get(sectorX, sectorY); Sector sector = world.sectors.get(sectorX, sectorY);
if(sector == null || sector.texture == null){ if(sector == null || sector.texture == null){
Draw.color(Color.DARK_GRAY); Draw.reset();
Draw.rect(Draw.getBlankRegion(), drawX, drawY, sectorSize + 1f, sectorSize + 1f); Draw.rect("empty-sector", drawX, drawY, sectorSize + 1f, sectorSize + 1f);
continue; continue;
} }
Draw.colorl(!sector.complete ? 0.3f : 1f); Draw.colorl(!sector.complete ? 0.3f : 1f);
Draw.rect(sector.texture, drawX, drawY, sectorSize + 1f, sectorSize + 1f); Draw.rect(sector.texture, drawX, drawY, sectorSize + 1f, sectorSize + 1f);
String region = "icon-mission-defense"; if(sector.missions.size == 0) continue;
Draw.color(Color.BLACK);
Draw.alpha(0.75f);
Draw.rect("icon-mission-background", drawX, drawY, Unit.dp.scl(18f * 5), Unit.dp.scl(18f * 5));
String region = sector.getDominantMission().getIcon();
if(sector.complete){
region = "icon-mission-done";
}
if(sector == selected){ if(sector == selected){
Draw.color(Color.WHITE); Draw.color(Color.WHITE);
@ -153,13 +163,12 @@ public class SectorsDialog extends FloatingDialog{
} }
Draw.color(Palette.remove); Draw.color(Palette.remove);
}else if(sector.complete){ }else if(sector.complete){
region = "icon-mission-done";
Draw.color(Palette.accent); Draw.color(Palette.accent);
}else{ }else{
Draw.color(Color.LIGHT_GRAY); Draw.color(Color.LIGHT_GRAY);
} }
float size = Unit.dp.scl(1f) * 10f * 5f; float size = Unit.dp.scl(10f * 5);
Shaders.outline.color = Color.BLACK; Shaders.outline.color = Color.BLACK;
Shaders.outline.region = Draw.region(region); Shaders.outline.region = Draw.region(region);