PlanetsLib


Code, graphics and conventions to help modders creating planets, moons and other systems. This is a community project.

Internal
8 days ago
2.0
54.7K

Changelog

Version: 1.11.1
Date: 2025-08-23
  Changes:
    - PlanetsLib_recipe_productivity_effects technology field will no longer add recipes with allow_productivity disabled unless PlanetsLib_recipe_productivity_effects.allow_recipes_without_productivity == true.
Version: 1.11.0
Date: 2025-08-18
  Features:
    - Added new helper function: PlanetsLib.crushing_recipe_icons.
    - Added new helper function: PlanetsLib.asteroid_crushing_recipe_icons.
    - Added new helper function: PlanetsLib.advanced_crushing_recipe_icon.
    - Migrated Cerys' centrifuge fluid box and graphical effects to PlanetsLib.
  Changes:
    - Added new library graphics: asteroid-crushing.png and generic-crushing.png
Version: 1.10.7
Date: 2025-08-16
  Changes:
    - Added new optional shadow_scale(number) parameter to technology_icon_moon and technology_icon_planet that adds a shadow layer to the returned icon when defined.
    - Added new library graphic: reprocessing-arrow.png
Version: 1.10.6
Date: 2025-08-14
  Changes:
    - Added new optional parameters to PlanetsLib.borrow_music: track_types(table) and modifier_function(function), both optional. New syntax: PlanetsLib.borrow_music(source_planet, target_planet, (optional) options{track_types,modifier_function})
Version: 1.10.5
Date: 2025-08-09
  Bugfixes:
    - Fixed a very rare crash in the cargo pod scripts.
Version: 1.10.4
Date: 2025-08-09
  Changes:
    - Added a new API to control the cargo drops whitelist using mod-data prototypes. The old remote interface API is still supported to avoid breaking changes.
Version: 1.10.3
Date: ???
  Changes:
    - Orbit generator script now can run as a standalone program that handles its own dependencies.
Version: 1.10.2
Date: 2025-08-02
  Bugfixes:
    - Fixed crash when another mod deletes effects from a vanilla recipe productivity technology before PlanetsLib loads its data stage.
Version: 1.10.1
Date: 2025-08-02
  Bugfixes:
    - Eliminated requirement to have an "effects" field when using "PlanetsLib_recipe_productivity_effects" in a technology.
Version: 1.10.0
Date: 2025-08-02
  Features:
    - Added TechnologyPrototype field "PlanetsLib_recipe_productivity_effects" field, must be added before data-final-fixes. Simplifies the maintenance of recipe productivity technologies by automatically adding every recipe that produces a particular item/fluid.
  Changes:
    - Added user-facing option to set PlanetsLib_recipe_productivity_effects field for relevant vanilla technologies. Enabled by default, but can be disabled when incompatibility issues are noted.
    - Added initial support for LDoc to prepare PlanetsLib for more proper documentation.
Version: 1.9.0
Date: 2025-08-02
  Bugfixes:
    - Fixed a bug in PlanetsLib:update() in which the positions of the given planet's children were not appropriately updated.
  Changes:
    - PlanetsLib:update() no longer supports taking an array of configs, unless the array has length 1.
Version: 1.8.3
Date: 2025-07-28
  Bugfixes:
    - Rocket silos locked after being set to a PlanetsLib-designated rocket part recipe.
Version: 1.8.2
Date: 2025-07-20
  Changes:
    - Removed debug code that made 'Logistic science pack' a hidden technology. Ecksdee.
Version: 1.8.1
Date: 2025-07-20
  Changes:
    - 'Unlinked prerequisites' text moved to locale file.
Version: 1.8.0
Date: 2025-07-20
  Changes:
    - Our first player-facing settings: 'Warn on hidden prerequisites' and 'Unlink hidden prerequisites'. These prevent unresearchable technologies from arising due to compatibility issues.
