Logic unit control
This commit is contained in:
@@ -14,12 +14,8 @@ import arc.scene.ui.layout.Stack;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.game.EventType.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.net.Administration.*;
|
||||
import mindustry.net.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.ui.*;
|
||||
|
||||
@@ -42,29 +38,6 @@ public class BlockInventoryFragment extends Fragment{
|
||||
Events.on(WorldLoadEvent.class, e -> hide());
|
||||
}
|
||||
|
||||
@Remote(called = Loc.server, targets = Loc.both, forward = true)
|
||||
public static void requestItem(Player player, Building tile, Item item, int amount){
|
||||
if(player == null || tile == null || !tile.interactable(player.team()) || !player.within(tile, buildingRange)) return;
|
||||
amount = Math.min(player.unit().maxAccepted(item), amount);
|
||||
int fa = amount;
|
||||
|
||||
if(amount == 0) return;
|
||||
|
||||
if(net.server() && (!Units.canInteract(player, tile) ||
|
||||
!netServer.admins.allowAction(player, ActionType.withdrawItem, tile.tile(), action -> {
|
||||
action.item = item;
|
||||
action.itemAmount = fa;
|
||||
}))) throw new ValidateException(player, "Player cannot request items.");
|
||||
|
||||
int removed = tile.removeStack(item, amount);
|
||||
|
||||
player.unit().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.x, tile.y, player.unit()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(Group parent){
|
||||
table.name = "inventory";
|
||||
|
||||
@@ -57,7 +57,7 @@ public class ChatFragment extends Table{
|
||||
}
|
||||
}
|
||||
|
||||
return net.active() && ui.hudfrag.shown();
|
||||
return net.active() && ui.hudfrag.shown;
|
||||
});
|
||||
|
||||
update(() -> {
|
||||
|
||||
@@ -32,16 +32,16 @@ public class HudFragment extends Fragment{
|
||||
private static final float dsize = 65f;
|
||||
|
||||
public final PlacementFragment blockfrag = new PlacementFragment();
|
||||
public boolean shown = true;
|
||||
|
||||
private ImageButton flip;
|
||||
private Table lastUnlockTable;
|
||||
private Table lastUnlockLayout;
|
||||
private boolean shown = true;
|
||||
private CoreItemsDisplay coreItems = new CoreItemsDisplay();
|
||||
|
||||
private String hudText = "";
|
||||
private boolean showHudText;
|
||||
|
||||
private Table lastUnlockTable;
|
||||
private Table lastUnlockLayout;
|
||||
private long lastToast;
|
||||
|
||||
@Override
|
||||
@@ -420,10 +420,6 @@ public class HudFragment extends Fragment{
|
||||
});
|
||||
}
|
||||
|
||||
public boolean shown(){
|
||||
return shown;
|
||||
}
|
||||
|
||||
/** Show unlock notification for a new recipe. */
|
||||
public void showUnlock(UnlockableContent content){
|
||||
//some content may not have icons... yet
|
||||
|
||||
@@ -192,7 +192,7 @@ public class PlacementFragment extends Fragment{
|
||||
public void build(Group parent){
|
||||
parent.fill(full -> {
|
||||
toggler = full;
|
||||
full.bottom().right().visible(() -> ui.hudfrag.shown());
|
||||
full.bottom().right().visible(() -> ui.hudfrag.shown);
|
||||
|
||||
full.table(frame -> {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user