diff --git a/core/src/mindustry/ai/types/BuilderAI.java b/core/src/mindustry/ai/types/BuilderAI.java index 31486988f9..b5ef6a3bf0 100644 --- a/core/src/mindustry/ai/types/BuilderAI.java +++ b/core/src/mindustry/ai/types/BuilderAI.java @@ -60,8 +60,6 @@ public class BuilderAI extends AIController{ blocks.removeFirst(); blocks.addLast(block); } - }else{ - //TODO implement AI base building } } } diff --git a/core/src/mindustry/content/Weathers.java b/core/src/mindustry/content/Weathers.java index dae26ddbe3..2ae14acdf3 100644 --- a/core/src/mindustry/content/Weathers.java +++ b/core/src/mindustry/content/Weathers.java @@ -169,6 +169,14 @@ public class Weathers implements ContentList{ region = Core.atlas.find("circle-shadow"); } + @Override + public void update(Weatherc state){ + + for(Unitc unit : Groups.unit){ + unit.impulse(force.x * state.intensity(), force.y * state.intensity()); + } + } + @Override public void drawOver(Weatherc state){ rand.setSeed(0); @@ -179,10 +187,6 @@ public class Weathers implements ContentList{ Draw.tint(color); float baseAlpha = Draw.getColor().a; - for(Unitc unit : Groups.unit){ - unit.impulse(force.x * state.intensity(), force.y * state.intensity()); - } - for(int i = 0; i < total; i++){ float scl = rand.random(0.5f, 1f); float scl2 = rand.random(0.5f, 1f); diff --git a/core/src/mindustry/core/Logic.java b/core/src/mindustry/core/Logic.java index fc10df0b9b..41518bdf6b 100644 --- a/core/src/mindustry/core/Logic.java +++ b/core/src/mindustry/core/Logic.java @@ -33,13 +33,6 @@ public class Logic implements ApplicationListener{ public Logic(){ - Events.on(WaveEvent.class, event -> { - if(state.isCampaign()){ - //TODO implement - //state.getSector().updateWave(state.wave); - } - }); - Events.on(BlockDestroyEvent.class, event -> { //blocks that get broken are appended to the team's broken block queue Tile tile = event.tile; diff --git a/core/src/mindustry/entities/comp/BulletComp.java b/core/src/mindustry/entities/comp/BulletComp.java index 70415cb415..934224b898 100644 --- a/core/src/mindustry/entities/comp/BulletComp.java +++ b/core/src/mindustry/entities/comp/BulletComp.java @@ -114,12 +114,16 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw if(tile == null) return false; if(tile.collide(this) && type.collides(this, tile) && !tile.dead() && (type.collidesTeam || tile.team() != team())){ + boolean remove = false; + if(tile.team() != team()){ - tile.collision(this); + remove = tile.collision(this); } - type.hitTile(this, tile); - remove(); + if(remove){ + type.hitTile(this, tile); + remove(); + } return true; } diff --git a/core/src/mindustry/entities/comp/TileComp.java b/core/src/mindustry/entities/comp/TileComp.java index 7f3f938c1b..5399ce9ab9 100644 --- a/core/src/mindustry/entities/comp/TileComp.java +++ b/core/src/mindustry/entities/comp/TileComp.java @@ -1046,8 +1046,12 @@ abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc, QuadTree return true; } - public void collision(Bulletc other){ + /** Handle a bullet collision. + * @return whether the bullet should be removed. */ + public boolean collision(Bulletc other){ damage(other.damage() * other.type().tileDamageMultiplier); + + return true; } public void removeFromProximity(){ diff --git a/core/src/mindustry/entities/units/AIController.java b/core/src/mindustry/entities/units/AIController.java index 7e72c3f950..02f07206f0 100644 --- a/core/src/mindustry/entities/units/AIController.java +++ b/core/src/mindustry/entities/units/AIController.java @@ -37,7 +37,6 @@ public class AIController implements UnitController{ } protected void targetClosest(){ - //TODO optimize! Teamc newTarget = Units.closestTarget(unit.team(), unit.x(), unit.y(), Math.max(unit.range(), unit.type().range), u -> (unit.type().targetAir && u.isFlying()) || (unit.type().targetGround && !u.isFlying())); if(newTarget != null){ target = newTarget; diff --git a/core/src/mindustry/entities/units/UnitController.java b/core/src/mindustry/entities/units/UnitController.java index 03b5d1b989..98e9be0ef6 100644 --- a/core/src/mindustry/entities/units/UnitController.java +++ b/core/src/mindustry/entities/units/UnitController.java @@ -2,7 +2,6 @@ package mindustry.entities.units; import mindustry.gen.*; -//TODO rename public interface UnitController{ void unit(Unitc unit); Unitc unit(); diff --git a/core/src/mindustry/mod/Mods.java b/core/src/mindustry/mod/Mods.java index 627836f414..6dcbae2ba5 100644 --- a/core/src/mindustry/mod/Mods.java +++ b/core/src/mindustry/mod/Mods.java @@ -335,7 +335,6 @@ public class Mods implements Loadable{ for(Fi file : mod.root.list()){ //ignore special folders like bundles or sprites if(file.isDirectory() && !specialFolders.contains(file.name())){ - //TODO calling child/parent on these files will give you gibberish; create wrapper class. file.walk(f -> tree.addFile(mod.file.isDirectory() ? f.path().substring(1 + mod.file.path().length()) : zipFolder ? f.path().substring(parentName.length() + 1) : f.path(), f)); } diff --git a/core/src/mindustry/ui/fragments/PlayerListFragment.java b/core/src/mindustry/ui/fragments/PlayerListFragment.java index 8da707fb00..66482d3fde 100644 --- a/core/src/mindustry/ui/fragments/PlayerListFragment.java +++ b/core/src/mindustry/ui/fragments/PlayerListFragment.java @@ -98,7 +98,6 @@ public class PlayerListFragment extends Fragment{ } }; table.margin(8); - //TODO dead players should have no region table.add(new Image(user.icon()).setScaling(Scaling.none)).grow(); button.add(table).size(h); diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index 454e85c8db..87a800c93e 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -175,7 +175,6 @@ public class Block extends UnlockableContent{ protected Prov entityType = null; //initialized later public ObjectMap, Cons2> configurations = new ObjectMap<>(); - //TODO move protected TextureRegion[] generatedIcons; protected TextureRegion[] variantRegions, editorVariantRegions; @@ -183,7 +182,6 @@ public class Block extends UnlockableContent{ public @Load("@-team") TextureRegion teamRegion; public TextureRegion[] teamRegions; - //TODO move public static TextureRegion[][] cracks; protected static final Seq tempTiles = new Seq<>(); protected static final Seq tempTileEnts = new Seq<>(); diff --git a/core/src/mindustry/world/blocks/defense/DeflectorWall.java b/core/src/mindustry/world/blocks/defense/DeflectorWall.java index 466000672c..1072cef4f1 100644 --- a/core/src/mindustry/world/blocks/defense/DeflectorWall.java +++ b/core/src/mindustry/world/blocks/defense/DeflectorWall.java @@ -40,23 +40,16 @@ public class DeflectorWall extends Wall{ } @Override - public void collision(Bulletc bullet){ + public boolean collision(Bulletc bullet){ super.collision(bullet); - //TODO fix and test //doesn't reflect powerful bullets - if(bullet.damage() > maxDamageDeflect) return; + if(bullet.damage() > maxDamageDeflect) return true; - float penX = Math.abs(getX() - bullet.x()), penY = Math.abs(getY() - bullet.y()); + //translate bullet back to where it was upon collision + bullet.trns(-bullet.vel().x, -bullet.vel().y); - bullet.hitbox(rect2); - - Vec2 position = Geometry.raycastRect(bullet.x() - bullet.vel().x*Time.delta(), bullet.y() - bullet.vel().y*Time.delta(), bullet.x() + bullet.vel().x*Time.delta(), bullet.y() + bullet.vel().y*Time.delta(), - rect.setSize(size * tilesize + rect2.width*2 + rect2.height*2).setCenter(getX(), getY())); - - if(position != null){ - bullet.set(position.x, position.y); - } + float penX = Math.abs(x - bullet.x()), penY = Math.abs(y - bullet.y()); if(penX > penY){ bullet.vel().x *= -1; @@ -64,14 +57,13 @@ public class DeflectorWall extends Wall{ bullet.vel().y *= -1; } - //bullet.updateVelocity(); bullet.owner(this); - bullet.team(team()); + bullet.team(team); bullet.time(bullet.time() + 1f); - //TODO deflect - //bullet.deflect(); hit = 1f; + + return false; } } } diff --git a/core/src/mindustry/world/blocks/defense/SurgeWall.java b/core/src/mindustry/world/blocks/defense/SurgeWall.java index f011735439..21b4b6959c 100644 --- a/core/src/mindustry/world/blocks/defense/SurgeWall.java +++ b/core/src/mindustry/world/blocks/defense/SurgeWall.java @@ -16,11 +16,13 @@ public class SurgeWall extends Wall{ public class SurgeEntity extends TileEntity{ @Override - public void collision(Bulletc bullet){ + public boolean collision(Bulletc bullet){ super.collision(bullet); if(Mathf.chance(lightningChance)){ Lightning.create(team(), Pal.surge, lightningDamage, x, y, bullet.rotation() + 180f, lightningLength); } + + return true; } } }