Version: 1.7.1-1.7.3
Date: 2025-07-20
  Changes:
    - In order for players to hold their tiers fixed and still be able to update PlanetsLib, the tiers have moved to a new mod: PlanetsLib: Tiers
    - You can now access their values using `local tier = data.raw["mod-data"]["PlanetsLib-tierlist"].data[type][name] or data.raw["mod-data"]["PlanetsLib-tierlist"].data.default`. (The APIs get_planet_tier and get_space_location_tier are now undocumented but still exist for backwards compatibility.)
  Info:
    - Changelog update.
Version: 1.7.0
Date: 2025-07-15
  Changes:
    - Added unified interface allowing planets to define rocket silo recipes on a per-surface basis.
Version: 1.6.4
Date: 2025-07-10
  Bugfixes:
    - Fixed a possible crash in the cargo pod remote interface.
  Locale:
    - Added German translation.
  Changes:
    - Update to the orbit generator script to support valid sprites for larger orbit radii.
Version: 1.6.3
Date: 2025-06-29
  Changes:
    - Tiers: Stargate from Metal and Stars to tier 4
Version: 1.6.2
Date: 2025-06-16
  Changes:
    - Fixed a crash when adding an item to the cargo drops whitelist for a specific planet.
Version: 1.6.1
Date: 2025-06-12
  Changes:
    - Tiers for Jahtra and Paracelsin added.
Version: 1.6.0
Date: 2025-06-11
  Changes:
    - Moved the 'tier' property to PlanetsLib from Organized Solar System, allowing other authors to make use of it. The tier is a number assigned to each planet to indicate where it likely appears in Space Age gameplay progression.
    - Rubia tier set to 4.5.
Version: 1.5.2
Date: 2025-06-02
  Changes:
    - Russian translation updated.
Version: 1.5.1
Date: 2025-05-25
  Changes:
    - Corrected the locale entries for cargo drops to remove the reference to construction robots.
Version: 1.5.0
Date: 2025-05-21
  Changes:
    - Deprecated the implicit APIs planetslib_sort_sciences and planetslib_ensure_all_packs_from_vanilla_lab in favor of PlanetsLib.sort_science_pack_names and PlanetsLib.add_science_packs_from_vanilla_lab_to_technology.
    - PlanetsLib no longer modifies the promethium-science-pack and research-productivity technologies to add packs from vanilla labs to them.
Version: 1.4.3
Date: 2025-05-15
  Changes:
    - Renamed the surface conditions Oxygen, Nitrogen, Carbon Dioxide and Argon to Atmospheric Oxygen, Atmospheric Nitrogen, Atmospheric Carbon Dioxide and Atmospheric Argon.
Version: 1.4.2
Date: 2025-05-13
  Changes:
    - Added a safety assertion in get_child_technologies.
Version: 1.4.1
Date: 2025-05-12
  Changes:
    - Construction robots are no longer whitelisted for cargo drops by default.
    - Remote interface provided for mods to whitelist cargo drop items.
Version: 1.4.0
Date: 2025-05-12
  Changes:
    - PlanetsLib no longer has Space Age as a mandatory dependency.
Version: 1.3.8
Date: 2025-05-11
  Changes:
    - New API: get_child_technologies.
Version: 1.3.7
Date: 2025-05-04
  Changes:
    - Fixed a crash caused presumably by another mod shadowing the 'util' namespace.
Version: 1.3.6
Date: 2025-05-02
  Changes:
    - Fixed a crash in excise_tech_from_tech_tree.
Version: 1.3.5
Date: 2025-05-02
  Changes:
    - Fixed a crash in remove_surface_condition.
Version: 1.3.4
Date: 2025-04-26
  Changes:
    - Fixed API export.
Version: 1.3.3
Date: 2025-04-26
  Changes:
    - New API: remove_surface_condition
Version: 1.3.2
Date: 2025-04-25
  Changes:
    - New API: excise_effect_from_tech_tree
