Delete old requests, pause building
This commit is contained in:
@@ -216,7 +216,9 @@ quit.confirm.tutorial = Are you sure you know what you're doing?\nThe tutorial c
|
|||||||
loading = [accent]Loading...
|
loading = [accent]Loading...
|
||||||
reloading = [accent]Reloading Mods...
|
reloading = [accent]Reloading Mods...
|
||||||
saving = [accent]Saving...
|
saving = [accent]Saving...
|
||||||
cancelbuilding = [accent][[{0}][] to clear buildings
|
cancelbuilding = [accent][[{0}][] to clear plan
|
||||||
|
pausebuilding = [accent][[{0}][] to pause building
|
||||||
|
resumebuilding = [scarlet][[{0}][] to resume building
|
||||||
wave = [accent]Wave {0}
|
wave = [accent]Wave {0}
|
||||||
wave.waiting = [lightgray]Wave in {0}
|
wave.waiting = [lightgray]Wave in {0}
|
||||||
wave.waveInProgress = [lightgray]Wave in progress
|
wave.waveInProgress = [lightgray]Wave in progress
|
||||||
@@ -561,6 +563,7 @@ category.optional = Optional Enhancements
|
|||||||
setting.landscape.name = Lock Landscape
|
setting.landscape.name = Lock Landscape
|
||||||
setting.shadows.name = Shadows
|
setting.shadows.name = Shadows
|
||||||
setting.linear.name = Linear Filtering
|
setting.linear.name = Linear Filtering
|
||||||
|
setting.hints.name = Hints
|
||||||
setting.animatedwater.name = Animated Water
|
setting.animatedwater.name = Animated Water
|
||||||
setting.animatedshields.name = Animated Shields
|
setting.animatedshields.name = Animated Shields
|
||||||
setting.antialias.name = Antialias[lightgray] (requires restart)[]
|
setting.antialias.name = Antialias[lightgray] (requires restart)[]
|
||||||
@@ -632,6 +635,7 @@ keybind.zoom_hold.name = Zoom Hold
|
|||||||
keybind.zoom.name = Zoom
|
keybind.zoom.name = Zoom
|
||||||
keybind.menu.name = Menu
|
keybind.menu.name = Menu
|
||||||
keybind.pause.name = Pause
|
keybind.pause.name = Pause
|
||||||
|
keybind.pause_building.name = Pause/Resume Building
|
||||||
keybind.minimap.name = Minimap
|
keybind.minimap.name = Minimap
|
||||||
keybind.dash.name = Dash
|
keybind.dash.name = Dash
|
||||||
keybind.chat.name = Chat
|
keybind.chat.name = Chat
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
|
|||||||
public String name = "noname";
|
public String name = "noname";
|
||||||
public @Nullable
|
public @Nullable
|
||||||
String uuid, usid;
|
String uuid, usid;
|
||||||
public boolean isAdmin, isTransferring, isShooting, isBoosting, isMobile, isTyping;
|
public boolean isAdmin, isTransferring, isShooting, isBoosting, isMobile, isTyping, isBuilding = true;
|
||||||
public float boostHeat, shootHeat, destructTime;
|
public float boostHeat, shootHeat, destructTime;
|
||||||
public boolean achievedFlight;
|
public boolean achievedFlight;
|
||||||
public Color color = new Color();
|
public Color color = new Color();
|
||||||
@@ -356,7 +356,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
|
|||||||
if(dead) return;
|
if(dead) return;
|
||||||
|
|
||||||
if(isBuilding()){
|
if(isBuilding()){
|
||||||
if(!state.isPaused()){
|
if(!state.isPaused() && isBuilding){
|
||||||
drawBuilding();
|
drawBuilding();
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
@@ -448,6 +448,18 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
|
|||||||
|
|
||||||
//region update methods
|
//region update methods
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateMechanics(){
|
||||||
|
if(isBuilding){
|
||||||
|
updateBuilding();
|
||||||
|
}
|
||||||
|
|
||||||
|
//mine only when not building
|
||||||
|
if(buildRequest() == null){
|
||||||
|
updateMining();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(){
|
public void update(){
|
||||||
hitTime -= Time.delta();
|
hitTime -= Time.delta();
|
||||||
@@ -480,7 +492,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
|
|||||||
}
|
}
|
||||||
|
|
||||||
BuildRequest request = buildRequest();
|
BuildRequest request = buildRequest();
|
||||||
if(isBuilding() && request.tile() != null && (request.tile().withinDst(x, y, placeDistance) || state.isEditor())){
|
if(isBuilding() && isBuilding && request.tile() != null && (request.tile().withinDst(x, y, placeDistance) || state.isEditor())){
|
||||||
loops.play(Sounds.build, request.tile(), 0.75f);
|
loops.play(Sounds.build, request.tile(), 0.75f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -780,6 +792,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
|
|||||||
placeQueue.clear();
|
placeQueue.clear();
|
||||||
dead = true;
|
dead = true;
|
||||||
lastText = null;
|
lastText = null;
|
||||||
|
isBuilding = true;
|
||||||
textFadeTime = 0f;
|
textFadeTime = 0f;
|
||||||
target = null;
|
target = null;
|
||||||
moveTarget = null;
|
moveTarget = null;
|
||||||
@@ -873,7 +886,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
|
|||||||
public void write(DataOutput buffer) throws IOException{
|
public void write(DataOutput buffer) throws IOException{
|
||||||
super.writeSave(buffer, !isLocal);
|
super.writeSave(buffer, !isLocal);
|
||||||
TypeIO.writeStringData(buffer, name);
|
TypeIO.writeStringData(buffer, name);
|
||||||
buffer.writeByte(Pack.byteValue(isAdmin) | (Pack.byteValue(dead) << 1) | (Pack.byteValue(isBoosting) << 2) | (Pack.byteValue(isTyping) << 3));
|
buffer.writeByte(Pack.byteValue(isAdmin) | (Pack.byteValue(dead) << 1) | (Pack.byteValue(isBoosting) << 2) | (Pack.byteValue(isTyping) << 3)| (Pack.byteValue(isBuilding) << 4));
|
||||||
buffer.writeInt(Color.rgba8888(color));
|
buffer.writeInt(Color.rgba8888(color));
|
||||||
buffer.writeByte(mech.id);
|
buffer.writeByte(mech.id);
|
||||||
buffer.writeInt(mining == null ? noSpawner : mining.pos());
|
buffer.writeInt(mining == null ? noSpawner : mining.pos());
|
||||||
@@ -895,6 +908,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
|
|||||||
dead = (bools & 2) != 0;
|
dead = (bools & 2) != 0;
|
||||||
boolean boosting = (bools & 4) != 0;
|
boolean boosting = (bools & 4) != 0;
|
||||||
isTyping = (bools & 8) != 0;
|
isTyping = (bools & 8) != 0;
|
||||||
|
boolean building = (bools & 16) != 0;
|
||||||
color.set(buffer.readInt());
|
color.set(buffer.readInt());
|
||||||
mech = content.getByID(ContentType.mech, buffer.readByte());
|
mech = content.getByID(ContentType.mech, buffer.readByte());
|
||||||
int mine = buffer.readInt();
|
int mine = buffer.readInt();
|
||||||
@@ -913,6 +927,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
|
|||||||
velocity.y = lastvy;
|
velocity.y = lastvy;
|
||||||
}else{
|
}else{
|
||||||
mining = world.tile(mine);
|
mining = world.tile(mine);
|
||||||
|
isBuilding = building;
|
||||||
isBoosting = boosting;
|
isBoosting = boosting;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ public enum Binding implements KeyBind{
|
|||||||
deselect(KeyCode.MOUSE_RIGHT),
|
deselect(KeyCode.MOUSE_RIGHT),
|
||||||
break_block(KeyCode.MOUSE_RIGHT),
|
break_block(KeyCode.MOUSE_RIGHT),
|
||||||
clear_building(KeyCode.Q),
|
clear_building(KeyCode.Q),
|
||||||
|
pause_building(KeyCode.E),
|
||||||
rotate(new Axis(KeyCode.SCROLL)),
|
rotate(new Axis(KeyCode.SCROLL)),
|
||||||
rotateplaced(KeyCode.R),
|
rotateplaced(KeyCode.R),
|
||||||
diagonal_placement(KeyCode.CONTROL_LEFT),
|
diagonal_placement(KeyCode.CONTROL_LEFT),
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ public class DesktopInput extends InputHandler{
|
|||||||
private float selectScale;
|
private float selectScale;
|
||||||
/** Selected build request for movement. */
|
/** Selected build request for movement. */
|
||||||
private @Nullable BuildRequest sreq;
|
private @Nullable BuildRequest sreq;
|
||||||
|
/** Whether player is currently deleting removal requests. */
|
||||||
|
private boolean deleting = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDrawing(){
|
public boolean isDrawing(){
|
||||||
@@ -43,7 +45,13 @@ public class DesktopInput extends InputHandler{
|
|||||||
public void buildUI(Group group){
|
public void buildUI(Group group){
|
||||||
group.fill(t -> {
|
group.fill(t -> {
|
||||||
t.bottom().update(() -> t.getColor().a = Mathf.lerpDelta(t.getColor().a, player.isBuilding() ? 1f : 0f, 0.15f));
|
t.bottom().update(() -> t.getColor().a = Mathf.lerpDelta(t.getColor().a, player.isBuilding() ? 1f : 0f, 0.15f));
|
||||||
t.table(Styles.black6, b -> b.add(Core.bundle.format("cancelbuilding", Core.keybinds.get(Binding.clear_building).key.name())).style(Styles.outlineLabel)).margin(10f);
|
t.visible(() -> Core.settings.getBool("hints"));
|
||||||
|
t.table(Styles.black6, b -> {
|
||||||
|
b.defaults().left();
|
||||||
|
b.label(() -> Core.bundle.format(!player.isBuilding ? "resumebuilding" : "pausebuilding", Core.keybinds.get(Binding.pause_building).key.name())).style(Styles.outlineLabel);
|
||||||
|
b.row();
|
||||||
|
b.add(Core.bundle.format("cancelbuilding", Core.keybinds.get(Binding.clear_building).key.name())).style(Styles.outlineLabel);
|
||||||
|
}).margin(10f);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,6 +220,10 @@ public class DesktopInput extends InputHandler{
|
|||||||
lineRequests.clear();
|
lineRequests.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(Core.input.keyTap(Binding.pause_building)){
|
||||||
|
player.isBuilding = !player.isBuilding;
|
||||||
|
}
|
||||||
|
|
||||||
if((cursorX != lastLineX || cursorY != lastLineY) && isPlacing() && mode == placing){
|
if((cursorX != lastLineX || cursorY != lastLineY) && isPlacing() && mode == placing){
|
||||||
updateLine(selectX, selectY);
|
updateLine(selectX, selectY);
|
||||||
lastLineX = cursorX;
|
lastLineX = cursorX;
|
||||||
@@ -230,6 +242,8 @@ public class DesktopInput extends InputHandler{
|
|||||||
updateLine(selectX, selectY);
|
updateLine(selectX, selectY);
|
||||||
}else if(req != null && !req.breaking && mode == none){
|
}else if(req != null && !req.breaking && mode == none){
|
||||||
sreq = req;
|
sreq = req;
|
||||||
|
}else if(req != null && req.breaking){
|
||||||
|
deleting = true;
|
||||||
}else if(selected != null){
|
}else if(selected != null){
|
||||||
//only begin shooting if there's no cursor event
|
//only begin shooting if there's no cursor event
|
||||||
if(!tileTapped(selected) && !tryTapPlayer(Core.input.mouseWorld().x, Core.input.mouseWorld().y) && player.buildQueue().size == 0 && !droppingItem &&
|
if(!tileTapped(selected) && !tryTapPlayer(Core.input.mouseWorld().x, Core.input.mouseWorld().y) && player.buildQueue().size == 0 && !droppingItem &&
|
||||||
@@ -244,11 +258,21 @@ public class DesktopInput extends InputHandler{
|
|||||||
mode = none;
|
mode = none;
|
||||||
}else if(Core.input.keyTap(Binding.break_block) && !Core.scene.hasMouse()){
|
}else if(Core.input.keyTap(Binding.break_block) && !Core.scene.hasMouse()){
|
||||||
//is recalculated because setting the mode to breaking removes potential multiblock cursor offset
|
//is recalculated because setting the mode to breaking removes potential multiblock cursor offset
|
||||||
|
deleting = false;
|
||||||
mode = breaking;
|
mode = breaking;
|
||||||
selectX = tileX(Core.input.mouseX());
|
selectX = tileX(Core.input.mouseX());
|
||||||
selectY = tileY(Core.input.mouseY());
|
selectY = tileY(Core.input.mouseY());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(Core.input.keyDown(Binding.select) && mode == none && !isPlacing() && deleting){
|
||||||
|
BuildRequest req = getRequest(cursorX, cursorY);
|
||||||
|
if(req != null && req.breaking){
|
||||||
|
player.buildQueue().remove(req);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
deleting = false;
|
||||||
|
}
|
||||||
|
|
||||||
if(mode == placing && block != null){
|
if(mode == placing && block != null){
|
||||||
if(!overrideLineRotation && !Core.input.keyDown(Binding.diagonal_placement) && (selectX != cursorX || selectY != cursorY) && ((int) Core.input.axisTap(Binding.rotate) != 0)){
|
if(!overrideLineRotation && !Core.input.keyDown(Binding.diagonal_placement) && (selectX != cursorX || selectY != cursorY) && ((int) Core.input.axisTap(Binding.rotate) != 0)){
|
||||||
rotation = ((int)((Angles.angle(selectX, selectY, cursorX, cursorY) + 45) / 90f)) % 4;
|
rotation = ((int)((Angles.angle(selectX, selectY, cursorX, cursorY) + 45) / 90f)) % 4;
|
||||||
@@ -274,7 +298,7 @@ public class DesktopInput extends InputHandler{
|
|||||||
|
|
||||||
if(sreq != null){
|
if(sreq != null){
|
||||||
if(getRequest(sreq.x, sreq.y, sreq.block.size, sreq) != null){
|
if(getRequest(sreq.x, sreq.y, sreq.block.size, sreq) != null){
|
||||||
player.buildQueue().removeValue(sreq, true);
|
player.buildQueue().remove(sreq, true);
|
||||||
}
|
}
|
||||||
sreq = null;
|
sreq = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -518,6 +518,10 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
ui.hudGroup.addChild(uiGroup);
|
ui.hudGroup.addChild(uiGroup);
|
||||||
buildUI(uiGroup);
|
buildUI(uiGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(player != null){
|
||||||
|
player.isBuilding = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canShoot(){
|
public boolean canShoot(){
|
||||||
|
|||||||
@@ -225,6 +225,8 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
|
|
||||||
game.checkPref("savecreate", true);
|
game.checkPref("savecreate", true);
|
||||||
|
|
||||||
|
game.checkPref("hints", true);
|
||||||
|
|
||||||
if(steam){
|
if(steam){
|
||||||
game.checkPref("publichost", false, i -> {
|
game.checkPref("publichost", false, i -> {
|
||||||
platform.updateLobby();
|
platform.updateLobby();
|
||||||
|
|||||||
Reference in New Issue
Block a user