Launch pad destination selection
This commit is contained in:
@@ -5,6 +5,7 @@ import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
@@ -34,6 +35,7 @@ public class LaunchPad extends Block{
|
||||
hasItems = true;
|
||||
solid = true;
|
||||
update = true;
|
||||
configurable = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -51,6 +53,7 @@ public class LaunchPad extends Block{
|
||||
}
|
||||
|
||||
public class LaunchPadBuild extends Building{
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
super.draw();
|
||||
@@ -107,6 +110,30 @@ public class LaunchPad extends Block{
|
||||
Effect.shake(3f, 3f, this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void display(Table table){
|
||||
super.display(table);
|
||||
|
||||
table.row();
|
||||
table.label(() -> {
|
||||
Sector dest = state.secinfo.getRealDestination();
|
||||
|
||||
return Core.bundle.format("launch.destination",
|
||||
dest == null ? Core.bundle.get("sectors.sundest") :
|
||||
dest.preset == null ?
|
||||
"[accent]Sector " + dest.id :
|
||||
"[accent]" + dest.preset.localizedName);
|
||||
}).pad(4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildConfiguration(Table table){
|
||||
table.button(Icon.upOpen, Styles.clearTransi, () -> {
|
||||
ui.planet.showSelect(state.rules.sector, other -> state.secinfo.destination = other);
|
||||
deselect();
|
||||
}).size(40f);
|
||||
}
|
||||
}
|
||||
|
||||
@EntityDef(LaunchPayloadc.class)
|
||||
@@ -176,8 +203,7 @@ public class LaunchPad extends Block{
|
||||
public void remove(){
|
||||
if(!state.isCampaign()) return;
|
||||
|
||||
//on multiplayer the destination is a the first captured sector (basically random)
|
||||
Sector destsec = !net.client() ? state.secinfo.origin : state.rules.sector.planet.sectors.find(Sector::hasBase);
|
||||
Sector destsec = state.secinfo.getRealDestination();
|
||||
|
||||
//actually launch the items upon removal
|
||||
if(team() == state.rules.defaultTeam){
|
||||
@@ -193,12 +219,6 @@ public class LaunchPad extends Block{
|
||||
}
|
||||
|
||||
destsec.setExtraItems(dest);
|
||||
}else if(team().core() != null){
|
||||
//dump launched stuff into the core
|
||||
for(ItemStack stack : stacks){
|
||||
int min = Math.min(team().core().block.itemCapacity - team().core().items.get(stack.item), stack.amount);
|
||||
team().core().items.add(stack.item, min);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -425,20 +425,12 @@ public class LogicBlock extends Block{
|
||||
|
||||
@Override
|
||||
public void buildConfiguration(Table table){
|
||||
Table cont = new Table();
|
||||
cont.defaults().size(40);
|
||||
|
||||
cont.button(Icon.pencil, Styles.clearTransi, () -> {
|
||||
table.button(Icon.pencil, Styles.clearTransi, () -> {
|
||||
Vars.ui.logic.show(code, code -> {
|
||||
configure(compress(code, relativeConnections()));
|
||||
});
|
||||
});
|
||||
|
||||
//cont.button(Icon.refreshSmall, Styles.clearTransi, () -> {
|
||||
|
||||
//});
|
||||
|
||||
table.add(cont);
|
||||
}).size(40);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user