Version: 1.3.1
Date: 2025-04-21
  Changes:
    - Renamed all the 'magic' fields supported on prototypes to start with 'planetslib_' to make them less cryptic. (The previous names are still supported.)
    - Removed unique planet surface conditions from the documentation for now as their error message is suboptimal.
Version: 1.3.0
Date: 2025-04-21
  Changes:
    - Added two new APIs: excise_tech_from_tech_tree and excise_recipe_from_tech_tree.
Version: 1.2.20
Date: 2025-04-15
  Changes:
    - The Cargo drop technology effect icon now matches the icon of the planet.
Version: 1.2.19
Date: 2025-04-14
  Changes:
    - Updated Ukrainian localization.
Version: 1.2.18
Date: 2025-04-10
  Changes:
    - Modified PlanetsLib.borrow_music() to allow the copying of music to/from "space-platform."
Version: 1.2.17
Date: 2025-04-03
  Info:
    - Added Space Age tag.
Version: 1.2.16
Date: 2025-03-18
  Changes:
    - Incompatility mark added for MT-lib.
Version: 1.2.15
Date: 2025-03-16
  Changes:
    - Performance improvement to the cargo pod restriction technology feature.
Version: 1.2.14
Date: 2025-03-16
  Changes:
    - If the 'type = "nothing"' effect is removed from a given cargo drops technology, PlanetsLib will no longer enforce that this technology must be researched to perform cargo drops.
Version: 1.2.13
Date: 2025-03-12
  Changes:
    - Compatibility fix to handle the case where the vanilla lab has duplicate science packs listed in its inputs.
Version: 1.2.12
Date: 2025-03-03
  Graphics:
    - Fixed positioning of corner icons in discovery technologies.
  Locale:
    - Russian locale update.
Version: 1.2.11
Date: 2025-02-26
  Changes:
    - Fixed a crash on missing 'deepcopy' field.
Version: 1.2.9
Date: 2025-02-24
  Changes:
    - Added an icon intended to represent item and recipes used only in ResearchProgressProducts.
Version: 1.2.8
Date: 2025-02-18
  Locale:
    - French localization added.
Version: 1.2.7
Date: 2025-02-18
  Changes:
    - Hidden optional dependency added for Cosmic Social Distancing.
Version: 1.2.6
Date: 2025-02-07
  Changes:
    - No longer write 'Space Locations' in the remote view planet GUI. Space locations isn't technically correct here.
Version: 1.2.5
Date: 2025-02-05
  Changes:
    - Fixed the API technology_icon_constant_planet.
Version: 1.2.4
Date: 2025-02-05
  Changes:
    - New thumbnail.
    - Image size compression.
Version: 1.2.3
Date: 2025-02-04
  Changes:
    - Fixed bug in which promethium science tech required promethium to research it.
Version: 1.2.2
Date: 2025-02-03
  Changes:
    - New API: technology_icon_planet
Version: 1.2.1
Date: 2025-02-03
  Changes:
    - Readme update.
Version: 1.2.0
Date: 2025-02-02
  Changes:
    - Mods are now able to move child locations simply by updating the position of the parent location. In data-final-fixes PlanetsLib now detects whether a location prototype's orbit object no longer matches the prototype's position and orientation fields, and if so, it applies the same positional shift to all that location's orbit children.
Version: 1.1.42
Date: 2025-02-02
  Changes:
    - Moved the nonfunctional orbit-setting code from data-final-fixes to data-updates.
Version: 1.1.41
Date: 2025-01-31
  Changes:
    - Rename give_all_packs_in_vanilla_lab to ensure_all_packs_from_vanilla_lab.
Version: 1.1.40
Date: 2025-01-31
  Changes:
    - New API: give_all_packs_in_vanilla_lab.
Version: 1.1.39
Date: 2025-01-31
  Changes:
    - Improve error message for specifying an orbit with a parent that doesn't exist.
