Code, graphics and conventions to help modders creating planets, moons and other systems. This library is a community project and will grow over time. Feel free to contribute via pull requests on Github.
We try to avoid breaking changes. In the unlikely event breaking changes occur, the major version of Planetslib will be bumped (unless the feature is unused.)
Contributors:
PlanetsLib:extend(config)— A wrapper/replacement fordata:extend. Throws an error if passeddistanceororientation. It instead takes the fields listed below.type—"planet"or"space-location"orbit— Object containing orbital parameters:parent— Object containingnameandtypefields, corresponding to a parent atdata.raw[type][name]. Planets in the original solar system should have an orbit withtype = "space-location"andname = "star".distance— Number: orbital distance from parentorientation— Number: orbital angle from parent (0-1). Note that orientation is absolute, not relative to the parent's orientation.sprite— Object: Sprite for the orbit, centered on its parent
sprite_only— Boolean (optional): If true, this prototype will be removed indata-final-fixesand replaced by its sprites on the starmap (unless neitherstarmap_icon,starmap_iconsnor an orbit sprite are defined, in which case nothing will show).- This is useful for constructing stars and other locations that should not have a space platform 'docking ring'.
- Other valid
planetorspace-locationprototype fields - Further notes on
PlanetsLib:extend:
PlanetsLib:update(config)— The same asPlanetsLib:extend, except it updates a pre-existing planet or space location (identified by the passedtypeandnamefields) using the parameters passed. If theorbitfield is passed, thedistanceandorientationfields on the prototype will be updated appropriately. Should not be called indata-final-fixes.PlanetsLib:borrow_music(source_planet, target_planet)- Clones music tracks from an existing planet to a new one.PlanetsLib:set_default_import_location(item_name, planet)- Sets the default import location for an item on a planet.
The library provides automatic functionality to restrict cargo drops on your planet until a technology is researched. To implement:
- Define a technology with name pattern:
[planet-name]-cargo-drops- Use the provided helper functions:
PlanetsLib.technology_icons_planet_cargo_dropsPlanetsLib.technology_effect_cargo_drops
Players will be unable to drop cargo (excluding players and construction robots) to planets with that name before researching the technology.
PlanetsLib.technology_icons_moon— Standardized icon for moon discovery technology.subgroup=satellites— A new Factoriopedia row for satellites (below the planets row).
Documentation pending.