mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-10-03 03:31:28 +03:00
Fixed bugs related to invalid overlay floors + map colors
This commit is contained in:
@@ -340,6 +340,7 @@ public class Blocks{
|
||||
variants = 0;
|
||||
canShadow = false;
|
||||
drawEdgeOut = false;
|
||||
supportsBeingOverlaid = false;
|
||||
}};
|
||||
|
||||
empty = new EmptyFloor("empty");
|
||||
|
||||
@@ -114,7 +114,7 @@ public class EditorTile extends Tile{
|
||||
return;
|
||||
}
|
||||
|
||||
if(!floor.hasSurface() && overlay.asFloor().needsSurface && (overlay instanceof OreBlock || !floor.supportsOverlay)) return;
|
||||
if(!floor.hasSurface() && overlay.asFloor().needsSurface && (overlay instanceof OreBlock || !floor.supportsOverlay || !overlay.asFloor().supportsBeingOverlaid)) return;
|
||||
if(this.overlay == overlay) return;
|
||||
op(DrawOperation.opOverlay, this.overlay.id);
|
||||
super.setOverlay(overlay);
|
||||
|
||||
@@ -106,6 +106,7 @@ public class MapIO{
|
||||
}
|
||||
};
|
||||
|
||||
//version 12 has content patches here, version 11 has them after the content header
|
||||
if(ver.version >= 12) ver.skipChunk(stream);
|
||||
ver.readRegion("content", stream, counter, MapIO::readPreviewContentHeader);
|
||||
if(ver.version == 11) ver.skipChunk(stream);
|
||||
@@ -149,11 +150,8 @@ public class MapIO{
|
||||
|
||||
@Override
|
||||
public Tile create(int x, int y, int floorID, int overlayID, int wallID){
|
||||
if(overlayID != 0){
|
||||
floors.set(x, floors.height - 1 - y, colorFor(Blocks.air, Blocks.air, content.block(overlayID), Team.derelict));
|
||||
}else{
|
||||
floors.set(x, floors.height - 1 - y, colorFor(Blocks.air, content.block(floorID), Blocks.air, Team.derelict));
|
||||
}
|
||||
floors.set(x, floors.height - 1 - y, colorFor(Blocks.air, content.block(floorID), content.block(overlayID), Team.derelict));
|
||||
|
||||
if(content.block(overlayID) == Blocks.spawn){
|
||||
map.spawns ++;
|
||||
}
|
||||
@@ -234,7 +232,8 @@ public class MapIO{
|
||||
if(wall.synthetic()){
|
||||
return team.color.rgba();
|
||||
}
|
||||
return (((Floor)overlay).wallOre ? overlay.mapColor : wall.solid ? wall.mapColor : !overlay.useColor ? floor.mapColor : overlay.mapColor).rgba();
|
||||
return (((Floor)overlay).wallOre ? overlay.mapColor.rgba() : wall.solid ? wall.mapColor.rgba() : !overlay.useColor ? floor.mapColor.rgba() :
|
||||
(!(overlay instanceof OverlayFloor) ? Pixmap.blend((overlay.mapColor.rgba() & ~0xff) | 128, floor.mapColor.rgba()) : overlay.mapColor.rgba()));
|
||||
}
|
||||
|
||||
public static Pixmap writeImage(Tiles tiles){
|
||||
|
||||
@@ -525,7 +525,7 @@ public abstract class SaveVersion extends SaveFileReader{
|
||||
|
||||
public Prov[] readEntityMapping(DataInput stream) throws IOException{
|
||||
//copy entityMapping for further mutation; will be used in readWorldEntities
|
||||
Prov[] entityMapping = Arrays.copyOf(EntityMapping.idMap, EntityMapping.idMap.length);
|
||||
var entityMapping = Arrays.copyOf(EntityMapping.idMap, EntityMapping.idMap.length);
|
||||
|
||||
short amount = stream.readShort();
|
||||
for(int i = 0; i < amount; i++){
|
||||
|
||||
@@ -42,12 +42,14 @@ public class NetworkIO{
|
||||
}
|
||||
}
|
||||
|
||||
var writer = SaveIO.getSaveWriter();
|
||||
|
||||
//data patches must be first, as rules can involve patched content
|
||||
SaveIO.getSaveWriter().writeDataPatches(stream, false);
|
||||
writer.writeDataPatches(stream, false);
|
||||
|
||||
stream.writeUTF(JsonIO.write(state.rules));
|
||||
stream.writeUTF(JsonIO.write(state.mapLocales));
|
||||
SaveIO.getSaveWriter().writeStringMap(stream, state.map.tags);
|
||||
writer.writeStringMap(stream, state.map.tags);
|
||||
|
||||
stream.writeInt(state.wave);
|
||||
stream.writeFloat(state.wavetime);
|
||||
@@ -58,12 +60,12 @@ public class NetworkIO{
|
||||
stream.writeInt(player.id);
|
||||
player.write(new Writes(stream));
|
||||
|
||||
SaveIO.getSaveWriter().writeContentHeader(stream);
|
||||
SaveIO.getSaveWriter().writeMap(stream);
|
||||
SaveIO.getSaveWriter().writeEntities(stream);
|
||||
SaveIO.getSaveWriter().writeTeamBlocks(stream);
|
||||
SaveIO.getSaveWriter().writeMarkers(stream);
|
||||
SaveIO.getSaveWriter().writeCustomChunks(stream, true);
|
||||
writer.writeContentHeader(stream);
|
||||
writer.writeMap(stream);
|
||||
writer.writeEntities(stream);
|
||||
writer.writeTeamBlocks(stream);
|
||||
writer.writeMarkers(stream);
|
||||
writer.writeCustomChunks(stream, true);
|
||||
}catch(IOException e){
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@@ -72,12 +74,13 @@ public class NetworkIO{
|
||||
public static void loadWorld(InputStream is){
|
||||
|
||||
try(DataInputStream stream = new DataInputStream(is)){
|
||||
var writer = SaveIO.getSaveWriter();
|
||||
Time.clear();
|
||||
SaveIO.getSaveWriter().readDataPatches(stream, new SaveReadState(world.context));
|
||||
writer.readDataPatches(stream, new SaveReadState(world.context));
|
||||
|
||||
state.rules = JsonIO.read(Rules.class, stream.readUTF());
|
||||
state.mapLocales = JsonIO.read(MapLocales.class, stream.readUTF());
|
||||
state.map = new Map(SaveIO.getSaveWriter().readStringMap(stream));
|
||||
state.map = new Map(writer.readStringMap(stream));
|
||||
|
||||
state.wave = stream.readInt();
|
||||
state.wavetime = stream.readFloat();
|
||||
@@ -96,12 +99,12 @@ public class NetworkIO{
|
||||
|
||||
var state = new SaveReadState(world.context);
|
||||
|
||||
SaveIO.getSaveWriter().readContentHeader(stream);
|
||||
SaveIO.getSaveWriter().readMap(stream, state);
|
||||
SaveIO.getSaveWriter().readEntities(stream, state);
|
||||
SaveIO.getSaveWriter().readTeamBlocks(stream);
|
||||
SaveIO.getSaveWriter().readMarkers(stream);
|
||||
SaveIO.getSaveWriter().readCustomChunks(stream);
|
||||
writer.readContentHeader(stream);
|
||||
writer.readMap(stream, state);
|
||||
writer.readEntities(stream, state);
|
||||
writer.readTeamBlocks(stream);
|
||||
writer.readMarkers(stream);
|
||||
writer.readCustomChunks(stream);
|
||||
}catch(IOException e){
|
||||
throw new RuntimeException(e);
|
||||
}finally{
|
||||
|
||||
@@ -13,6 +13,7 @@ public class EmptyFloor extends Floor{
|
||||
placeableOn = false;
|
||||
solid = true;
|
||||
drawEdgeOut = false;
|
||||
supportsBeingOverlaid = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -54,6 +54,8 @@ public class Floor extends Block{
|
||||
public float overlayAlpha = 0.65f;
|
||||
/** whether this floor supports an overlay floor */
|
||||
public boolean supportsOverlay = false;
|
||||
/** if false, this floor can't be used as an overlay (liquid underlay), even if the floor it's placed on supports it */
|
||||
public boolean supportsBeingOverlaid = true;
|
||||
/** shallow water flag used for generation */
|
||||
public boolean shallow = false;
|
||||
/** Group of blocks that this block does not draw edges on. */
|
||||
|
||||
@@ -31,7 +31,7 @@ public class NuclearReactor extends PowerGenerator{
|
||||
/** heating per frame * fullness */
|
||||
public float heating = 0.01f;
|
||||
/** max heat this block can output per side */
|
||||
public float heatOutput = 12f;
|
||||
public float heatOutput = 8f;
|
||||
/** rate at which heat progress increases */
|
||||
public float heatWarmupRate = 1f;
|
||||
/** rate at which fuel consumption scales with heat */
|
||||
|
||||
Reference in New Issue
Block a user