Re-added tap event for servers

This commit is contained in:
Anuken
2020-09-30 15:01:46 -04:00
parent 059c729a2c
commit d07c74b60f
5 changed files with 30 additions and 2 deletions

View File

@@ -459,6 +459,10 @@ public class DesktopInput extends InputHandler{
}
if(Core.input.keyTap(Binding.select) && !Core.scene.hasMouse()){
if(selected != null){
Call.tileTap(player, selected);
}
BuildPlan req = getRequest(cursorX, cursorY);
if(Core.input.keyDown(Binding.break_block)){

View File

@@ -274,6 +274,15 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
Core.app.post(() -> Events.fire(new ConfigEvent(tile, player, value)));
}
//only useful for servers or local mods, and is not replicated across clients
//uses unreliable packets due to high frequency
@Remote(targets = Loc.both, called = Loc.both, unreliable = true)
public static void tileTap(@Nullable Player player, Tile tile){
if(tile == null) return;
Events.fire(new TapEvent(player, tile));
}
@Remote(targets = Loc.both, called = Loc.both, forward = true)
public static void unitControl(Player player, @Nullable Unit unit){
if(player == null) return;

View File

@@ -558,6 +558,9 @@ public class MobileInput extends InputHandler implements GestureListener{
//ignore off-screen taps
if(cursor == null || Core.scene.hasMouse(x, y)) return false;
Call.tileTap(player, cursor);
Tile linked = cursor.build == null ? cursor : cursor.build.tile;
if(!player.dead()){