From ce92b48cf9b91e6cfe6471c6bc911e02212e52b9 Mon Sep 17 00:00:00 2001 From: Patrick Meade Date: Sat, 10 Jan 2026 22:46:04 -0600 Subject: [PATCH 1/3] First pass at modular ships --- code/__DEFINES/__starfly.dm | 1 + .../modules/starfly_ships/README.md | 38 ++++++++++++++ .../_maps/configs/pgf_crying_sun.json | 0 .../_maps/configs/srm_elder.json | 0 .../_maps/configs/syndicate_aegis.json | 0 .../configs/syndicate_cybersun_kansatsu.json | 0 modular_starfly/modules/starfly_ships/maps.sh | 51 +++++++++++++++++++ tgui/packages/tgui/starfly.ts | 1 + tools/build/build | 1 + tools/build/build.js | 22 +++++++- 10 files changed, 112 insertions(+), 2 deletions(-) create mode 100644 modular_starfly/modules/starfly_ships/README.md create mode 100644 modular_starfly/modules/starfly_ships/_maps/configs/pgf_crying_sun.json create mode 100644 modular_starfly/modules/starfly_ships/_maps/configs/srm_elder.json create mode 100644 modular_starfly/modules/starfly_ships/_maps/configs/syndicate_aegis.json create mode 100644 modular_starfly/modules/starfly_ships/_maps/configs/syndicate_cybersun_kansatsu.json create mode 100755 modular_starfly/modules/starfly_ships/maps.sh diff --git a/code/__DEFINES/__starfly.dm b/code/__DEFINES/__starfly.dm index 5c49118a1cd..5e09fd3b44e 100644 --- a/code/__DEFINES/__starfly.dm +++ b/code/__DEFINES/__starfly.dm @@ -44,4 +44,5 @@ #define STARFLY13_MODULE_ROSEUS_GALACTIC_ENABLED #define STARFLY13_MODULE_SINTA_UNATHI_ENABLED #define STARFLY13_MODULE_STARFLY_BRANDING_ENABLED +#define STARFLY13_MODULE_STARFLY_SHIPS_ENABLED #define STARFLY13_MODULE_YEOSA_UNATHI_ENABLED diff --git a/modular_starfly/modules/starfly_ships/README.md b/modular_starfly/modules/starfly_ships/README.md new file mode 100644 index 00000000000..bf957821926 --- /dev/null +++ b/modular_starfly/modules/starfly_ships/README.md @@ -0,0 +1,38 @@ +# Starfly-13 Ships + +Module ID: `STARFLY_SHIPS` + +## Description + +Removes non-lore ships and ship configurations in a modular way. New ships will appear in thier own modules. + +## TG Proc/File Changes + +- N/A + + +## Modular Overrides + +- N/A + + +## Defines + +- N/A + + +## Included files that are not contained in this module + +- N/A + + +## Credits + +- Patrick Meade created this module. diff --git a/modular_starfly/modules/starfly_ships/_maps/configs/pgf_crying_sun.json b/modular_starfly/modules/starfly_ships/_maps/configs/pgf_crying_sun.json new file mode 100644 index 00000000000..e69de29bb2d diff --git a/modular_starfly/modules/starfly_ships/_maps/configs/srm_elder.json b/modular_starfly/modules/starfly_ships/_maps/configs/srm_elder.json new file mode 100644 index 00000000000..e69de29bb2d diff --git a/modular_starfly/modules/starfly_ships/_maps/configs/syndicate_aegis.json b/modular_starfly/modules/starfly_ships/_maps/configs/syndicate_aegis.json new file mode 100644 index 00000000000..e69de29bb2d diff --git a/modular_starfly/modules/starfly_ships/_maps/configs/syndicate_cybersun_kansatsu.json b/modular_starfly/modules/starfly_ships/_maps/configs/syndicate_cybersun_kansatsu.json new file mode 100644 index 00000000000..e69de29bb2d diff --git a/modular_starfly/modules/starfly_ships/maps.sh b/modular_starfly/modules/starfly_ships/maps.sh new file mode 100755 index 00000000000..94c793671b8 --- /dev/null +++ b/modular_starfly/modules/starfly_ships/maps.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +# maps.sh + +set -euo pipefail + +# if this module isn't enabled, just bail out here (no error) +if ! grep -q '^#define STARFLY13_MODULE_STARFLY_SHIPS_ENABLED$' code/__DEFINES/__starfly.dm; then + exit 0 +fi + +# define some useful stuff +dest_maps="_maps" +modules_root="modular_starfly/modules" +starfly_maps="$modules_root/starfly_ships/_maps" + +# if _maps doesn't exist, just bail out here (error) +[[ -d "$dest_maps" ]] || { echo "ERROR: $dest_maps not found" >&2; exit 1; } + +# otherwise, its time to build up the custom maps staging directory +export STARFLY_MAPS_DIR=".staging/_maps" + +# ensure staging directory exists and is clean +rm -rf "$STARFLY_MAPS_DIR" +mkdir -p "$STARFLY_MAPS_DIR" + +# copy the original maps into our staging directory +echo "Copying: $dest_maps -> $STARFLY_MAPS_DIR/" +cp -a "$dest_maps"/. "$STARFLY_MAPS_DIR"/ + +# copy the custom maps provided by every other module +shopt -s nullglob +for module_dir in "$modules_root"/*/; do + [[ "${module_dir%/}" == "$modules_root/starfly_ships" ]] && continue + maps_dir="${module_dir%/}/_maps" + + [[ -d "$maps_dir" ]] || continue + + echo "Merging: $maps_dir -> $STARFLY_MAPS_DIR/" + cp -a "$maps_dir"/. "$STARFLY_MAPS_DIR"/ +done + +# remove all the maps specified by this module +if [[ -d "$starfly_maps" ]]; then + ( + cd "$starfly_maps" + find . -mindepth 1 -depth -print0 -type f + ) | while IFS= read -r -d '' relpath; do + echo "Removing: $STARFLY_MAPS_DIR/$relpath" + rm -rf "$STARFLY_MAPS_DIR/$relpath" + done +fi diff --git a/tgui/packages/tgui/starfly.ts b/tgui/packages/tgui/starfly.ts index f996d83bba1..f6f8e70d005 100644 --- a/tgui/packages/tgui/starfly.ts +++ b/tgui/packages/tgui/starfly.ts @@ -31,5 +31,6 @@ export const STARFLY13 = { MODULE_ROSEUS_GALACTIC_ENABLED: true, MODULE_SINTA_UNATHI_ENABLED: true, MODULE_STARFLY_BRANDING_ENABLED: true, + MODULE_STARFLY_SHIPS_ENABLED: true, MODULE_YEOSA_UNATHI_ENABLED: true, }; diff --git a/tools/build/build b/tools/build/build index 0e202e1bba7..f6af20fdcc2 100755 --- a/tools/build/build +++ b/tools/build/build @@ -1,4 +1,5 @@ #!/bin/sh set -e +modular_starfly/modules/starfly_ships/maps.sh cd "$(dirname "$0")" exec ../bootstrap/node build.js "$@" diff --git a/tools/build/build.js b/tools/build/build.js index 51198c716b6..6624c566bdf 100755 --- a/tools/build/build.js +++ b/tools/build/build.js @@ -26,6 +26,24 @@ Juke.setup({ file: import.meta.url }).then((code) => { const DME_NAME = "shiptest"; +//--------------------------------------------------------------------------------------------------------------------- +// STARFLY EDIT - ADDITION BEGIN +// #ifdef STARFLY13_MODULE_STARFLY_SHIPS_ENABLED +//--------------------------------------------------------------------------------------------------------------------- +const DEFAULT_MAPS_DIR = "_maps"; +const STAGED_MAPS_DIR = process.env.STARFLY_MAPS_DIR; // e.g. ".staging/_maps" + +// Use staged maps dir if provided AND it exists; otherwise normal _maps +const MAPS_DIR = + STAGED_MAPS_DIR && fs.existsSync(STAGED_MAPS_DIR) ? STAGED_MAPS_DIR : DEFAULT_MAPS_DIR; + +const mapsPath = (p) => `${MAPS_DIR}/${p}`; +const stripMapsPrefix = (p) => p.replace(`${MAPS_DIR}/`, ""); +//--------------------------------------------------------------------------------------------------------------------- +// #endif // #ifdef STARFLY13_MODULE_ADMIN_VERB_FREEZE_ENABLED +// STARFLY EDIT - ADDITION END +//--------------------------------------------------------------------------------------------------------------------- + export const DefineParameter = new Juke.Parameter({ type: "string[]", alias: "D", @@ -62,7 +80,7 @@ export const DmMapsIncludeTarget = new Juke.Target({ ]; const content = folders - .map((file) => file.replace("_maps/", "")) + .map(stripMapsPrefix) .map((file) => `#include "${file}"`) .join("\n") + "\n"; fs.writeFileSync("_maps/templates.dm", content); @@ -80,7 +98,7 @@ export const DmTarget = new Juke.Target({ get(DefineParameter).includes("ALL_MAPS") && DmMapsIncludeTarget, ], inputs: [ - "_maps/map_files/**", + mapsPath("map_files/**"), "code/**", "html/**", "icons/**", From 463fbc234572ed02cd2599298322e2ce601d3829 Mon Sep 17 00:00:00 2001 From: Patrick Meade Date: Sat, 10 Jan 2026 23:16:02 -0600 Subject: [PATCH 2/3] Just remove files, not entire directories --- modular_starfly/modules/starfly_ships/maps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modular_starfly/modules/starfly_ships/maps.sh b/modular_starfly/modules/starfly_ships/maps.sh index 94c793671b8..c1226a0b291 100755 --- a/modular_starfly/modules/starfly_ships/maps.sh +++ b/modular_starfly/modules/starfly_ships/maps.sh @@ -43,7 +43,7 @@ done if [[ -d "$starfly_maps" ]]; then ( cd "$starfly_maps" - find . -mindepth 1 -depth -print0 -type f + find . -type f -mindepth 1 -depth -print0 ) | while IFS= read -r -d '' relpath; do echo "Removing: $STARFLY_MAPS_DIR/$relpath" rm -rf "$STARFLY_MAPS_DIR/$relpath" From 992db6182e1570c4ea7b0cb65ebe2c04bd3a815c Mon Sep 17 00:00:00 2001 From: Patrick Meade Date: Sun, 11 Jan 2026 00:18:19 -0600 Subject: [PATCH 3/3] Finalize list of ships to be culled --- .../_maps/configs/{pgf_crying_sun.json => srm_sojourner.json} | 0 .../modules/starfly_ships/_maps/configs/syndicate_aegis.json | 0 .../starfly_ships/_maps/configs/syndicate_cybersun_kansatsu.json | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename modular_starfly/modules/starfly_ships/_maps/configs/{pgf_crying_sun.json => srm_sojourner.json} (100%) delete mode 100644 modular_starfly/modules/starfly_ships/_maps/configs/syndicate_aegis.json delete mode 100644 modular_starfly/modules/starfly_ships/_maps/configs/syndicate_cybersun_kansatsu.json diff --git a/modular_starfly/modules/starfly_ships/_maps/configs/pgf_crying_sun.json b/modular_starfly/modules/starfly_ships/_maps/configs/srm_sojourner.json similarity index 100% rename from modular_starfly/modules/starfly_ships/_maps/configs/pgf_crying_sun.json rename to modular_starfly/modules/starfly_ships/_maps/configs/srm_sojourner.json diff --git a/modular_starfly/modules/starfly_ships/_maps/configs/syndicate_aegis.json b/modular_starfly/modules/starfly_ships/_maps/configs/syndicate_aegis.json deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/modular_starfly/modules/starfly_ships/_maps/configs/syndicate_cybersun_kansatsu.json b/modular_starfly/modules/starfly_ships/_maps/configs/syndicate_cybersun_kansatsu.json deleted file mode 100644 index e69de29bb2d..00000000000