mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-25 05:51:47 -08:00
Bugfixes
This commit is contained in:
parent
e96fcb3cb7
commit
26acf7cbbc
8 changed files with 27 additions and 29 deletions
|
|
@ -843,8 +843,8 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||
}
|
||||
}
|
||||
|
||||
/** Called when the block is tapped.*/
|
||||
public void tapped(Player player){
|
||||
/** Called when the block is tapped by the local player. */
|
||||
public void tapped(){
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -166,17 +166,6 @@ public class EventType{
|
|||
}
|
||||
}
|
||||
|
||||
/** Called when the player taps a block. */
|
||||
public static class TapEvent{
|
||||
public final Building tile;
|
||||
public final Player player;
|
||||
|
||||
public TapEvent(Building tile, Player player){
|
||||
this.tile = tile;
|
||||
this.player = player;
|
||||
}
|
||||
}
|
||||
|
||||
/** Called when the player sets a specific block. */
|
||||
public static class TapConfigEvent{
|
||||
public final Building tile;
|
||||
|
|
|
|||
|
|
@ -206,15 +206,6 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||
);
|
||||
}
|
||||
|
||||
@Remote(targets = Loc.both, called = Loc.server, forward = true)
|
||||
public static void tileTapped(Player player, Building tile){
|
||||
if(tile == null || player == null) return;
|
||||
if(net.server() && (!Units.canInteract(player, tile) ||
|
||||
!netServer.admins.allowAction(player, ActionType.tapTile, tile.tile(), action -> {}))) throw new ValidateException(player, "Player cannot tap a tile.");
|
||||
tile.tapped(player);
|
||||
Core.app.post(() -> Events.fire(new TapEvent(tile, player)));
|
||||
}
|
||||
|
||||
@Remote(targets = Loc.both, called = Loc.both, forward = true)
|
||||
public static void tileConfig(Player player, Building tile, @Nullable Object value){
|
||||
if(tile == null) return;
|
||||
|
|
@ -778,7 +769,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||
|
||||
//call tapped event
|
||||
if(!consumed && tile.interactable(player.team())){
|
||||
Call.tileTapped(player, tile);
|
||||
tile.tapped();
|
||||
}
|
||||
|
||||
//consume tap event if necessary
|
||||
|
|
|
|||
|
|
@ -75,7 +75,6 @@ public class Administration{
|
|||
addActionFilter(action -> {
|
||||
if(action.type != ActionType.breakBlock &&
|
||||
action.type != ActionType.placeBlock &&
|
||||
action.type != ActionType.tapTile &&
|
||||
Config.antiSpam.bool() &&
|
||||
//make sure players can configure their own stuff, e.g. in schematics
|
||||
lastPlaced.get(action.tile.pos(), -1) != action.player.id()){
|
||||
|
|
@ -720,7 +719,7 @@ public class Administration{
|
|||
}
|
||||
|
||||
public enum ActionType{
|
||||
breakBlock, placeBlock, rotate, configure, tapTile, withdrawItem, depositItem
|
||||
breakBlock, placeBlock, rotate, configure, withdrawItem, depositItem
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import arc.util.serialization.*;
|
|||
import mindustry.core.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.io.*;
|
||||
import mindustry.net.Administration.*;
|
||||
import mindustry.net.Packets.*;
|
||||
import mindustry.ui.*;
|
||||
|
|
@ -129,6 +130,9 @@ public class BeControl{
|
|||
progress -> {},
|
||||
() -> false,
|
||||
() -> Core.app.post(() -> {
|
||||
Log.info("&lcSaving...");
|
||||
SaveIO.save(saveDirectory.child("autosavebe." + saveExtension));
|
||||
|
||||
netServer.kickAll(KickReason.serverRestarting);
|
||||
Threads.sleep(32);
|
||||
|
||||
|
|
|
|||
|
|
@ -148,9 +148,9 @@ public class BuildBlock extends Block{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void tapped(Player player){
|
||||
public void tapped(){
|
||||
//if the target is constructible, begin constructing
|
||||
if(!headless && cblock != null){
|
||||
if(cblock != null){
|
||||
if(control.input.buildWasAutoPaused && !control.input.isBuilding && player.isBuilder()){
|
||||
control.input.isBuilding = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ public class Door extends Wall{
|
|||
if(type == LAccess.enabled){
|
||||
boolean shouldOpen = !Mathf.zero(p1);
|
||||
|
||||
if(open == shouldOpen || (Units.anyEntities(tile) && !shouldOpen) || !origin().timer(timerToggle, 60f)){
|
||||
if(net.client() || open == shouldOpen || (Units.anyEntities(tile) && !shouldOpen) || !origin().timer(timerToggle, 60f)){
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ public class Door extends Wall{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void tapped(Player player){
|
||||
public void tapped(){
|
||||
if((Units.anyEntities(tile) && open) || !origin().timer(timerToggle, 50f)){
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,6 +86,21 @@ public class ServerControl implements ApplicationListener{
|
|||
registerCommands();
|
||||
|
||||
Core.app.post(() -> {
|
||||
//try to load auto-update save if possible
|
||||
if(Config.autoUpdate.bool()){
|
||||
Fi fi = saveDirectory.child("autosavebe." + saveExtension);
|
||||
if(fi.exists()){
|
||||
try{
|
||||
SaveIO.load(fi);
|
||||
info("Auto-save loaded.");
|
||||
state.set(State.playing);
|
||||
netServer.openServer();
|
||||
}catch(Throwable e){
|
||||
Log.err(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Seq<String> commands = new Seq<>();
|
||||
|
||||
if(args.length > 0){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue