Launch pad destination selection

This commit is contained in:
Anuken
2020-09-23 18:00:24 -04:00
parent 1cc8d7e3f4
commit 3db2ffb843
8 changed files with 101 additions and 39 deletions
+8
View File
@@ -33,6 +33,8 @@ public class SectorInfo{
public boolean hasCore = true;
/** Sector that was launched from. */
public @Nullable Sector origin;
/** Launch destination. */
public @Nullable Sector destination;
/** Resources known to occur at this sector. */
public Seq<UnlockableContent> resources = new Seq<>();
/** Time spent at this sector. Do not use unless you know what you're doing. */
@@ -43,6 +45,12 @@ public class SectorInfo{
/** Core item storage to prevent spoofing. */
private transient int[] lastCoreItems;
/** @return the real location items go when launched on this sector */
public Sector getRealDestination(){
//on multiplayer the destination is, by default, the first captured sector (basically random)
return !net.client() || destination != null ? destination : state.rules.sector.planet.sectors.find(Sector::hasBase);
}
/** Updates export statistics. */
public void handleItemExport(ItemStack stack){
handleItemExport(stack.item, stack.amount);