From 7d2b7197d69127e0919105abaa629458c9b047cc Mon Sep 17 00:00:00 2001 From: Anuken Date: Wed, 29 Jul 2020 08:19:39 -0400 Subject: [PATCH] Fixed #2277 --- core/src/mindustry/content/Blocks.java | 2 +- core/src/mindustry/content/UnitTypes.java | 6 ++-- core/src/mindustry/content/Weathers.java | 9 ++++++ .../mindustry/entities/comp/BuildingComp.java | 2 +- core/src/mindustry/world/Block.java | 2 +- .../world/blocks/units/Reconstructor.java | 29 +++++++++++++++++++ 6 files changed, 44 insertions(+), 6 deletions(-) diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 000830230a..0f9a7c4178 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -1615,7 +1615,7 @@ public class Blocks implements ContentList{ Items.surgealloy, Bullets.fragSurge ); xRand = 4f; - reloadTime = 6f; + reloadTime = 8f; range = 200f; size = 3; recoilAmount = 3f; diff --git a/core/src/mindustry/content/UnitTypes.java b/core/src/mindustry/content/UnitTypes.java index 414eddac83..3e6f475a11 100644 --- a/core/src/mindustry/content/UnitTypes.java +++ b/core/src/mindustry/content/UnitTypes.java @@ -74,7 +74,7 @@ public class UnitTypes implements ContentList{ hitsize = 9f; range = 10f; health = 500; - armor = 3f; + armor = 4f; immunities.add(StatusEffects.burning); @@ -107,7 +107,7 @@ public class UnitTypes implements ContentList{ rotateSpeed = 3f; targetAir = false; health = 790; - armor = 8f; + armor = 9f; weapons.add(new Weapon("artillery"){{ y = 1f; @@ -478,7 +478,7 @@ public class UnitTypes implements ContentList{ range = 140f; hitsize = 18f; lowAltitude = true; - armor = 4f; + armor = 6f; engineOffset = 12f; engineSize = 3f; diff --git a/core/src/mindustry/content/Weathers.java b/core/src/mindustry/content/Weathers.java index d5b7699076..3781c498e7 100644 --- a/core/src/mindustry/content/Weathers.java +++ b/core/src/mindustry/content/Weathers.java @@ -249,6 +249,7 @@ public class Weathers implements ContentList{ TextureRegion region; float yspeed = 1f, xspeed = 4f, size = 5f, padding = size, invDensity = 2000f; Color color = Color.valueOf("7457ce"); + Vec2 force = new Vec2(0.25f, 0.01f); Texture noise; { @@ -264,6 +265,14 @@ public class Weathers implements ContentList{ noise.setFilter(TextureFilter.linear); } + @Override + public void update(WeatherState state){ + + for(Unit unit : Groups.unit){ + unit.impulse(force.x * state.intensity(), force.y * state.intensity()); + } + } + @Override public void dispose(){ noise.dispose(); diff --git a/core/src/mindustry/entities/comp/BuildingComp.java b/core/src/mindustry/entities/comp/BuildingComp.java index 621bad7959..f2b0831b30 100644 --- a/core/src/mindustry/entities/comp/BuildingComp.java +++ b/core/src/mindustry/entities/comp/BuildingComp.java @@ -265,7 +265,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, } public void rotation(int rotation){ - tile.rotation(rotation); + if(tile != null) tile.rotation(rotation); } public Floor floor(){ diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index 84b8817d7c..f04a2ead8e 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -215,7 +215,7 @@ public class Block extends UnlockableContent{ if(tile.build != null){ tile.build.draw(); }else{ - Draw.rect(region, tile.drawx(), tile.drawy(), rotate ? tile.rotation * 90 : 0); + Draw.rect(region, tile.drawx(), tile.drawy()); } } diff --git a/core/src/mindustry/world/blocks/units/Reconstructor.java b/core/src/mindustry/world/blocks/units/Reconstructor.java index 0920efbb00..643054be37 100644 --- a/core/src/mindustry/world/blocks/units/Reconstructor.java +++ b/core/src/mindustry/world/blocks/units/Reconstructor.java @@ -1,5 +1,6 @@ package mindustry.world.blocks.units; +import arc.*; import arc.graphics.g2d.*; import arc.math.*; import arc.util.*; @@ -41,7 +42,19 @@ public class Reconstructor extends UnitBlock{ @Override public void setBars(){ super.setBars(); + bars.add("progress", (ReconstructorEntity entity) -> new Bar("bar.progress", Pal.ammo, entity::fraction)); + bars.add("units", (ReconstructorEntity e) -> + new Bar( + () -> e.unit() == null ? "[lightgray]" + Iconc.cancel : + Core.bundle.format("bar.unitcap", + Fonts.getUnicodeStr(e.unit().name), + teamIndex.countType(e.team, e.unit()), + Units.getCap(e.team) + ), + () -> Pal.power, + () -> e.unit() == null ? 0f : (float)teamIndex.countType(e.team, e.unit()) / Units.getCap(e.team) + )); } @Override @@ -145,6 +158,22 @@ public class Reconstructor extends UnitBlock{ time += edelta() * speedScl * state.rules.unitBuildSpeedMultiplier; } + @Override + public boolean shouldConsume(){ + //do not consume when cap reached + if(constructing()){ + return Units.canCreate(team, upgrade(payload.unit.type())); + } + return false; + } + + public UnitType unit(){ + if(payload == null) return null; + + UnitType t = upgrade(payload.unit.type()); + return t != null && t.unlockedNow() ? t : null; + } + public boolean constructing(){ return payload != null && hasUpgrade(payload.unit.type()); }