mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-11 11:17:11 +07:00
Fixed puddle/IO crash / crafter storage / player NaN position / red tint
This commit is contained in:
parent
59ec09e82c
commit
f8ddc8325c
@ -132,6 +132,8 @@ public class Renderer extends RendererModule{
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
//TODO hack, find source of this bug
|
||||
Color.WHITE.set(1f, 1f, 1f, 1f);
|
||||
|
||||
if(Core.cameraScale != targetscale){
|
||||
float targetzoom = (float) Core.cameraScale / targetscale;
|
||||
|
@ -441,6 +441,13 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
public void update(){
|
||||
hitTime = Math.max(0f, hitTime - Timers.delta());
|
||||
|
||||
if(Float.isNaN(x) || Float.isNaN(y)){
|
||||
TileEntity core = getClosestCore();
|
||||
if(core != null){
|
||||
set(core.x, core.y);
|
||||
}
|
||||
}
|
||||
|
||||
if(isDead()){
|
||||
isBoosting = false;
|
||||
boostHeat = 0f;
|
||||
|
@ -179,7 +179,7 @@ public class Puddle extends BaseEntity implements SaveTrait, Poolable, DrawTrait
|
||||
float deposited = Math.min((amount - maxLiquid / 1.5f) / 4f, 0.3f) * Timers.delta();
|
||||
for(GridPoint2 point : Geometry.d4){
|
||||
Tile other = world.tile(tile.x + point.x, tile.y + point.y);
|
||||
if(other.block() == Blocks.air && !other.hasCliffs()){
|
||||
if(other != null && other.block() == Blocks.air && !other.hasCliffs()){
|
||||
deposit(other, tile, liquid, deposited, generation + 1);
|
||||
amount -= deposited / 2f; //tweak to speed up/slow down puddle propagation
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public class TypeIO{
|
||||
|
||||
@WriteClass(CarryTrait.class)
|
||||
public static void writeCarry(ByteBuffer buffer, CarryTrait unit){
|
||||
if(unit == null){
|
||||
if(unit == null || unit.getGroup() == null){
|
||||
buffer.put((byte) -1);
|
||||
return;
|
||||
}
|
||||
|
@ -65,13 +65,13 @@ public class BlocksFragment extends Fragment{
|
||||
|
||||
//add top description table
|
||||
descTable = new Table("button");
|
||||
descTable.visible(() -> hoverRecipe != null || input.recipe != null); //make sure it's visible when necessary
|
||||
descTable.visible(() -> (hoverRecipe != null || input.recipe != null) && shown); //make sure it's visible when necessary
|
||||
descTable.update(() -> {
|
||||
// note: This is required because there is no direct connection between input.recipe and the description ui.
|
||||
// If input.recipe gets set to null, a proper cleanup of the ui elements is required.
|
||||
boolean anyRecipeShown = input.recipe != null || hoverRecipe != null;
|
||||
boolean descriptionTableClean = descTable.getChildren().size == 0;
|
||||
boolean cleanupRequired = !anyRecipeShown && !descriptionTableClean;
|
||||
boolean cleanupRequired = (!anyRecipeShown && !descriptionTableClean);
|
||||
if(cleanupRequired){
|
||||
descTable.clear();
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ public class GenericCrafter extends Block{
|
||||
public void update(Tile tile){
|
||||
GenericCrafterEntity entity = tile.entity();
|
||||
|
||||
if(entity.cons.valid()){
|
||||
if(entity.cons.valid() && tile.entity.items.get(output) < itemCapacity){
|
||||
|
||||
entity.progress += 1f / craftTime * Timers.delta();
|
||||
entity.totalProgress += Timers.delta();
|
||||
|
Loading…
Reference in New Issue
Block a user