Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions code/__DEFINES/__starfly.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
38 changes: 38 additions & 0 deletions modular_starfly/modules/starfly_ships/README.md
Original file line number Diff line number Diff line change
@@ -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
<!-- If you edited any core procs, you should list them here. You should specify the files and procs you changed.
E.g:
- `code/modules/mob/living.dm`: `proc/overriden_proc`, `var/overriden_var`
-->

## Modular Overrides

- N/A
<!-- If you added a new modular override (file or code-wise) for your module, you should list it here. Code files should specify what procs they changed, in case of multiple modules using the same file.
E.g:
- `modular_starfly/master_files/sound/my_cool_sound.ogg`
- `modular_starfly/master_files/code/my_modular_override.dm`: `proc/overriden_proc`, `var/overriden_var`
-->

## Defines

- N/A
<!-- If you needed to add any defines, mention the files you added those defines in, along with the name of the defines. -->

## Included files that are not contained in this module

- N/A
<!-- Likewise, be it a non-modular file or a modular one that's not contained within the folder belonging to this specific module, it should be mentioned here. Good examples are icons or sounds that are used between multiple modules, or other such edge-cases. -->

## Credits

- Patrick Meade created this module.
Empty file.
Empty file.
51 changes: 51 additions & 0 deletions modular_starfly/modules/starfly_ships/maps.sh
Original file line number Diff line number Diff line change
@@ -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 . -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"
done
fi
1 change: 1 addition & 0 deletions tgui/packages/tgui/starfly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
1 change: 1 addition & 0 deletions tools/build/build
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
set -e
modular_starfly/modules/starfly_ships/maps.sh
cd "$(dirname "$0")"
exec ../bootstrap/node build.js "$@"
22 changes: 20 additions & 2 deletions tools/build/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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);
Expand All @@ -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/**",
Expand Down
Loading