mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-09 22:59:13 +07:00
Added back tapping
This commit is contained in:
parent
c02c00cdfb
commit
882076030d
@ -159,6 +159,15 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
}
|
||||
}
|
||||
|
||||
@Remote(targets = Loc.both, called = Loc.server, forward = true)
|
||||
public static void onTileTapped(Playerc player, Tile tile){
|
||||
if(tile == null || player == null) return;
|
||||
if(net.server() && (!Units.canInteract(player, tile) ||
|
||||
!netServer.admins.allowAction(player, ActionType.tapTile, tile, action -> {}))) throw new ValidateException(player, "Player cannot tap a tile.");
|
||||
tile.block().tapped(tile, player);
|
||||
Core.app.post(() -> Events.fire(new TapEvent(tile, player)));
|
||||
}
|
||||
|
||||
@Remote(targets = Loc.both, called = Loc.both, forward = true)
|
||||
public static void onTileConfig(Playerc player, Tile tile, @Nullable Object value){
|
||||
if(tile == null) return;
|
||||
@ -583,7 +592,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
|
||||
//call tapped event
|
||||
if(!consumed && tile.interactable(player.team())){
|
||||
Call.onTileConfig(player, tile, null);
|
||||
Call.onTileTapped(player, tile);
|
||||
}
|
||||
|
||||
//consume tap event if necessary
|
||||
|
@ -734,8 +734,8 @@ public class Block extends BlockStorage{
|
||||
}
|
||||
|
||||
public void drawRequestRegion(BuildRequest req, Eachable<BuildRequest> list){
|
||||
TextureRegion reg = icon(Cicon.full);
|
||||
Draw.rect(icon(Cicon.full), req.drawx(), req.drawy(),
|
||||
TextureRegion reg = getRequestRegion(req, list);
|
||||
Draw.rect(reg, req.drawx(), req.drawy(),
|
||||
reg.getWidth() * req.animScale * Draw.scl,
|
||||
reg.getHeight() * req.animScale * Draw.scl,
|
||||
!rotate ? 0 : req.rotation * 90);
|
||||
@ -745,6 +745,10 @@ public class Block extends BlockStorage{
|
||||
}
|
||||
}
|
||||
|
||||
public TextureRegion getRequestRegion(BuildRequest req, Eachable<BuildRequest> list){
|
||||
return icon(Cicon.full);
|
||||
}
|
||||
|
||||
public void drawRequestConfig(BuildRequest req, Eachable<BuildRequest> list){
|
||||
|
||||
}
|
||||
|
@ -5,9 +5,11 @@ import arc.Graphics.*;
|
||||
import arc.Graphics.Cursor.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.util.*;
|
||||
import arc.util.io.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.entities.units.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
@ -52,12 +54,12 @@ public class Door extends Wall{
|
||||
@Override
|
||||
public void draw(Tile tile){
|
||||
DoorEntity entity = tile.ent();
|
||||
Draw.rect(entity.open ? openRegion : region, tile.drawx(), tile.drawy());
|
||||
}
|
||||
|
||||
if(!entity.open){
|
||||
Draw.rect(region, tile.drawx(), tile.drawy());
|
||||
}else{
|
||||
Draw.rect(openRegion, tile.drawx(), tile.drawy());
|
||||
}
|
||||
@Override
|
||||
public TextureRegion getRequestRegion(BuildRequest req, Eachable<BuildRequest> list){
|
||||
return req.config == Boolean.TRUE ? openRegion : region;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,3 +1,3 @@
|
||||
org.gradle.daemon=true
|
||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||
archash=69ef047313449905aff6d1390d7136f9c7cdc986
|
||||
archash=c1eab295b1a55397957fd54bec2f37daee0e8b4b
|
||||
|
Loading…
Reference in New Issue
Block a user