Class Planet

All Implemented Interfaces:
Comparable<Content>

public class Planet extends UnlockableContent
  • Field Details

    • mesh

      @Nullable public GenericMesh mesh
      Mesh used for rendering. Created on load() - will be null on the server!
    • cloudMesh

      @Nullable public GenericMesh cloudMesh
      Mesh used for rendering planet clouds. Null if no clouds are present.
    • gridMesh

      @Nullable public Mesh gridMesh
      Mesh used for rendering planet grid outlines. Null on server or if grid is null.
    • position

      public Vec3 position
      Position in global coordinates. Will be 0,0,0 until the Universe updates it.
    • grid

      @Nullable public PlanetGrid grid
      Grid used for the sectors on the planet. Null if this planet can't be landed on.
    • generator

      @Nullable public PlanetGenerator generator
      Generator that will make the planet. Can be null for planets that don't need to be landed on.
    • sectors

      public Seq<Sector> sectors
      Array of sectors; directly maps to tiles in the grid.
    • orbitSpacing

      public float orbitSpacing
      Default spacing between planet orbits in world units. This is defined per-parent!
    • radius

      public float radius
      Radius of this planet's sphere. Does not take into account satellites.
    • camRadius

      public float camRadius
      Camera radius offset.
    • minZoom

      public float minZoom
      Minimum camera zoom value.
    • drawOrbit

      public boolean drawOrbit
      Whether to draw the orbital circle.
    • atmosphereRadIn

      public float atmosphereRadIn
      Atmosphere radius adjustment parameters.
    • atmosphereRadOut

      public float atmosphereRadOut
      Atmosphere radius adjustment parameters.
    • clipRadius

      public float clipRadius
      Frustum sphere clip radius.
    • orbitRadius

      public float orbitRadius
      Orbital radius around the sun. Do not change unless you know exactly what you are doing.
    • totalRadius

      public float totalRadius
      Total radius of this planet and all its children.
    • orbitTime

      public float orbitTime
      Time for the planet to orbit around the sun once, in seconds. One year.
    • rotateTime

      public float rotateTime
      Time for the planet to perform a full revolution, in seconds. One day.
    • orbitOffset

      public float orbitOffset
      Random orbit angle offset to prevent planets from starting out in a line.
    • sectorApproxRadius

      public float sectorApproxRadius
      Approx. radius of one sector.
    • tidalLock

      public boolean tidalLock
      Whether this planet is tidally locked relative to its parent - see https://en.wikipedia.org/wiki/Tidal_locking
    • accessible

      public boolean accessible
      Whether this planet is listed in the planet access UI.
    • defaultEnv

      public int defaultEnv
      Environment flags for sectors on this planet.
    • defaultAttributes

      public Attributes defaultAttributes
      Environment attributes.
    • updateLighting

      public boolean updateLighting
      If true, a day/night cycle is simulated.
    • lightSrcFrom

      public float lightSrcFrom
      Day/night cycle parameters.
    • lightSrcTo

      public float lightSrcTo
      Day/night cycle parameters.
    • lightDstFrom

      public float lightDstFrom
      Day/night cycle parameters.
    • lightDstTo

      public float lightDstTo
      Day/night cycle parameters.
    • startSector

      public int startSector
      The default starting sector displayed to the map dialog.
    • sectorSeed

      public int sectorSeed
      Seed for sector base generation on this planet. -1 to use a random one based on ID.
    • launchCapacityMultiplier

      public float launchCapacityMultiplier
      multiplier for core item capacity when launching
    • bloom

      public boolean bloom
      Whether the bloom render effect is enabled.
    • visible

      public boolean visible
      Whether this planet is displayed.
    • landCloudColor

      public Color landCloudColor
      Tint of clouds displayed when landing.
    • lightColor

      public Color lightColor
      For suns, this is the color that shines on other planets. Does nothing for children.
    • atmosphereColor

      public Color atmosphereColor
      Atmosphere tint for landable planets.
    • iconColor

      public Color iconColor
      Icon for appearance in planet list.
    • hasAtmosphere

      public boolean hasAtmosphere
      Whether this planet has an atmosphere.
    • allowLaunchSchematics

      public boolean allowLaunchSchematics
      Whether to allow users to specify a custom launch schematic for this map.
    • allowLaunchLoadout

      public boolean allowLaunchLoadout
      Whether to allow users to specify the resources they take to this map.
    • allowWaveSimulation

      public boolean allowWaveSimulation
      Whether to allow sectors to simulate waves in the background.
    • allowSectorInvasion

      public boolean allowSectorInvasion
      Whether to simulate sector invasions from enemy bases.
    • clearSectorOnLose

      public boolean clearSectorOnLose
      If true, sectors saves are cleared when lost.
    • enemyBuildSpeedMultiplier

      public float enemyBuildSpeedMultiplier
      Multiplier for enemy rebuild speeds; only applied in campaign (not standard rules)
    • enemyCoreSpawnReplace

      public boolean enemyCoreSpawnReplace
      If true, enemy cores are replaced with spawnpoints on this planet (for invasions)
    • prebuildBase

      public boolean prebuildBase
      If true, blocks in the radius of the core will be removed and "built up" in a shockwave upon landing.
    • allowWaves

      public boolean allowWaves
      If true, waves are created on sector loss. TODO remove.
    • allowLaunchToNumbered

      public boolean allowLaunchToNumbered
      If false, players are unable to land on this planet's numbered sectors.
    • icon

      public String icon
      Icon as displayed in the planet selection dialog. This is a string, as drawables are null at load time.
    • defaultCore

      public Block defaultCore
      Default core block for launching.
    • ruleSetter

      public Cons<Rules> ruleSetter
      Sets up rules on game load for any sector on this planet.
    • parent

      @Nullable public Planet parent
      Parent body that this planet orbits around. If null, this planet is considered to be in the middle of the solar system.
    • solarSystem

      public Planet solarSystem
      The root parent of the whole solar system this planet is in.
    • children

      public Seq<Planet> children
      All planets orbiting this one, in ascending order of radius.
    • techTree

      @Nullable public TechTree.TechNode techTree
      Default root node shown when the tech tree is opened here.
    • launchCandidates

      public Seq<Planet> launchCandidates
      TODO remove? Planets that can be launched to from this one. Made mutual in init().
    • hiddenItems

      public Seq<Item> hiddenItems
      Items not available on this planet. Left out for backwards compatibility.
    • itemWhitelist

      public Seq<Item> itemWhitelist
      The only items available on this planet, if defined.
    • unlockedOnLand

      public Seq<UnlockableContent> unlockedOnLand
      Content (usually planet-specific) that is unlocked upon landing here.
    • meshLoader

      public Prov<GenericMesh> meshLoader
      Loads the mesh. Clientside only. Defaults to a boring sphere mesh.
    • cloudMeshLoader

      public Prov<GenericMesh> cloudMeshLoader
      Loads the mesh. Clientside only. Defaults to a boring sphere mesh.
    • gridMeshLoader

      public Prov<Mesh> gridMeshLoader
      Loads the planet grid outline mesh. Clientside only.
  • Constructor Details

    • Planet

      public Planet(String name, Planet parent, float radius)
    • Planet

      public Planet(String name, Planet parent, float radius, int sectorSize)
  • Method Details

    • getStartSector

      @Nullable public Sector getStartSector()
    • applyRules

      public void applyRules(Rules rules)
    • getLastSector

      @Nullable public Sector getLastSector()
    • setLastSector

      public void setLastSector(Sector sector)
    • preset

      public void preset(int index, SectorPreset preset)
    • hasGrid

      public boolean hasGrid()
      Returns:
      whether this planet has a sector grid to select.
    • isLandable

      public boolean isLandable()
      Returns:
      whether this planet has any sectors to land on.
    • updateTotalRadius

      public void updateTotalRadius()
    • getLightNormal

      public Vec3 getLightNormal()
    • getOrbitAngle

      public float getOrbitAngle()
      Calculates orbital rotation based on universe time.
    • getRotation

      public float getRotation()
      Calculates rotation on own axis based on universe time.
    • addParentOffset

      public Vec3 addParentOffset(Vec3 in)
      Adds this planet's offset relative to its parent to the vector. Used for calculating world positions.
    • getWorldPosition

      public Vec3 getWorldPosition(Vec3 in)
      Gets the absolute world position of this planet, taking into account all parents. O(n) complexity.
    • updateBaseCoverage

      public void updateBaseCoverage()
      Updates wave coverage of bases.
    • getTransform

      public Mat3D getTransform(Mat3D mat)
      Returns:
      the supplied matrix with transformation applied.
    • reloadMesh

      public void reloadMesh()
      Regenerates the planet mesh. For debugging only.
    • load

      public void load()
      Description copied from class: Content
      Called after all content is created, only on non-headless versions. Use for loading regions or other image data.
      Overrides:
      load in class Content
    • init

      public void init()
      Description copied from class: Content
      Called after all content and modules are created. Do not use to load regions or texture data!
      Overrides:
      init in class Content
    • getSector

      public Sector getSector(PlanetGrid.Ptile tile)
      Gets a sector a tile position.
    • getSector

      @Nullable public Sector getSector(Ray ray)
      Returns:
      the sector that is hit by this ray, or null if nothing intersects it.
    • getSector

      @Nullable public Sector getSector(Ray ray, float radius)
      Returns:
      the sector that is hit by this ray, or null if nothing intersects it.
    • intersect

      @Nullable public Vec3 intersect(Ray ray, float radius)
      Returns:
      the sector that is hit by this ray, or null if nothing intersects it.
    • isHidden

      public boolean isHidden()
      Planets cannot be viewed in the database dialog.
      Overrides:
      isHidden in class UnlockableContent
    • getContentType

      public ContentType getContentType()
      Description copied from class: Content
      Returns the type name of this piece of content. This should return the same value for all instances of this content type.
      Specified by:
      getContentType in class Content
    • visible

      public boolean visible()
    • draw

      public void draw(PlanetParams params, Mat3D projection, Mat3D transform)
    • drawAtmosphere

      public void drawAtmosphere(Mesh atmosphere, Camera3D cam)
    • drawClouds

      public void drawClouds(PlanetParams params, Mat3D projection, Mat3D transform)
    • drawBorders

      public void drawBorders(VertexBatch3D batch, Sector sector, Color base, float alpha)
      Draws sector borders. Supply the batch with triangle vertices.
    • fill

      public void fill(VertexBatch3D batch, Sector sector, Color color, float offset)
      Draws sector plane. Supply the batch with triangle vertices.
    • drawSelection

      public void drawSelection(VertexBatch3D batch, Sector sector, Color color, float stroke, float length)
      Draws sector when selected. Supply the batch with triangle vertices.
    • renderSectors

      public void renderSectors(VertexBatch3D batch, Camera3D cam, PlanetParams params)
      Renders sector outlines.
    • drawArc

      public void drawArc(VertexBatch3D batch, Vec3 a, Vec3 b, Color from, Color to, float length, float timeScale, int pointCount)
      Draws an arc from one point to another on the planet.