Changed too many things to fit in commit log
This commit is contained in:
@@ -14,7 +14,7 @@ import io.anuke.mindustry.content.blocks.Blocks;
|
||||
import io.anuke.mindustry.content.fx.Fx;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.entities.Targetable;
|
||||
import io.anuke.mindustry.entities.traits.TargetTrait;
|
||||
import io.anuke.mindustry.entities.Unit;
|
||||
import io.anuke.mindustry.entities.Units;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
@@ -56,7 +56,7 @@ public class AndroidInput extends InputHandler implements GestureListener{
|
||||
private float lineScale;
|
||||
/**Animation data for crosshair.*/
|
||||
private float crosshairScale;
|
||||
private Targetable lastTarget;
|
||||
private TargetTrait lastTarget;
|
||||
|
||||
/**List of currently selected tiles to place.*/
|
||||
private Array<PlaceRequest> selection = new Array<>();
|
||||
@@ -80,7 +80,7 @@ public class AndroidInput extends InputHandler implements GestureListener{
|
||||
|
||||
/**Check and assign targets for a specific position.*/
|
||||
void checkTargets(float x, float y){
|
||||
Unit unit = Units.getClosestEnemy(player.team, x, y, 20f, u -> true);
|
||||
Unit unit = Units.getClosestEnemy(player.getTeam(), x, y, 20f, u -> true);
|
||||
|
||||
if(unit != null){
|
||||
player.target = unit;
|
||||
@@ -88,7 +88,7 @@ public class AndroidInput extends InputHandler implements GestureListener{
|
||||
Tile tile = world.tileWorld(x, y);
|
||||
if(tile != null) tile = tile.target();
|
||||
|
||||
if(tile != null && state.teams.areEnemies(player.team, tile.getTeam())){
|
||||
if(tile != null && state.teams.areEnemies(player.getTeam(), tile.getTeam())){
|
||||
player.target = tile.entity;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.mindustry.input.PlaceUtils.NormalizeDrawResult;
|
||||
import io.anuke.mindustry.input.PlaceUtils.NormalizeResult;
|
||||
import io.anuke.mindustry.net.NetEvents;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.core.Graphics;
|
||||
@@ -166,14 +165,6 @@ public class DesktopInput extends InputHandler{
|
||||
if(canTapPlayer(Graphics.mouseWorld().x, Graphics.mouseWorld().y)){
|
||||
cursorType = drill;
|
||||
}
|
||||
|
||||
if(recipe == null && !ui.hasMouse() && Inputs.keyDown("block_logs")) {
|
||||
cursorType = hand;
|
||||
if(Inputs.keyTap("select")){
|
||||
NetEvents.handleBlockLogRequest(cursor.x, cursor.y);
|
||||
Cursors.restoreCursor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!ui.hasMouse()) {
|
||||
|
||||
@@ -3,7 +3,7 @@ package io.anuke.mindustry.input;
|
||||
import com.badlogic.gdx.InputAdapter;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import io.anuke.mindustry.content.blocks.Blocks;
|
||||
import io.anuke.mindustry.entities.BlockBuilder.BuildRequest;
|
||||
import io.anuke.mindustry.entities.traits.BuilderTrait.BuildRequest;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.entities.effect.ItemTransfer;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
@@ -93,7 +93,7 @@ public abstract class InputHandler extends InputAdapter{
|
||||
boolean showedInventory = false;
|
||||
|
||||
//check if tapped block is configurable
|
||||
if(tile.block().isConfigurable(tile) && tile.getTeam() == player.team){
|
||||
if(tile.block().isConfigurable(tile) && tile.getTeam() == player.getTeam()){
|
||||
consumed = true;
|
||||
if((!frag.config.isShown() //if the config fragment is hidden, show
|
||||
//alternatively, the current selected block can 'agree' to switch config tiles
|
||||
@@ -111,9 +111,9 @@ public abstract class InputHandler extends InputAdapter{
|
||||
|
||||
//TODO network event!
|
||||
//call tapped event
|
||||
if(tile.getTeam() == player.team && tile.block().tapped(tile, player)){
|
||||
if(tile.getTeam() == player.getTeam() && tile.block().tapped(tile, player)){
|
||||
consumed = true;
|
||||
}else if(tile.getTeam() == player.team && tile.block().synthetic() && tile.block().hasItems){
|
||||
}else if(tile.getTeam() == player.getTeam() && tile.block().synthetic() && tile.block().hasItems){
|
||||
frag.inv.showFor(tile);
|
||||
consumed = true;
|
||||
showedInventory = true;
|
||||
@@ -261,9 +261,9 @@ public abstract class InputHandler extends InputAdapter{
|
||||
}
|
||||
|
||||
public boolean validPlace(int x, int y, Block type, int rotation){
|
||||
for(Tile tile : state.teams.get(player.team).cores){
|
||||
for(Tile tile : state.teams.get(player.getTeam()).cores){
|
||||
if(tile.distanceTo(x * tilesize, y * tilesize) < coreBuildRange){
|
||||
return Build.validPlace(player.team, x, y, type, rotation) &&
|
||||
return Build.validPlace(player.getTeam(), x, y, type, rotation) &&
|
||||
Vector2.dst(player.x, player.y, x * tilesize, y * tilesize) < Player.placeDistance;
|
||||
}
|
||||
}
|
||||
@@ -272,7 +272,7 @@ public abstract class InputHandler extends InputAdapter{
|
||||
}
|
||||
|
||||
public boolean validBreak(int x, int y){
|
||||
return Build.validBreak(player.team, x, y);
|
||||
return Build.validBreak(player.getTeam(), x, y);
|
||||
}
|
||||
|
||||
public void placeBlock(int x, int y, Recipe recipe, int rotation){
|
||||
|
||||
Reference in New Issue
Block a user