Version: 1.1.38
Date: 2025-01-31
  Changes:
    - New helper: PlanetsLib.technology_icon_constant_planet.
Version: 1.1.37
Date: 2025-01-30
  Changes:
    - Updated the orbit image Python script to better center satellites on their orbit line.
Version: 1.1.36
Date: 2025-01-29
  Changes:
    - New APIs for management of science inputs in labs.
Version: 1.1.35
Date: 2025-01-27
  Changes:
    - borrow_music no longer copies hero tracks unless the `planet` field matches the source planet, matching the same behavior as other tracks.
Version: 1.1.34
Date: 2025-01-25
  Changes:
    - Fixed the size of the sun being slightly increased whilst PlanetsLib is installed.
  Locale:
    - Chinese update.
Version: 1.1.33
Date: 2025-01-24
  Locale:
    - Japanese added.
Version: 1.1.32
Date: 2025-01-23
  Changes:
    - New APIs: restrict_surface_conditions, relax_surface_conditions and restrict_to_planet.
Version: 1.1.31
Date: 2025-01-22
  Changes:
    - (Missing.)
Version: 1.1.30
Date: 2025-01-22
  Bugfixes:
    - Bugfix new API.
Version: 1.1.29
Date: 2025-01-22
  Changes:
    - Properly export new API.
Version: 1.1.28
Date: 2025-01-22
  Modding:
    - Simpler API for cargo drops technologies.
Version: 1.1.27
Date: 2025-01-19
  Changes:
    - Updated the orbit image generation script.
  Locale:
    - Description update.
Version: 1.1.26
Date: 2025-01-15
  Changes:
    - Readded PlanetsLib.borrow_music.
Version: 1.1.25
Date: 2025-01-15
  Changes:
    - Removed PlanetsLib.borrow_music for now until issues can be resolved.
Version: 1.1.24
Date: 2025-01-14
  Locale:
    - Fixed locale key.
Version: 1.1.23
Date: 2025-01-14
  Bugfixes:
    - Fixed crash when a planet has no surface properties.
Version: 1.1.22
Date: 2025-01-14
  Features:
    - PlanetsLib.exact_value(property,value):  Returns a surface condition locking the acceptable range of values to one.
    - PlanetsLib.restrict_to_surface(planet):  Returns a surface condition restricting a prototype to the provided planet.
    - Added hidden surface conditions "planet-str" and "parent-body". Each planet-str is by default based on the planet's internal name, and is expected to be unique. Moons have their parent body value set to their parent body's planet-str.
    - Added functions to set and get planet-str values.
  Info:
    - Added documentation for enabling optional surface conditions, in addition to everything else in this update.
    - Fixed incorrect API documentation for borrow_music and set_default_import_location.
  Locale:
    - Added set of description templates to standardize how the relationships between planets are moons are described.
Version: 1.1.21
Date: 2025-01-13
  Bugfixes:
    - Support for mods that delete all space locations.
Version: 1.1.20
Date: 2025-01-13
  Features:
    - The drawn starmap is now layered by a topological sort on the orbit structure.
    - Support for missing 'orientation' fields when the 'distance' is 0.
Version: 1.1.19
Date: 2025-01-12
  Changes:
    - Update Python script examples
Version: 1.1.18
Date: 2025-01-12
  Features:
    - Python script added to generate orbit images. This is a variation of MeteorSwarm's script.
Version: 1.1.17
Date: 2025-01-12
  Changes:
    - Better error handling for `PlanetsLib:update`.
Version: 1.1.16
Date: 2025-01-12
  Changes:
    - New API PlanetsLib:update to update existing planets or space location prototypes. Passing an `orbit` field will also update the `distance` and `orientation` fields of the prototype.
Version: 1.1.15
Date: 2025-01-12
  Info:
    - Changelog fix.
