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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,6 @@ check_regex_output.txt

# local development secrets
/secret

# map build directory
/_maps2eb
2 changes: 1 addition & 1 deletion _maps/ship_config_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"title": "Map File Path",
"type": "string",
"description": "The path to the ship class's map file. Use forward slashes (/) for directories, and include the .dmm extension. Map files must be somewhere under the _maps folder.",
"pattern": "^_maps/([a-zA-Z0-9_/.-]*)dmm$"
"pattern": "^.*_maps/([a-zA-Z0-9_/.-]*)dmm$"
},
"job_slots": {
"title": "Job Slots",
Expand Down
2 changes: 1 addition & 1 deletion code/__DEFINES/__starfly.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,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_STARFLY_MAPS_ENABLED
#define STARFLY13_MODULE_YEOSA_UNATHI_ENABLED
29 changes: 29 additions & 0 deletions code/__DEFINES/__starflymaps.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// __starflymaps.dm
// Copyright 2026 Patrick Meade.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//---------------------------------------------------------------------------

// if we weren't provided with a MAPROOT at build time
#ifndef MAPROOT
// if we're using STARFLY-13 maps...
#ifdef STARFLY13_MODULE_STARFLY_MAPS_ENABLED
// STARFLY-13 maps are located at _maps 2: electric boogaloo
#define MAPROOT "_maps2eb"
// otherwise...
#else
// Shiptest maps are located at _maps
#define MAPROOT "_maps"
#endif // #ifdef STARFLY13_MODULE_STARFLY_MAPS_ENABLED
#endif // #ifndef MAPROOT
28 changes: 23 additions & 5 deletions code/controllers/subsystem/mapping.dm
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ SUBSYSTEM_DEF(mapping)

#define INIT_ANNOUNCE(X) to_chat(world, span_boldannounce("[X]")); log_world(X)

/datum/controller/subsystem/mapping/proc/preloadTemplates(path = "_maps/templates/") //see master controller setup
/datum/controller/subsystem/mapping/proc/preloadTemplates(path = MAPROOT + "/templates/") //see master controller setup
var/list/filelist = flist(path)
for(var/map in filelist)
var/datum/map_template/T = new(path = "[path][map]", rename = "[map]")
Expand Down Expand Up @@ -181,12 +181,12 @@ SUBSYSTEM_DEF(mapping)
#define CHECK_LIST_EXISTS(X) if(!islist(data[X])) { stack_trace("[##X] missing from json!"); continue; }
/datum/controller/subsystem/mapping/proc/load_ship_templates()
ship_purchase_list = list()
var/list/filelist = flist("_maps/configs/")
var/list/filelist = flist(MAPROOT + "/configs/")

filelist = sortList(filelist)

for(var/filename in filelist)
var/file = file("_maps/configs/" + filename)
var/file = file(MAPROOT + "/configs/" + filename)
if(!file)
stack_trace("Could not open map config: [filename]")
continue
Expand All @@ -203,8 +203,9 @@ SUBSYSTEM_DEF(mapping)
CHECK_STRING_EXISTS("map_name")
CHECK_STRING_EXISTS("map_path")
CHECK_LIST_EXISTS("job_slots")
var/datum/map_template/shuttle/S = new(data["map_path"], data["map_name"], TRUE)
S.file_name = data["map_path"]
var/fixed_path = fix_map_path(data["map_path"])
var/datum/map_template/shuttle/S = new(fixed_path, data["map_name"], TRUE)
S.file_name = fixed_path
S.ship_class = data["map_name"]

if(istext(data["map_short_name"]))
Expand Down Expand Up @@ -446,3 +447,20 @@ SUBSYSTEM_DEF(mapping)
height--
var/list/allocation_coords = SSmapping.get_free_allocation(allocation_type, width, height, allocation_jump)
return new /datum/virtual_level(new_name, traits, mapzone, allocation_coords[1], allocation_coords[2], allocation_coords[1] + width, allocation_coords[2] + height, allocation_coords[3])



/proc/fix_map_path(var/path)
if(!istext(path))
return path

// Match everything up to and including "_maps"
var/regex/r = regex(@"^.*_maps")

// If it matches, replace that portion with MAPROOT
if(r.Find(path))
var/new_path = r.Replace(path, MAPROOT)
return new_path

// If no match, just return original (or you could warn)
return path
2 changes: 1 addition & 1 deletion code/controllers/subsystem/overmap.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1283,5 +1283,5 @@ SUBSYSTEM_DEF(overmap)
name = "Abandoned - New Dawn"
can_be_selected_randomly = FALSE
can_jump_to = FALSE
json = '_maps/sectors/sunset_starsystem.json'
json = MAPROOT + "/sectors/sunset_starsystem.json"
generator_type = OVERMAP_GENERATOR_JSON
Loading
Loading