From fed3bcd79dbc126508c6937c89f4e11f3b280bc6 Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 20 Sep 2019 23:21:43 -0400 Subject: [PATCH] Cleanup --- core/src/io/anuke/mindustry/content/Blocks.java | 5 ++++- .../io/anuke/mindustry/entities/type/BaseUnit.java | 2 +- .../anuke/mindustry/entities/type/FlyingUnit.java | 4 ++-- .../anuke/mindustry/entities/type/GroundUnit.java | 13 ++++++++++--- gradle.properties | 2 +- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/core/src/io/anuke/mindustry/content/Blocks.java b/core/src/io/anuke/mindustry/content/Blocks.java index aca15957ac..17377204c5 100644 --- a/core/src/io/anuke/mindustry/content/Blocks.java +++ b/core/src/io/anuke/mindustry/content/Blocks.java @@ -1,6 +1,7 @@ package io.anuke.mindustry.content; import io.anuke.arc.*; +import io.anuke.arc.collection.*; import io.anuke.arc.graphics.*; import io.anuke.arc.graphics.g2d.*; import io.anuke.arc.math.*; @@ -1646,12 +1647,14 @@ public class Blocks implements ContentList{ commandCenter = new CommandCenter("command-center"){{ requirements(Category.units, ItemStack.with(Items.copper, 200, Items.lead, 250, Items.silicon, 250, Items.graphite, 100)); + flags = EnumSet.of(BlockFlag.rally, BlockFlag.comandCenter); size = 2; health = size * size * 55; }}; + //TODO unused, but may be useful later rallyPoint = new RallyPoint("rally-point"){{ - requirements(Category.units, ItemStack.with(Items.lead, 100, Items.silicon, 100, Items.graphite, 50)); + //requirements(Category.units, ItemStack.with(Items.lead, 100, Items.silicon, 100, Items.graphite, 50)); size = 2; health = size * size * 85; }}; diff --git a/core/src/io/anuke/mindustry/entities/type/BaseUnit.java b/core/src/io/anuke/mindustry/entities/type/BaseUnit.java index daf9fbad94..00a9022c4c 100644 --- a/core/src/io/anuke/mindustry/entities/type/BaseUnit.java +++ b/core/src/io/anuke/mindustry/entities/type/BaseUnit.java @@ -100,7 +100,7 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{ return indexer.getAllied(team, BlockFlag.comandCenter).size != 0 && indexer.getAllied(team, BlockFlag.comandCenter).first().entity instanceof CommandCenterEntity; } - public UnitCommand getCommand(){ + public @Nullable UnitCommand getCommand(){ if(isCommanded()){ return indexer.getAllied(team, BlockFlag.comandCenter).first().entity().command; } diff --git a/core/src/io/anuke/mindustry/entities/type/FlyingUnit.java b/core/src/io/anuke/mindustry/entities/type/FlyingUnit.java index 730ca5d4a0..ce83657c5e 100644 --- a/core/src/io/anuke/mindustry/entities/type/FlyingUnit.java +++ b/core/src/io/anuke/mindustry/entities/type/FlyingUnit.java @@ -69,7 +69,7 @@ public abstract class FlyingUnit extends BaseUnit{ } }else{ target = getClosestSpawner(); - moveTo(Vars.state.rules.dropZoneRadius + 80f); + moveTo(Vars.state.rules.dropZoneRadius + 120f); } } }, @@ -88,7 +88,7 @@ public abstract class FlyingUnit extends BaseUnit{ } if(target != null){ - circle(80f + Mathf.randomSeed(id) * 120); + circle(65f + Mathf.randomSeed(id) * 100); } } }, diff --git a/core/src/io/anuke/mindustry/entities/type/GroundUnit.java b/core/src/io/anuke/mindustry/entities/type/GroundUnit.java index c6e263d168..ddb33a2662 100644 --- a/core/src/io/anuke/mindustry/entities/type/GroundUnit.java +++ b/core/src/io/anuke/mindustry/entities/type/GroundUnit.java @@ -37,7 +37,7 @@ public abstract class GroundUnit extends BaseUnit{ if(core == null){ Tile closestSpawn = getClosestSpawner(); - if(closestSpawn == null || !withinDst(closestSpawn, Vars.state.rules.dropZoneRadius + 75f)){ + if(closestSpawn == null || !withinDst(closestSpawn, Vars.state.rules.dropZoneRadius + 85f)){ moveToCore(PathTarget.enemyCores); } }else{ @@ -58,7 +58,7 @@ public abstract class GroundUnit extends BaseUnit{ public void update(){ Tile target = getClosest(BlockFlag.rally); - if(target != null && dst(target) > 100f){ + if(target != null && dst(target) > 80f){ moveToCore(PathTarget.rallyPoints); } } @@ -243,11 +243,18 @@ public abstract class GroundUnit extends BaseUnit{ } } + if(enemy == null){ + for(Team team : Vars.state.teams.enemiesOf(team)){ + enemy = team; + break; + } + } + if(enemy == null) return; Tile tile = world.tileWorld(x, y); if(tile == null) return; - Tile targetTile = pathfinder.getTargetTile(tile, team, PathTarget.enemyCores); + Tile targetTile = pathfinder.getTargetTile(tile, enemy, PathTarget.enemyCores); TileEntity core = getClosestCore(); if(tile == targetTile || core == null || dst(core) < 120f) return; diff --git a/gradle.properties b/gradle.properties index f47982435b..97869cac97 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ org.gradle.daemon=true org.gradle.jvmargs=-Xms256m -Xmx1024m -archash=818e26ff093403031fcf31d3424dacb9c646d4b6 +archash=bac0b86ee98cd406cf6a227656ebf908f53119f9