Custom launch items
This commit is contained in:
@@ -399,6 +399,13 @@ public class Schematics implements Loadable{
|
||||
}
|
||||
}
|
||||
|
||||
/** Places the last launch loadout at the coordinates and fills it with the launch resources. */
|
||||
public static void placeLaunchLoadout(int x, int y){
|
||||
placeLoadout(universe.getLastLoadout(), x, y);
|
||||
if(world.tile(x, y).build == null) throw new RuntimeException("No core at loadout coordinates!");
|
||||
world.tile(x, y).build.items.add(universe.getLaunchResources());
|
||||
}
|
||||
|
||||
public static void placeLoadout(Schematic schem, int x, int y){
|
||||
placeLoadout(schem, x, y, state.rules.defaultTeam, Blocks.oreCopper);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,9 @@ public class Universe{
|
||||
private float secondCounter;
|
||||
private int turn;
|
||||
private float turnCounter;
|
||||
|
||||
private Schematic lastLoadout = Loadouts.basicShard;
|
||||
private Seq<ItemStack> lastLaunchResources = new Seq<>();
|
||||
|
||||
public Universe(){
|
||||
load();
|
||||
@@ -75,6 +77,16 @@ public class Universe{
|
||||
}
|
||||
}
|
||||
|
||||
public Seq<ItemStack> getLaunchResources(){
|
||||
lastLaunchResources = Core.settings.getJson("launch-resources", Seq.class, ItemStack.class, Seq::new);
|
||||
return lastLaunchResources;
|
||||
}
|
||||
|
||||
public void updateLaunchResources(Seq<ItemStack> stacks){
|
||||
this.lastLaunchResources = stacks;
|
||||
Core.settings.putJson("launch-resources", ItemStack.class, lastLaunchResources);
|
||||
}
|
||||
|
||||
/** Updates selected loadout for future deployment. */
|
||||
public void updateLoadout(CoreBlock block, Schematic schem){
|
||||
Core.settings.put("lastloadout-" + block.name, schem.file == null ? "" : schem.file.nameWithoutExtension());
|
||||
|
||||
Reference in New Issue
Block a user