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 arc.graphics.Mesh gridMesh
      Mesh used for rendering planet grid outlines. Null on server or if grid is null.
    • position

      public arc.math.geom.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 arc.struct.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.
    • maxZoom

      public float maxZoom
      Maximum 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 arc.graphics.Color landCloudColor
      Tint of clouds displayed when landing.
    • lightColor

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

      public arc.graphics.Color atmosphereColor
      Atmosphere tint for landable planets.
    • iconColor

      public arc.graphics.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.
    • allowLegacyLaunchPads

      public boolean allowLegacyLaunchPads
      If true, legacy launch pads can be enabled.
    • 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.
    • allowCampaignRules

      public boolean allowCampaignRules
      If true, the player is allowed to change the difficulty/rules in the planet UI.
    • icon

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

      public arc.audio.Music launchMusic
      Plays in the planet dialog when this planet is selected.
    • defaultCore

      public Block defaultCore
      Default core block for launching.
    • 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 arc.struct.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 arc.struct.Seq<Planet> launchCandidates
      Planets that can be launched to from this one.
    • allowSelfSectorLaunch

      public boolean allowSelfSectorLaunch
      Whether interplanetary accelerators can launch to 'any' procedural sector on this planet's surface.
    • autoAssignPlanet

      public boolean autoAssignPlanet
      If true, all content in this planet's tech tree will be assigned this planet in their shownPlanets.
    • unlockedOnLand

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

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

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

      public arc.func.Prov<arc.graphics.Mesh> gridMeshLoader
      Loads the planet grid outline mesh. Clientside only.
    • campaignRules

      public CampaignRules campaignRules
      Global difficulty/modifier settings for this planet's campaign.
    • campaignRuleDefaults

      public CampaignRules campaignRuleDefaults
      Defaults applied to the rules.
    • ruleSetter

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

      public boolean showRtsAIRule
      If true, RTS AI can be customized.
    • loadPlanetData

      public boolean loadPlanetData
      If true, planet data is loaded as 'planets/{name}.json'. This is only tested/functional in vanilla!
    • data

      @Nullable public Planet.PlanetData data
      Data indicating attack sector positions and sector mappings.
  • Constructor Details

    • Planet

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

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

    • saveRules

      public void saveRules()
    • loadRules

      public void loadRules()
    • getStartSector

      @Nullable public Sector getStartSector()
    • applyRules

      public void applyRules(Rules rules)
    • applyRules

      public void applyRules(Rules rules, boolean customGame)
    • applyDefaultRules

      public void applyDefaultRules(CampaignRules 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 arc.math.geom.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 arc.math.geom.Vec3 addParentOffset(arc.math.geom.Vec3 in)
      Adds this planet's offset relative to its parent to the vector. Used for calculating world positions.
    • getWorldPosition

      public arc.math.geom.Vec3 getWorldPosition(arc.math.geom.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 arc.math.geom.Mat3D getTransform(arc.math.geom.Mat3D mat)
      Returns:
      the supplied matrix with transformation applied.
    • reloadMesh

      public void reloadMesh()
      Regenerates the planet mesh.
    • reloadMeshAsync

      public void reloadMeshAsync()
    • 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
    • getData

      @Nullable public Planet.PlanetData getData()
    • getSector

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

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

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

      @Nullable public arc.math.geom.Vec3 intersect(arc.math.geom.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, arc.math.geom.Mat3D projection, arc.math.geom.Mat3D transform)
    • drawAtmosphere

      public void drawAtmosphere(arc.graphics.Mesh atmosphere, arc.graphics.g3d.Camera3D cam)
    • drawClouds

      public void drawClouds(PlanetParams params, arc.math.geom.Mat3D projection, arc.math.geom.Mat3D transform)
    • drawBorders

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

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

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

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

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

      public void drawArcLine(arc.graphics.g3d.VertexBatch3D batch, arc.math.geom.Vec3 a, arc.math.geom.Vec3 b, arc.graphics.Color from, arc.graphics.Color to, float length, float timeScale, int pointCount, float stroke)
      Draws an arc from one point to another on the planet. Has thickness.
    • lookAt

      public arc.math.geom.Vec3 lookAt(Sector sector, arc.math.geom.Vec3 out)
    • project

      public arc.math.geom.Vec3 project(Sector sector, arc.graphics.g3d.Camera3D cam, arc.math.geom.Vec3 out)
    • setPlane

      public void setPlane(Sector sector, arc.graphics.g3d.PlaneBatch3D projector)