mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-16 14:21:43 -08:00
mess cleanup
This commit is contained in:
parent
ba805739b0
commit
3fe7e4e8da
11 changed files with 63 additions and 26 deletions
|
|
@ -32,6 +32,10 @@ text.about.button=About
|
|||
text.name=Name:
|
||||
text.unlocked=New Block Unlocked!
|
||||
text.unlocked.plural=New Blocks Unlocked!
|
||||
text.server.rollback=Rollback
|
||||
text.server.rollback.numberfield=Rollback Amount:
|
||||
text.blocks.editlogs=Edit Logs
|
||||
text.block.editlogsnotfound=[red]There are no edit logs for this location.
|
||||
text.public=Public
|
||||
text.players={0} players online
|
||||
text.server.player.host={0} (host)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import com.badlogic.gdx.Application.ApplicationType;
|
|||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.core.*;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
|
|
@ -15,14 +14,13 @@ import io.anuke.mindustry.entities.effect.Shield;
|
|||
import io.anuke.mindustry.entities.units.BaseUnit;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.io.Version;
|
||||
import io.anuke.mindustry.core.Platform;
|
||||
import io.anuke.mindustry.net.EditLog;
|
||||
import io.anuke.ucore.entities.EffectEntity;
|
||||
import io.anuke.ucore.entities.Entities;
|
||||
import io.anuke.ucore.entities.Entity;
|
||||
import io.anuke.ucore.entities.EntityGroup;
|
||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
||||
import io.anuke.ucore.util.OS;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class Vars{
|
||||
|
|
@ -87,8 +85,6 @@ public class Vars{
|
|||
public static final int saveSlots = 64;
|
||||
//amount of drops that are left when breaking a block
|
||||
public static final float breakDropAmount = 0.5f;
|
||||
|
||||
public static Array<EditLog> currentEditLogs = new Array<>();
|
||||
|
||||
//only if smoothCamera
|
||||
public static boolean snapCamera = true;
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@ package io.anuke.mindustry.core;
|
|||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.utils.IntMap;
|
||||
import com.badlogic.gdx.utils.IntSet;
|
||||
import com.badlogic.gdx.utils.TimeUtils;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.entities.SyncEntity;
|
||||
|
|
@ -154,7 +152,7 @@ public class NetClient extends Module {
|
|||
});
|
||||
|
||||
Net.handleClient(BlockLogRequestPacket.class, packet -> {
|
||||
currentEditLogs = packet.editlogs;
|
||||
ui.listfrag.showBlockLogs(packet.editlogs, packet.x, packet.y);
|
||||
});
|
||||
|
||||
Net.handleClient(PlacePacket.class, (packet) -> {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package io.anuke.mindustry.core;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.Base64Coder;
|
||||
import com.badlogic.gdx.utils.IntMap;
|
||||
import com.badlogic.gdx.utils.TimeUtils;
|
||||
|
|
@ -30,6 +31,7 @@ import io.anuke.ucore.util.Timer;
|
|||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class NetServer extends Module{
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public class DefaultKeybinds {
|
|||
"chat_history_next", Input.DOWN,
|
||||
"chat_scroll", new Axis(Input.SCROLL),
|
||||
"console", Input.GRAVE,
|
||||
"block_logs", Input.I,
|
||||
"block_logs", Input.I
|
||||
);
|
||||
|
||||
KeyBinds.defaultSection(section, DeviceType.controller,
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ 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.Inputs;
|
||||
|
|
@ -23,9 +24,7 @@ import io.anuke.ucore.scene.utils.Cursors;
|
|||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
import static io.anuke.mindustry.input.DesktopInput.CursorType.drill;
|
||||
import static io.anuke.mindustry.input.DesktopInput.CursorType.hand;
|
||||
import static io.anuke.mindustry.input.DesktopInput.CursorType.normal;
|
||||
import static io.anuke.mindustry.input.DesktopInput.CursorType.*;
|
||||
import static io.anuke.mindustry.input.PlaceMode.*;
|
||||
|
||||
public class DesktopInput extends InputHandler{
|
||||
|
|
@ -166,13 +165,11 @@ public class DesktopInput extends InputHandler{
|
|||
cursorType = drill;
|
||||
}
|
||||
|
||||
if(recipe == null && !ui.hasMouse() && Inputs.keyDown("block_info")
|
||||
&& cursor.block().fullDescription != null){
|
||||
if(recipe == null && !ui.hasMouse() && Inputs.keyDown("block_logs")) {
|
||||
cursorType = hand;
|
||||
if(Inputs.keyTap("select")){
|
||||
ui.hudfrag.blockfrag.showBlockInfo(cursor.block());
|
||||
NetEvents.handleBlockLogRequest(cursor.x, cursor.y);
|
||||
Cursors.restoreCursor();
|
||||
cursorType = normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ public class MapIO {
|
|||
private static final int version = 0;
|
||||
private static final IntIntMap defaultBlockMap = new IntIntMap();
|
||||
|
||||
//TODO static initializers are evil, remove
|
||||
static{
|
||||
|
||||
for(Block block : Block.getAllBlocks()){
|
||||
|
|
|
|||
|
|
@ -2,17 +2,16 @@ package io.anuke.mindustry.net;
|
|||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.IntMap;
|
||||
import com.badlogic.gdx.utils.Json;
|
||||
import com.badlogic.gdx.utils.ObjectMap;
|
||||
import com.badlogic.gdx.utils.TimeUtils;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Placement;
|
||||
import io.anuke.mindustry.world.blocks.types.BlockPart;
|
||||
import io.anuke.mindustry.world.blocks.types.Floor;
|
||||
import io.anuke.mindustry.world.blocks.types.Rock;
|
||||
import io.anuke.mindustry.world.blocks.types.StaticBlock;
|
||||
import io.anuke.ucore.core.Settings;
|
||||
|
||||
import static io.anuke.mindustry.Vars.world;
|
||||
|
||||
public class Administration {
|
||||
|
|
@ -87,8 +86,10 @@ public class Administration {
|
|||
Block result = log.block;
|
||||
int rotation = log.rotation;
|
||||
|
||||
//TODO fix this mess, broken with 4.0
|
||||
|
||||
if(log.action == EditLog.EditAction.PLACE) {
|
||||
Placement.breakBlock(x, y, false, false);
|
||||
// Build.breakBlock(x, y, false, false);
|
||||
|
||||
Packets.BreakPacket packet = new Packets.BreakPacket();
|
||||
packet.x = (short) x;
|
||||
|
|
@ -98,14 +99,14 @@ public class Administration {
|
|||
Net.send(packet, Net.SendMode.tcp);
|
||||
}
|
||||
else if(log.action == EditLog.EditAction.BREAK) {
|
||||
Placement.placeBlock(x, y, result, rotation, false, false);
|
||||
//Build.placeBlock(x, y, result, rotation, false, false);
|
||||
|
||||
Packets.PlacePacket packet = new Packets.PlacePacket();
|
||||
packet.x = (short) x;
|
||||
packet.y = (short) y;
|
||||
packet.rotation = (byte) rotation;
|
||||
packet.playerid = 0;
|
||||
packet.block = result.id;
|
||||
//packet.block = result.id;
|
||||
|
||||
Net.send(packet, Net.SendMode.tcp);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,7 +125,6 @@ public class NetEvents {
|
|||
BlockLogRequestPacket packet = new BlockLogRequestPacket();
|
||||
packet.x = x;
|
||||
packet.y = y;
|
||||
packet.editlogs = Vars.currentEditLogs;
|
||||
|
||||
Net.send(packet, SendMode.udp);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,17 @@
|
|||
package io.anuke.mindustry.ui.fragments;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.ObjectMap;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.net.EditLog;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.net.NetConnection;
|
||||
import io.anuke.mindustry.net.NetEvents;
|
||||
import io.anuke.mindustry.net.Packets.AdminAction;
|
||||
import io.anuke.mindustry.net.Packets.KickReason;
|
||||
import io.anuke.mindustry.ui.BorderImage;
|
||||
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
|
||||
import io.anuke.ucore.core.Inputs;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.scene.Element;
|
||||
|
|
@ -62,7 +65,7 @@ public class PlayerListFragment implements Fragment{
|
|||
|
||||
new button("$text.server.rollback", () -> {
|
||||
ui.rollback.show();
|
||||
}).padTop(-12).padBottom(-12).padRight(-12).fillY().cell.disabled(b -> !player.isAdmin);
|
||||
}).padTop(-12).padBottom(-12).padRight(-12).fillY().cell.disabled(b -> !players[0].isAdmin);
|
||||
|
||||
}}.pad(10f).growX().end();
|
||||
}}.end();
|
||||
|
|
@ -191,4 +194,43 @@ public class PlayerListFragment implements Fragment{
|
|||
content.marginBottom(5);
|
||||
}
|
||||
|
||||
public void showBlockLogs(Array<EditLog> currentEditLogs, int x, int y){
|
||||
boolean wasPaused = state.is(State.paused);
|
||||
state.set(State.paused);
|
||||
|
||||
FloatingDialog d = new FloatingDialog("$text.blocks.editlogs");
|
||||
Table table = new Table();
|
||||
table.defaults().pad(1f);
|
||||
ScrollPane pane = new ScrollPane(table, "clear");
|
||||
pane.setFadeScrollBars(false);
|
||||
Table top = new Table();
|
||||
top.left();
|
||||
top.add("[accent]Edit logs for: "+ x + ", " + y);
|
||||
table.add(top).fill().left();
|
||||
table.row();
|
||||
|
||||
d.content().add(pane).grow();
|
||||
|
||||
if(currentEditLogs == null || currentEditLogs.size == 0) {
|
||||
table.add("$text.block.editlogsnotfound").left();
|
||||
table.row();
|
||||
}
|
||||
|
||||
else {
|
||||
for(int i = 0; i < currentEditLogs.size; i++) {
|
||||
EditLog log = currentEditLogs.get(i);
|
||||
table.add("[gold]" + (i + 1) + ". [white]" + log.info()).left();
|
||||
table.row();
|
||||
}
|
||||
}
|
||||
|
||||
d.buttons().addButton("$text.ok", () -> {
|
||||
if(!wasPaused)
|
||||
state.set(State.playing);
|
||||
d.hide();
|
||||
}).size(110, 50).pad(10f);
|
||||
|
||||
d.show();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,9 +17,6 @@ import io.anuke.mindustry.net.Administration.PlayerInfo;
|
|||
import io.anuke.mindustry.net.Packets.ChatPacket;
|
||||
import io.anuke.mindustry.net.Packets.KickReason;
|
||||
import io.anuke.mindustry.ui.fragments.DebugFragment;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.io.Map;
|
||||
import io.anuke.mindustry.world.Build;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.core.*;
|
||||
import io.anuke.ucore.modules.Module;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue