Minor cleanup

This commit is contained in:
Anuken 2020-04-08 10:54:45 -04:00
parent 7b25b09c18
commit a241d6f5bb
11 changed files with 21 additions and 25 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 KiB

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 285 KiB

After

Width:  |  Height:  |  Size: 284 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 KiB

After

Width:  |  Height:  |  Size: 228 KiB

View File

@ -68,20 +68,6 @@ public enum Gamemode{
this.validator = validator;
}
public static Gamemode bestFit(Rules rules){
if(rules.pvp){
return pvp;
}else if(rules.editor){
return editor;
}else if(rules.attackMode){
return attack;
}else if(rules.infiniteResources){
return sandbox;
}else{
return survival;
}
}
/** Applies this preset to this ruleset. */
public Rules apply(Rules in){
rules.get(in);

View File

@ -61,7 +61,7 @@ public class Rules{
public float launchWaveMultiplier = 2f;
/** Sector for saves that have them.*/
public @Nullable Sector sector;
/** Region that save is on. Indicates campaign. */
/** Region that save is on. Indicates campaign. TODO not implemented. */
public @Nullable MapRegion region;
/** Spawn layout. */
public Array<SpawnGroup> spawns = new Array<>();
@ -107,6 +107,16 @@ public class Rules{
/** Returns the gamemode that best fits these rules.*/
public Gamemode mode(){
return Gamemode.bestFit(this);
if(pvp){
return Gamemode.pvp;
}else if(editor){
return Gamemode.editor;
}else if(attackMode){
return Gamemode.attack;
}else if(infiniteResources){
return Gamemode.sandbox;
}else{
return Gamemode.survival;
}
}
}

View File

@ -291,7 +291,7 @@ public class Saves{
}
public Gamemode mode(){
return Gamemode.bestFit(meta.rules);
return meta.rules.mode();
}
public int getBuild(){

View File

@ -77,7 +77,7 @@ public class NetworkIO{
buffer.putInt(Version.build);
writeString(buffer, Version.type);
buffer.put((byte)Gamemode.bestFit(state.rules).ordinal());
buffer.put((byte)state.rules.mode().ordinal());
buffer.putInt(netServer.admins.getPlayerLimit());
writeString(buffer, description, 100);

View File

@ -289,7 +289,6 @@ public class PlanetDialog extends FloatingDialog{
if(selected != null){
drawSelection(selected);
drawBorders(selected, borderColor);
}
batch.flush(Gl.triangles);

View File

@ -5,6 +5,7 @@ import mindustry.world.*;
//do not use in mods!
public class ShallowLiquid extends Floor{
public final Floor liquidBase, floorBase;
public float liquidOpacity = 0.35f;
public ShallowLiquid(String name, Block liquid, Block floor){
super(name);
@ -13,9 +14,9 @@ public class ShallowLiquid extends Floor{
this.floorBase = floor.asFloor();
isLiquid = true;
variants = floor.asFloor().variants;
status = liquid.asFloor().status;
liquidDrop = liquid.asFloor().liquidDrop;
cacheLayer = liquid.asFloor().cacheLayer;
variants = floorBase.variants;
status = liquidBase.status;
liquidDrop = liquidBase.liquidDrop;
cacheLayer = liquidBase.cacheLayer;
}
}

View File

@ -348,7 +348,7 @@ public class SNet implements SteamNetworkingCallback, SteamMatchmakingCallback,
smat.setLobbyData(steamID, "version", Version.build + "");
smat.setLobbyData(steamID, "versionType", Version.type);
smat.setLobbyData(steamID, "wave", state.wave + "");
smat.setLobbyData(steamID, "gamemode", Gamemode.bestFit(state.rules).name() + "");
smat.setLobbyData(steamID, "gamemode", state.rules.mode().name() + "");
}
}

View File

@ -180,7 +180,7 @@ public class Generators{
res.draw(ImagePacker.get(region));
for(int x = 0; x < res.width; x++){
for(int y = 0; y < res.height; y++){
Color color = overlay.getColor(x, y).a(0.3f);
Color color = overlay.getColor(x, y).a(floor.liquidOpacity);
res.draw(x, y, color);
}
}