From d6dcdd85a3c3e27a80975693f4be665f95c43026 Mon Sep 17 00:00:00 2001 From: Nicholas Gower Date: Sat, 18 Jan 2025 16:34:47 -0800 Subject: [PATCH] Added space location subgroups for gas giants, asteroid belts, and dwarf planets. --- README.md | 6 ++++++ data-final-fixes.lua | 11 +++++++++++ prototypes/categories.lua | 18 ++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/README.md b/README.md index 709ed60..e519759 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,12 @@ The library provides automatic functionality to restrict cargo drops on your pla * `PlanetsLib.technology_icons_moon` — Icon to be used in moon discovery technologies. * `subgroup=satellites` — A new Factoriopedia row for satellites (below the planets row). +### Other subgroups + +* `subgroup=gas-giants` — A Factoriopedia row for gas giants. +* `subgroup=asteroid-belts` — A Factoriopedia row for asteroid belts. If any asteroid belts are defined, the Shattered planet's subgroup will be changed to this. +* `subgroup=dwarf-planets` — A Factoriopedia row for dwarf planets. + ### Description templates Documentation pending. diff --git a/data-final-fixes.lua b/data-final-fixes.lua index b02bde5..00e81c9 100644 --- a/data-final-fixes.lua +++ b/data-final-fixes.lua @@ -11,6 +11,17 @@ for _, planet in pairs(planets) do end end +--If any modded asteroid belts exist, the Shattered planet's subcategory will change to "asteroid-belt." +local has_asteroid_belts = false +for _, location in pairs(data.raw["space-location"]) do + if location.subgroup == "asteroid-belts" then + has_asteroid_belts = true + end +end +if has_asteroid_belts then + data.raw["space-location"]["shattered-planet"].subgroup = "asteroid-belts" +end + for _, type in pairs({ "space-location", "planet" }) do for _, location in pairs(data.raw[type]) do if diff --git a/prototypes/categories.lua b/prototypes/categories.lua index f9b59d1..80f3857 100644 --- a/prototypes/categories.lua +++ b/prototypes/categories.lua @@ -5,4 +5,22 @@ data:extend({ group = "space", order = "j-a", }, + { + type = "item-subgroup", + name = "gas-giants", + group = "space", + order = "j-b", + }, + { + type = "item-subgroup", + name = "asteroid-belts", + group = "space", + order = "j-c", + }, + { + type = "item-subgroup", + name = "dwarf-planets", + group = "space", + order = "j-d", + }, })