Lock state implementation
This commit is contained in:
@@ -143,7 +143,7 @@ public class SaveIO{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Loads from a deflated (!) input stream.*/
|
/** Loads from a deflated (!) input stream. */
|
||||||
public static void load(InputStream is, WorldContext context) throws SaveException{
|
public static void load(InputStream is, WorldContext context) throws SaveException{
|
||||||
try(CounterInputStream counter = new CounterInputStream(is); DataInputStream stream = new DataInputStream(counter)){
|
try(CounterInputStream counter = new CounterInputStream(is); DataInputStream stream = new DataInputStream(counter)){
|
||||||
logic.reset();
|
logic.reset();
|
||||||
|
|||||||
@@ -38,7 +38,9 @@ public class TODOPlanetGenerator extends PlanetGenerator{
|
|||||||
|
|
||||||
ObjectMap<Block, Block> dec = ObjectMap.of(
|
ObjectMap<Block, Block> dec = ObjectMap.of(
|
||||||
Blocks.sporeMoss, Blocks.sporeCluster,
|
Blocks.sporeMoss, Blocks.sporeCluster,
|
||||||
Blocks.moss, Blocks.sporeCluster
|
Blocks.moss, Blocks.sporeCluster,
|
||||||
|
Blocks.taintedWater, Blocks.water,
|
||||||
|
Blocks.darksandTaintedWater, Blocks.darksandWater
|
||||||
);
|
);
|
||||||
|
|
||||||
ObjectMap<Block, Block> tars = ObjectMap.of(
|
ObjectMap<Block, Block> tars = ObjectMap.of(
|
||||||
|
|||||||
@@ -43,6 +43,13 @@ public class Sector{
|
|||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return whether this sector can be landed on at all.
|
||||||
|
* Only sectors adjacent to non-wave sectors can be landed on.
|
||||||
|
* TODO also preset sectors*/
|
||||||
|
public boolean unlocked(){
|
||||||
|
return Structs.contains(tile.tiles, p -> planet.getSector(p).isCaptured()) || (preset != null && preset.unlocked());
|
||||||
|
}
|
||||||
|
|
||||||
/** @return whether the player has a base here. */
|
/** @return whether the player has a base here. */
|
||||||
public boolean hasBase(){
|
public boolean hasBase(){
|
||||||
return save != null && !save.meta.tags.getBool("nocores");
|
return save != null && !save.meta.tags.getBool("nocores");
|
||||||
@@ -58,6 +65,10 @@ public class Sector{
|
|||||||
return Vars.state.isGame() && Vars.state.rules.sector == this && !Vars.state.launched && !Vars.state.gameOver;
|
return Vars.state.isGame() && Vars.state.rules.sector == this && !Vars.state.launched && !Vars.state.gameOver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isCaptured(){
|
||||||
|
return save != null && !save.meta.rules.waves;
|
||||||
|
}
|
||||||
|
|
||||||
/** @return whether waves are present - if true, any bases here will be attacked. */
|
/** @return whether waves are present - if true, any bases here will be attacked. */
|
||||||
public boolean hasWaves(){
|
public boolean hasWaves(){
|
||||||
return save != null && save.meta.rules.waves;
|
return save != null && save.meta.rules.waves;
|
||||||
@@ -73,7 +84,7 @@ public class Sector{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean locked(){
|
public boolean locked(){
|
||||||
return !unlocked;
|
return !unlocked();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return light dot product in the range [0, 1]. */
|
/** @return light dot product in the range [0, 1]. */
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import mindustry.maps.generators.*;
|
|||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
//TODO ? remove ?
|
|
||||||
public class SectorPreset extends UnlockableContent{
|
public class SectorPreset extends UnlockableContent{
|
||||||
public @NonNull FileMapGenerator generator;
|
public @NonNull FileMapGenerator generator;
|
||||||
public @NonNull Planet planet;
|
public @NonNull Planet planet;
|
||||||
@@ -41,12 +40,6 @@ public class SectorPreset extends UnlockableContent{
|
|||||||
planet.preset(sector, this);
|
planet.preset(sector, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO
|
|
||||||
/*
|
|
||||||
public SectorPreset(String name){
|
|
||||||
this(name, Planets.starter);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public Rules getRules(){
|
public Rules getRules(){
|
||||||
return generator.map.rules();
|
return generator.map.rules();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -280,18 +280,19 @@ public class PlanetDialog extends FloatingDialog{
|
|||||||
batch.proj().mul(planet.getTransform(mat));
|
batch.proj().mul(planet.getTransform(mat));
|
||||||
|
|
||||||
for(Sector sec : planet.sectors){
|
for(Sector sec : planet.sectors){
|
||||||
if(sec.locked()){
|
|
||||||
draw(sec, shadowColor, -0.001f);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(selectAlpha > 0.01f){
|
if(selectAlpha > 0.01f){
|
||||||
float stroke = 0.026f;
|
if(sec.unlocked()){
|
||||||
if(sec.hasBase()){
|
float stroke = 0.026f;
|
||||||
drawSelection(sec, Tmp.c1.set(Team.sharded.color).mul(0.8f).a(selectAlpha), stroke, -0.01f);
|
if(sec.hasBase()){
|
||||||
}else if(sec.preset != null){
|
drawSelection(sec, Tmp.c1.set(Team.sharded.color).mul(0.8f).a(selectAlpha), stroke, -0.005f);
|
||||||
drawSelection(sec, Tmp.c1.set(Team.derelict.color).mul(0.8f).a(selectAlpha), stroke, -0.02f);
|
}else if(sec.preset != null){
|
||||||
}else if(sec.hasEnemyBase()){
|
drawSelection(sec, Tmp.c1.set(Team.derelict.color).mul(0.8f).a(selectAlpha), stroke, -0.005f);
|
||||||
drawSelection(sec, Tmp.c1.set(Team.crux.color).mul(0.8f).a(selectAlpha), stroke, -0.02f);
|
}else if(sec.hasEnemyBase()){
|
||||||
|
drawSelection(sec, Tmp.c1.set(Team.crux.color).mul(0.8f).a(selectAlpha), stroke, -0.005f);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
draw(sec, Tmp.c1.set(shadowColor).mul(1, 1, 1, selectAlpha), -0.001f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -309,13 +310,13 @@ public class PlanetDialog extends FloatingDialog{
|
|||||||
batch.flush(Gl.triangles);
|
batch.flush(Gl.triangles);
|
||||||
|
|
||||||
//render arcs
|
//render arcs
|
||||||
for(Sector sec : planet.sectors){
|
if(selected != null && selected.preset != null){
|
||||||
if(sec.preset != null){
|
for(Objective o : selected.preset.requirements){
|
||||||
for(Objective o : sec.preset.requirements){
|
if(o instanceof ZoneObjective){
|
||||||
if(o instanceof ZoneObjective){
|
SectorPreset preset = ((ZoneObjective)o).preset;
|
||||||
SectorPreset preset = ((ZoneObjective)o).preset;
|
|
||||||
|
|
||||||
drawArc(planet, sec.tile.v, preset.sector.tile.v);
|
if(true){
|
||||||
|
drawArc(planet, selected.tile.v, preset.sector.tile.v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -341,11 +342,12 @@ public class PlanetDialog extends FloatingDialog{
|
|||||||
points.clear();
|
points.clear();
|
||||||
points.addAll(Tmp.v33.set(a).setLength(outlineRad), Tmp.v31, Tmp.v34.set(b).setLength(outlineRad));
|
points.addAll(Tmp.v33.set(a).setLength(outlineRad), Tmp.v31, Tmp.v34.set(b).setLength(outlineRad));
|
||||||
Tmp.bz3.set(points);
|
Tmp.bz3.set(points);
|
||||||
float points = 20;
|
float points = 25;
|
||||||
|
|
||||||
for(int i = 0; i < points + 1; i++){
|
for(int i = 0; i < points + 1; i++){
|
||||||
float f = i / points;
|
float f = i / points;
|
||||||
batch.color(Pal.accent);
|
Tmp.c1.set(Pal.accent).lerp(Color.clear, (f+Time.globalTime()/80f)%1f);
|
||||||
|
batch.color(Tmp.c1);
|
||||||
batch.vertex(Tmp.bz3.valueAt(Tmp.v32, f));
|
batch.vertex(Tmp.bz3.valueAt(Tmp.v32, f));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
org.gradle.daemon=true
|
org.gradle.daemon=true
|
||||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||||
archash=41fc7758d3853b18fdeb2e4c657a99895f44e721
|
archash=1cfb465e0113f6eeb17a831d561885ca0b34fa68
|
||||||
|
|||||||
Reference in New Issue
Block a user