From 6c18634b0dafdba52c28a1d2fd3f3c256e08f590 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 29 Jun 2021 16:26:02 -0400 Subject: [PATCH] Minor logic unit rotation fix / Core capture unit derelict tareting --- core/src/mindustry/ai/BlockIndexer.java | 4 ++-- core/src/mindustry/ai/Pathfinder.java | 4 +++- core/src/mindustry/ai/types/LogicAI.java | 2 +- core/src/mindustry/game/Team.java | 2 +- core/src/mindustry/game/Teams.java | 11 +++-------- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/core/src/mindustry/ai/BlockIndexer.java b/core/src/mindustry/ai/BlockIndexer.java index 78ba4ccfb1..2fb2467437 100644 --- a/core/src/mindustry/ai/BlockIndexer.java +++ b/core/src/mindustry/ai/BlockIndexer.java @@ -285,7 +285,7 @@ public class BlockIndexer{ for(int i = 0; i < activeTeams.size; i++){ Team enemy = activeTeams.items[i]; - if(enemy == team || team == Team.derelict) continue; + if(enemy == team || (team == Team.derelict && !state.rules.coreCapture)) continue; Building entity = indexer.findTile(enemy, x, y, range, pred, true); if(entity != null){ @@ -360,7 +360,7 @@ public class BlockIndexer{ private void process(Tile tile){ var team = tile.team(); //only process entity changes with centered tiles - if(tile.isCenter() && team != Team.derelict){ + if(tile.isCenter() && tile.build != null){ var data = team.data(); if(tile.block().flags.size() > 0 && tile.isCenter()){ TileArray[] map = getFlagged(team); diff --git a/core/src/mindustry/ai/Pathfinder.java b/core/src/mindustry/ai/Pathfinder.java index 509ca0c03d..0fadcb970a 100644 --- a/core/src/mindustry/ai/Pathfinder.java +++ b/core/src/mindustry/ai/Pathfinder.java @@ -119,9 +119,11 @@ public class Pathfinder implements Runnable{ } } + int tid = tile.getTeamID(); + return PathTile.get( tile.build == null || !solid || tile.block() instanceof CoreBlock ? 0 : Math.min((int)(tile.build.health / 40), 80), - tile.getTeamID(), + tid == 0 && tile.build != null && state.rules.coreCapture ? 255 : tid, //use teamid = 255 when core capture is enabled to mark out derelict structures solid, tile.floor().isLiquid, tile.staticDarkness() >= 2 || (tile.floor().solid && tile.block() == Blocks.air), diff --git a/core/src/mindustry/ai/types/LogicAI.java b/core/src/mindustry/ai/types/LogicAI.java index b87a22e217..3357d36946 100644 --- a/core/src/mindustry/ai/types/LogicAI.java +++ b/core/src/mindustry/ai/types/LogicAI.java @@ -104,7 +104,7 @@ public class LogicAI extends AIController{ //look where moving if there's nothing to aim at if(!shoot){ unit.lookAt(unit.prefRotation()); - }else if(unit.hasWeapons() && unit.mounts.length > 0){ //if there is, look at the object + }else if(unit.hasWeapons() && unit.mounts.length > 0 && !unit.mounts[0].weapon.ignoreRotation){ //if there is, look at the object unit.lookAt(unit.mounts[0].aimX, unit.mounts[0].aimY); } } diff --git a/core/src/mindustry/game/Team.java b/core/src/mindustry/game/Team.java index cbed06f4e7..e8141d6063 100644 --- a/core/src/mindustry/game/Team.java +++ b/core/src/mindustry/game/Team.java @@ -97,7 +97,7 @@ public class Team implements Comparable{ } public boolean isEnemy(Team other){ - return state.teams.areEnemies(this, other); + return this != other; } public Seq cores(){ diff --git a/core/src/mindustry/game/Teams.java b/core/src/mindustry/game/Teams.java index 92b85a2481..2fb9c23f69 100644 --- a/core/src/mindustry/game/Teams.java +++ b/core/src/mindustry/game/Teams.java @@ -49,7 +49,7 @@ public class Teams{ public boolean eachEnemyCore(Team team, Boolf ret){ for(TeamData data : active){ - if(areEnemies(team, data.team)){ + if(team != data.team){ for(CoreBuild tile : data.cores){ if(ret.get(tile)){ return true; @@ -62,7 +62,7 @@ public class Teams{ public void eachEnemyCore(Team team, Cons ret){ for(TeamData data : active){ - if(areEnemies(team, data.team)){ + if(team != data.team){ for(Building tile : data.cores){ ret.get(tile); } @@ -91,11 +91,6 @@ public class Teams{ return get(team).active(); } - /** Returns whether {@param other} is an enemy of {@param #team}. */ - public boolean areEnemies(Team team, Team other){ - return team != other; - } - public boolean canInteract(Team team, Team other){ return team == other || other == Team.derelict; } @@ -216,7 +211,7 @@ public class Teams{ Seq enemies = new Seq<>(); for(TeamData other : active){ - if(areEnemies(data.team, other.team)){ + if(data.team != other.team){ enemies.add(other.team); } }