Version: 1.1.14
Date: 2025-01-12
  Features:
    - Support for all combinations of `starmap_icon`, `starmap_icons` and `sprite_only`. Previously, if `sprite_only` was true, `starmap_icons` was never read and it was impossible to hide the sprite by setting both to nil.
Version: 1.1.13
Date: 2025-01-10
  Graphics:
    - Reinstated orbit images files in case people find them helpful.
    - Compressed the image files.
Version: 1.1.12
Date: 2025-01-03
  Locale:
    - Czech localization added.
Version: 1.1.11
Date: 2025-01-03
  Changes:
    - Switched API from PlanetsLib:planet_extend to PlanetsLib:extend.
Version: 1.1.10
Date: 2025-01-02
  Locale:
    - Adds translation into Russian.
Version: 1.1.9
Date: 2025-01-02
  Changes:
    - Compatibility with mods that update the positions of planets of other mods.
Version: 1.1.8
Date: 2025-01-02
  Locale:
    - Added Chinese localization.
  Bugfixes:
    - Fixed solar system edge not having an orbit sprite.
Version: 1.1.7
Date: 2025-01-02
  Bugfixes:
    - Fixed crash for planets without surface properties.
Version: 1.1.6
Date: 2025-01-02
  Changes:
    - Surface conditions for gas composition.
    - New surface conditions are now off by default, unless requested by a mod.
Version: 1.1.5
Date: 2025-01-02
  Bugfixes:
    - Bail when updating the starmap for a planet without an 'orbit' field.
Version: 1.1.4
Date: 2025-01-02
  Bugfixes:
    - Fixed crash when space locations are added later than data.lua.
Version: 1.1.3
Date: 2025-01-02
  Changes:
    - Compatibility with mods that set the 'orbit' field of planets and space locations to other objects.
Version: 1.1.2
Date: 2025-01-01
  Changes:
    - is_space_location check enforced in planet_extend.
    - Readme note added about breaking changes will bump the major version. Special thanks added to MidnightTigger.
Version: 1.1.1
Date: 2025-01-01
  Info:
    - Readme fixes.
Version: 1.1.0
Date: 2025-01-01
  Changes:
    - API for planets switched from 'planet_type' to 'sprite_only'. This is now simply a boolean that determines whether the prototype should be removed in data-final-fixes and replaced by a sprite on the starmap. With this change, PlanetsLib now supports extra solar systems, binary systems, etc.
    - Form of 'parent' within 'orbit' changed to an object with 'type' and 'name' fields, rather than just a name.
    - Core locale overrides changes to use 'space location' terminology instead of planets and moons.
Version: 1.0.8
Date: 2025-01-01
  Bugfixes:
    - Fixed items in cargo pod drops being allowed if they were not associated to an entity in Factorio.
Version: 1.0.7
Date: 2024-12-31
  Info:
    - README.md update
Version: 1.0.6
Date: 2024-12-31
  Info:
    - README.md update
Version: 1.0.5
Date: 2024-12-31
  Changes:
    - Extract the unified API into 'api.lua' for clarity.
  Info:
    - Syncing of README.md to the mod portal.
Version: 1.0.4
Date: 2024-12-30
  Changes:
    - Organized exports into a single API file for readability.
Version: 1.0.3
Date: 2024-12-30
  Modding:
    - Compatibility with Organized Solar System.
Version: 1.0.2
Date: 2024-12-30
  Bugfixes:
    - Fixed a crash.
Version: 1.0.1
Date: 2024-12-30
  Modding:
    - Dependencies updated.
Version: 1.0.0
Date: 2024-12-30
  Modding:
    - APIs: PlanetsLib:planet_extend, PlanetsLib.technology_icons_moon, PlanetsLib.cargo_drops_tech_effect, PlanetsLib.technology_icons_planet_cargo_drops
    - When a technology with name '[planet_name]-cargo-drops' is created, cargo drops to that planet (excepting those with only players or construction robots) will be prevented until that technology is researched.