mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-18 23:32:08 -08:00
Input fixes
This commit is contained in:
parent
bd3463c824
commit
d7ca2a33c8
9 changed files with 54 additions and 26 deletions
|
|
@ -277,7 +277,7 @@ public interface BuilderTrait extends Entity, TeamTrait{
|
|||
public boolean initialized;
|
||||
|
||||
//animation variables
|
||||
public float animScale;
|
||||
public float animScale = 0f;
|
||||
public float animInvalid;
|
||||
|
||||
/** This creates a build request. */
|
||||
|
|
|
|||
|
|
@ -433,6 +433,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
|
|||
for(BuildRequest request : buildQueue()){
|
||||
if(request.progress > 0.01f || (buildRequest() == request && request.initialized && (dst(request.x * tilesize, request.y * tilesize) <= placeDistance || state.isEditor()))) continue;
|
||||
|
||||
request.animScale = 1f;
|
||||
if(request.breaking){
|
||||
control.input.drawBreaking(request);
|
||||
}else{
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ public class DesktopInput extends InputHandler{
|
|||
lastLineY = cursorY;
|
||||
mode = placing;
|
||||
updateLine(selectX, selectY);
|
||||
}else if(req != null && !req.breaking && mode == none){
|
||||
}else if(req != null && !req.breaking && mode == none && !req.initialized){
|
||||
sreq = req;
|
||||
}else if(req != null && req.breaking){
|
||||
deleting = true;
|
||||
|
|
|
|||
|
|
@ -330,6 +330,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||
/** Draws a placement icon for a specific block. */
|
||||
protected void drawRequest(int x, int y, Block block, int rotation){
|
||||
brequest.set(x, y, rotation, block);
|
||||
brequest.animScale = 1f;
|
||||
block.drawRequest(brequest, allRequests(), validPlace(x, y, block, rotation));
|
||||
}
|
||||
|
||||
|
|
@ -393,7 +394,9 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||
lineRequests.clear();
|
||||
iterateLine(x1, y1, x2, y2, l -> {
|
||||
rotation = l.rotation;
|
||||
lineRequests.add(new BuildRequest(l.x, l.y, l.rotation, block));
|
||||
BuildRequest req = new BuildRequest(l.x, l.y, l.rotation, block);
|
||||
req.animScale = 1f;
|
||||
lineRequests.add(req);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -445,12 +448,13 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
//clear when the player taps on something else
|
||||
if(!consumed && !mobile && player.isBuilding() && block == null){
|
||||
//player.clearBuilding();
|
||||
block = null;
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
|
||||
if(!showedInventory){
|
||||
frag.inv.hide();
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||
}
|
||||
|
||||
//move all current requests to removal array so they fade out
|
||||
removals.addAll(selectRequests);
|
||||
removals.addAll(selectRequests.find(r -> !r.breaking));
|
||||
selectRequests.clear();
|
||||
selecting = false;
|
||||
}).visible(() -> !selectRequests.isEmpty()).name("confirmplace");
|
||||
|
|
@ -217,9 +217,10 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||
@Override
|
||||
public void buildUI(Group group){
|
||||
group.fill(t -> {
|
||||
t.bottom().left().visible(() -> (player.isBuilding() || block != null || mode == breaking) && !state.is(State.menu));
|
||||
t.bottom().left().visible(() -> (player.isBuilding() || block != null || mode == breaking || !selectRequests.isEmpty()) && !state.is(State.menu));
|
||||
t.addImageTextButton("$cancel", Icon.cancelSmall, () -> {
|
||||
player.clearBuilding();
|
||||
selectRequests.clear();
|
||||
mode = none;
|
||||
block = null;
|
||||
}).width(155f);
|
||||
|
|
@ -244,6 +245,11 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||
request.animScale = Mathf.lerpDelta(request.animScale, 0f, 0.2f);
|
||||
request.animInvalid = Mathf.lerpDelta(request.animInvalid, 0f, 0.2f);
|
||||
|
||||
if(request.breaking){
|
||||
drawSelected(request.x, request.y, tile.block(), Pal.remove);
|
||||
}else{
|
||||
request.block.drawRequest(request, allRequests(), true);
|
||||
}
|
||||
//TODO
|
||||
//drawRequest(request);
|
||||
}
|
||||
|
|
@ -328,8 +334,11 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||
|
||||
@Override
|
||||
protected void drawRequest(BuildRequest request){
|
||||
if(request.tile() == null) return;
|
||||
brequest.animScale = request.animScale = Mathf.lerpDelta(request.animScale, 1f, 0.1f);
|
||||
|
||||
if(request.breaking){
|
||||
drawSelected(request.x, request.y, request.block, Pal.remove);
|
||||
drawSelected(request.x, request.y, request.tile().block(), Pal.remove);
|
||||
}else{
|
||||
drawRequest(request.x, request.y, request.block, request.rotation);
|
||||
drawSelected(request.x, request.y, request.block, Pal.accent);
|
||||
|
|
|
|||
|
|
@ -676,7 +676,10 @@ public class Block extends BlockStorage{
|
|||
}
|
||||
|
||||
public void drawRequestRegion(BuildRequest req, Eachable<BuildRequest> list){
|
||||
Draw.rect(icon(Cicon.full), req.drawx(), req.drawy(), !rotate ? 0 : req.rotation * 90);
|
||||
TextureRegion reg = icon(Cicon.full);
|
||||
Draw.rect(icon(Cicon.full), req.drawx(), req.drawy(),
|
||||
reg.getWidth() * req.animScale * Draw.scl, reg.getHeight() * req.animScale * Draw.scl,
|
||||
!rotate ? 0 : req.rotation * 90);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,24 +1,19 @@
|
|||
package io.anuke.mindustry.world.blocks.power;
|
||||
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.graphics.Color;
|
||||
import io.anuke.arc.graphics.g2d.Draw;
|
||||
import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||
import io.anuke.arc.math.Mathf;
|
||||
import io.anuke.arc.util.Time;
|
||||
import io.anuke.mindustry.content.Fx;
|
||||
import io.anuke.mindustry.entities.Effects;
|
||||
import io.anuke.mindustry.entities.type.TileEntity;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.Liquid;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.consumers.ConsumeItemFilter;
|
||||
import io.anuke.mindustry.world.consumers.ConsumeLiquidFilter;
|
||||
import io.anuke.mindustry.world.meta.BlockStat;
|
||||
import io.anuke.mindustry.world.meta.StatUnit;
|
||||
import io.anuke.arc.*;
|
||||
import io.anuke.arc.graphics.*;
|
||||
import io.anuke.arc.graphics.g2d.*;
|
||||
import io.anuke.arc.math.*;
|
||||
import io.anuke.arc.util.*;
|
||||
import io.anuke.mindustry.content.*;
|
||||
import io.anuke.mindustry.entities.*;
|
||||
import io.anuke.mindustry.entities.type.*;
|
||||
import io.anuke.mindustry.type.*;
|
||||
import io.anuke.mindustry.world.*;
|
||||
import io.anuke.mindustry.world.consumers.*;
|
||||
import io.anuke.mindustry.world.meta.*;
|
||||
|
||||
import static io.anuke.mindustry.Vars.content;
|
||||
import static io.anuke.mindustry.Vars.tilesize;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
/**
|
||||
* Power generation block which can use items, liquids or both as input sources for power production.
|
||||
|
|
@ -53,6 +48,10 @@ public class ItemLiquidGenerator extends PowerGenerator{
|
|||
}
|
||||
}
|
||||
|
||||
public ItemLiquidGenerator(String name){
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
super.load();
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@ public class SingleTypeGenerator extends ItemLiquidGenerator{
|
|||
super(hasItems, hasLiquids, name);
|
||||
}
|
||||
|
||||
public SingleTypeGenerator(String name){
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getItemEfficiency(Item item){
|
||||
return 1f;
|
||||
|
|
|
|||
|
|
@ -83,6 +83,14 @@ public class DesktopLauncher extends ClientLauncher{
|
|||
}
|
||||
|
||||
if(useSteam){
|
||||
//delete leftover dlls
|
||||
FileHandle file = new FileHandle(".");
|
||||
for(FileHandle other : file.parent().list()){
|
||||
if(other.name().contains("steam") && (other.extension().equals("dll") || other.extension().equals("so") || other.extension().equals("dylib"))){
|
||||
other.delete();
|
||||
}
|
||||
}
|
||||
|
||||
if(showConsole){
|
||||
StringBuilder base = new StringBuilder();
|
||||
Log.setLogger(new LogHandler(){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue