mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-13 17:27:35 +07:00
Minor cleanup
This commit is contained in:
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 |
@ -68,20 +68,6 @@ public enum Gamemode{
|
|||||||
this.validator = validator;
|
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. */
|
/** Applies this preset to this ruleset. */
|
||||||
public Rules apply(Rules in){
|
public Rules apply(Rules in){
|
||||||
rules.get(in);
|
rules.get(in);
|
||||||
|
@ -61,7 +61,7 @@ public class Rules{
|
|||||||
public float launchWaveMultiplier = 2f;
|
public float launchWaveMultiplier = 2f;
|
||||||
/** Sector for saves that have them.*/
|
/** Sector for saves that have them.*/
|
||||||
public @Nullable Sector sector;
|
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;
|
public @Nullable MapRegion region;
|
||||||
/** Spawn layout. */
|
/** Spawn layout. */
|
||||||
public Array<SpawnGroup> spawns = new Array<>();
|
public Array<SpawnGroup> spawns = new Array<>();
|
||||||
@ -107,6 +107,16 @@ public class Rules{
|
|||||||
|
|
||||||
/** Returns the gamemode that best fits these rules.*/
|
/** Returns the gamemode that best fits these rules.*/
|
||||||
public Gamemode mode(){
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -291,7 +291,7 @@ public class Saves{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Gamemode mode(){
|
public Gamemode mode(){
|
||||||
return Gamemode.bestFit(meta.rules);
|
return meta.rules.mode();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getBuild(){
|
public int getBuild(){
|
||||||
|
@ -77,7 +77,7 @@ public class NetworkIO{
|
|||||||
buffer.putInt(Version.build);
|
buffer.putInt(Version.build);
|
||||||
writeString(buffer, Version.type);
|
writeString(buffer, Version.type);
|
||||||
|
|
||||||
buffer.put((byte)Gamemode.bestFit(state.rules).ordinal());
|
buffer.put((byte)state.rules.mode().ordinal());
|
||||||
buffer.putInt(netServer.admins.getPlayerLimit());
|
buffer.putInt(netServer.admins.getPlayerLimit());
|
||||||
|
|
||||||
writeString(buffer, description, 100);
|
writeString(buffer, description, 100);
|
||||||
|
@ -289,7 +289,6 @@ public class PlanetDialog extends FloatingDialog{
|
|||||||
if(selected != null){
|
if(selected != null){
|
||||||
drawSelection(selected);
|
drawSelection(selected);
|
||||||
drawBorders(selected, borderColor);
|
drawBorders(selected, borderColor);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
batch.flush(Gl.triangles);
|
batch.flush(Gl.triangles);
|
||||||
|
@ -5,6 +5,7 @@ import mindustry.world.*;
|
|||||||
//do not use in mods!
|
//do not use in mods!
|
||||||
public class ShallowLiquid extends Floor{
|
public class ShallowLiquid extends Floor{
|
||||||
public final Floor liquidBase, floorBase;
|
public final Floor liquidBase, floorBase;
|
||||||
|
public float liquidOpacity = 0.35f;
|
||||||
|
|
||||||
public ShallowLiquid(String name, Block liquid, Block floor){
|
public ShallowLiquid(String name, Block liquid, Block floor){
|
||||||
super(name);
|
super(name);
|
||||||
@ -13,9 +14,9 @@ public class ShallowLiquid extends Floor{
|
|||||||
this.floorBase = floor.asFloor();
|
this.floorBase = floor.asFloor();
|
||||||
|
|
||||||
isLiquid = true;
|
isLiquid = true;
|
||||||
variants = floor.asFloor().variants;
|
variants = floorBase.variants;
|
||||||
status = liquid.asFloor().status;
|
status = liquidBase.status;
|
||||||
liquidDrop = liquid.asFloor().liquidDrop;
|
liquidDrop = liquidBase.liquidDrop;
|
||||||
cacheLayer = liquid.asFloor().cacheLayer;
|
cacheLayer = liquidBase.cacheLayer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -348,7 +348,7 @@ public class SNet implements SteamNetworkingCallback, SteamMatchmakingCallback,
|
|||||||
smat.setLobbyData(steamID, "version", Version.build + "");
|
smat.setLobbyData(steamID, "version", Version.build + "");
|
||||||
smat.setLobbyData(steamID, "versionType", Version.type);
|
smat.setLobbyData(steamID, "versionType", Version.type);
|
||||||
smat.setLobbyData(steamID, "wave", state.wave + "");
|
smat.setLobbyData(steamID, "wave", state.wave + "");
|
||||||
smat.setLobbyData(steamID, "gamemode", Gamemode.bestFit(state.rules).name() + "");
|
smat.setLobbyData(steamID, "gamemode", state.rules.mode().name() + "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ public class Generators{
|
|||||||
res.draw(ImagePacker.get(region));
|
res.draw(ImagePacker.get(region));
|
||||||
for(int x = 0; x < res.width; x++){
|
for(int x = 0; x < res.width; x++){
|
||||||
for(int y = 0; y < res.height; y++){
|
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);
|
res.draw(x, y, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user