Merge remote-tracking branch 'origin/master'

This commit is contained in:
Anuken
2019-12-14 11:05:32 -05:00
31 changed files with 23 additions and 39 deletions

View File

@@ -139,9 +139,19 @@ public class EventType{
}
/** Called when a player withdraws items from a block. Tutorial only.*/
/** Called when the player withdraws items from a block. */
public static class WithdrawEvent{
public final Tile tile;
public final Player player;
public final Item item;
public final int amount;
public WithdrawEvent(Tile tile, Player player, Item item, int amount){
this.tile = tile;
this.player = player;
this.item = item;
this.amount = amount;
}
}
/** Called when a player deposits items to a block.*/

View File

@@ -40,8 +40,7 @@ public enum Binding implements KeyBind{
block_select_08(KeyCode.NUM_8),
block_select_09(KeyCode.NUM_9),
block_select_10(KeyCode.NUM_0),
zoom_hold(KeyCode.CONTROL_LEFT, "view"),
zoom(new Axis(KeyCode.SCROLL)),
zoom(new Axis(KeyCode.SCROLL), "view"),
menu(Core.app.getType() == ApplicationType.Android ? KeyCode.BACK : KeyCode.ESCAPE),
fullscreen(KeyCode.F11),
pause(KeyCode.SPACE),

View File

@@ -149,8 +149,8 @@ public class DesktopInput extends InputHandler{
if(state.is(State.menu) || Core.scene.hasDialog()) return;
//zoom things
if(Math.abs(Core.input.axisTap(Binding.zoom)) > 0 && Core.input.keyDown(Binding.zoom_hold)){
//zoom camera
if(Math.abs(Core.input.axisTap(Binding.zoom)) > 0 && !Core.input.keyDown(Binding.rotateplaced) && (Core.input.keyDown(Binding.diagonal_placement) || ((block == null || !block.rotate) && selectRequests.isEmpty()))){
renderer.scaleCamera(Core.input.axisTap(Binding.zoom));
}
@@ -182,8 +182,7 @@ public class DesktopInput extends InputHandler{
selectScale = 0f;
}
if(!Core.input.keyDown(Binding.zoom_hold) && Math.abs((int)Core.input.axisTap(Binding.rotate)) > 0){
if(!Core.input.keyDown(Binding.diagonal_placement) && Math.abs((int)Core.input.axisTap(Binding.rotate)) > 0){
rotation = Mathf.mod(rotation + (int)Core.input.axisTap(Binding.rotate), 4);
if(sreq != null){

View File

@@ -587,8 +587,8 @@ public class MobileInput extends InputHandler implements GestureListener{
mode = none;
}
//zoom things
if(Math.abs(Core.input.axisTap(Binding.zoom)) > 0 && (Core.input.keyDown(Binding.zoom_hold))){
//zoom camera
if(Math.abs(Core.input.axisTap(Binding.zoom)) > 0 && !Core.input.keyDown(Binding.rotateplaced) && (Core.input.keyDown(Binding.diagonal_placement) || ((block == null || !block.rotate) && selectRequests.isEmpty()))){
renderer.scaleCamera(Core.input.axisTap(Binding.zoom));
}

View File

@@ -42,6 +42,7 @@ public class BlockInventoryFragment extends Fragment{
int removed = tile.block().removeStack(tile, item, amount);
player.addItem(item, removed);
Events.fire(new WithdrawEvent(tile, player, item, amount));
for(int j = 0; j < Mathf.clamp(removed / 3, 1, 8); j++){
Time.run(j * 3f, () -> Call.transferItemEffect(item, tile.drawx(), tile.drawy(), player));
}
@@ -100,7 +101,7 @@ public class BlockInventoryFragment extends Fragment{
holding = false;
holdTime = 0f;
Events.fire(new WithdrawEvent());
if(net.client()) Events.fire(new WithdrawEvent(tile, player, lastItem, amount));
}
}
@@ -153,7 +154,7 @@ public class BlockInventoryFragment extends Fragment{
lastItem = item;
holding = true;
holdTime = 0f;
Events.fire(new WithdrawEvent());
if(net.client()) Events.fire(new WithdrawEvent(tile, player, item, amount));
}
return true;
}

View File

@@ -147,8 +147,8 @@ public class MessageBlock extends Block{
}
public class MessageBlockEntity extends TileEntity{
protected String message = "";
protected String[] lines = {""};
public String message = "";
public String[] lines = {""};
@Override
public void write(DataOutput stream) throws IOException{