Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
1582c61
preset
silicons Jun 7, 2026
f2ee5de
hm
silicons Jun 8, 2026
241a33f
sigh
silicons Jun 8, 2026
b89d521
nightmare
silicons Jun 8, 2026
4da0543
that
silicons Jun 8, 2026
b03098f
sigh
silicons Jun 10, 2026
bc25ca7
wip
silicons Jun 12, 2026
1919be8
hm
silicons Jun 13, 2026
9431f47
update
silicons Jun 13, 2026
026cd01
that
silicons Jun 14, 2026
e7c5187
hm
silicons Jun 14, 2026
0e7645e
this
silicons Jun 14, 2026
eb0319f
this
silicons Jun 14, 2026
10ba50d
maps from ruskit
silicons Jun 17, 2026
ea100dc
there
silicons Jun 17, 2026
6d3edbf
update
silicons Jun 18, 2026
0fa647e
That
silicons Jun 18, 2026
a52d33b
that
silicons Jun 18, 2026
8412ae1
scna
silicons Jun 19, 2026
bdacd20
start grid
silicons Jun 20, 2026
e78fc3c
new
silicons Jun 21, 2026
5f76a42
Alignment
silicons Jun 23, 2026
2bb6d26
actual alignment
silicons Jun 23, 2026
1055873
hm
silicons Jun 23, 2026
d727d38
that
silicons Jun 23, 2026
5cdafc1
new join tagging system
silicons Jun 24, 2026
62cd9b6
add vars
silicons Jun 24, 2026
b54ac99
how many layers of indirection do you need to change a lightbulb
silicons Jun 24, 2026
bd04052
shenanigans
silicons Jun 27, 2026
65aa2b7
that
silicons Jun 27, 2026
e0c9997
update
silicons Jun 27, 2026
a4bc19a
update
silicons Jun 28, 2026
240a93c
next for match
silicons Jun 28, 2026
0a78c63
hm
silicons Jul 10, 2026
9bb44a4
those
silicons Jul 15, 2026
303dd0f
one less arg is good
silicons Jul 18, 2026
254e9df
That
silicons Jul 18, 2026
cc23546
now for algorithm
silicons Jul 18, 2026
992e6f6
the beloathed n^2
silicons Jul 20, 2026
6f8cc53
that
silicons Jul 20, 2026
57766a5
Merge remote-tracking branch 'upstream/master' into deepmaint-init
silicons Jul 20, 2026
646db54
that
silicons Jul 21, 2026
cfbfac0
off the fucking rails
silicons Jul 22, 2026
c63ee07
augh
silicons Jul 22, 2026
9c15922
That
silicons Jul 22, 2026
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
51 changes: 51 additions & 0 deletions citadel.dme
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
#include "code\__DEFINES\instruments.dm"
#include "code\__DEFINES\is_helpers.dm"
#include "code\__DEFINES\items_clothing.dm"
#include "code\__DEFINES\jigsaw.dm"
#include "code\__DEFINES\loadout.dm"
#include "code\__DEFINES\logging.dm"
#include "code\__DEFINES\machinery.dm"
Expand Down Expand Up @@ -597,6 +598,9 @@
#include "code\controllers\repository\designs.dm"
#include "code\controllers\repository\flooring.dm"
#include "code\controllers\repository\guidebook.dm"
#include "code\controllers\repository\jigsaw_generator_presets.dm"
#include "code\controllers\repository\jigsaw_template_packs.dm"
#include "code\controllers\repository\jigsaw_templates.dm"
#include "code\controllers\repository\languages.dm"
#include "code\controllers\repository\material_traits.dm"
#include "code\controllers\repository\materials.dm"
Expand Down Expand Up @@ -1161,9 +1165,11 @@
#include "code\game\area\Ship_Station_Areas.dm"
#include "code\game\area\Space Station 13 areas.dm"
#include "code\game\area\ss13_deprecated_areas.dm"
#include "code\game\area\submap.dm"
#include "code\game\area\Tether_areas.dm"
#include "code\game\area\station\exporation.dm"
#include "code\game\area\station\security_areas.dm"
#include "code\game\area\subtypes\space.dm"
#include "code\game\atoms\_atom.dm"
#include "code\game\atoms\action_feedback.dm"
#include "code\game\atoms\appearance.dm"
Expand Down Expand Up @@ -2449,6 +2455,7 @@
#include "code\modules\admin\admin_modal\admin_modal.dm"
#include "code\modules\admin\admin_modal\modals\admin_narrate.dm"
#include "code\modules\admin\admin_modal\modals\load_map_sector.dm"
#include "code\modules\admin\admin_modal\modals\spawn_jigsaw_dungeon.dm"
#include "code\modules\admin\admin_panel\admin_panel.dm"
#include "code\modules\admin\admin_panel\panels\gm_pings.dm"
#include "code\modules\admin\ban\ban_system_legacy.dm"
Expand Down Expand Up @@ -3468,6 +3475,30 @@
#include "code\modules\integrated_electronics\tools\debugger.dm"
#include "code\modules\integrated_electronics\tools\wirer.dm"
#include "code\modules\integrated_electronics\~defines\~defines.dm"
#include "code\modules\jigsaw\jigsaw_algorithm.dm"
#include "code\modules\jigsaw\jigsaw_buffer.dm"
#include "code\modules\jigsaw\jigsaw_buffer_enqueued.dm"
#include "code\modules\jigsaw\jigsaw_buffer_tile.dm"
#include "code\modules\jigsaw\jigsaw_chain_generator.dm"
#include "code\modules\jigsaw\jigsaw_chain_generator_config.dm"
#include "code\modules\jigsaw\jigsaw_chain_generator_resultant_config.dm"
#include "code\modules\jigsaw\jigsaw_chain_generator_results.dm"
#include "code\modules\jigsaw\jigsaw_generator.dm"
#include "code\modules\jigsaw\jigsaw_generator_config.dm"
#include "code\modules\jigsaw\jigsaw_generator_preset.dm"
#include "code\modules\jigsaw\jigsaw_generator_results.dm"
#include "code\modules\jigsaw\jigsaw_pattern.dm"
#include "code\modules\jigsaw\jigsaw_spawn_config.dm"
#include "code\modules\jigsaw\jigsaw_spawn_pack.dm"
#include "code\modules\jigsaw\jigsaw_spawn_resultant_config.dm"
#include "code\modules\jigsaw\jigsaw_template.dm"
#include "code\modules\jigsaw\jigsaw_template_config.dm"
#include "code\modules\jigsaw\jigsaw_template_pack.dm"
#include "code\modules\jigsaw\jigsaw_template_pattern.dm"
#include "code\modules\jigsaw\jigsaw_template_resultant_config.dm"
#include "code\modules\jigsaw\jigsaw_tile.dm"
#include "code\modules\jigsaw\map_helper\jigsaw_aligned_spawner.dm"
#include "code\modules\jigsaw\map_helper\jigsaw_spawn.dm"
#include "code\modules\keybindings\bindings_atom.dm"
#include "code\modules\keybindings\bindings_client.dm"
#include "code\modules\keybindings\focus.dm"
Expand Down Expand Up @@ -3639,30 +3670,41 @@
#include "code\modules\lore_hardcoded\species\xenomorph_hybrid\culture.dm"
#include "code\modules\lore_hardcoded\species\xenomorph_hybrid\origin.dm"
#include "code\modules\lore_hardcoded\species\xenomorph_hybrid\religion.dm"
#include "code\modules\mapping\auto_marker_config.dm"
#include "code\modules\mapping\map_generation.dm"
#include "code\modules\mapping\dmm_suite\dmm_context.dm"
#include "code\modules\mapping\dmm_suite\dmm_orientation.dm"
#include "code\modules\mapping\dmm_suite\dmm_parsed.dm"
#include "code\modules\mapping\dmm_suite\dmm_preloader.dm"
#include "code\modules\mapping\dmm_suite\dmm_report.dm"
#include "code\modules\mapping\dmm_suite\dmm_scan.dm"
#include "code\modules\mapping\dmm_suite\utility_types.dm"
#include "code\modules\mapping\map_helpers\baseturf.dm"
#include "code\modules\mapping\map_helpers\component_injector.dm"
#include "code\modules\mapping\map_helpers\electrochromatic_linker.dm"
#include "code\modules\mapping\map_helpers\engine_loader.dm"
#include "code\modules\mapping\map_helpers\fixed_template_seeding_target.dm"
#include "code\modules\mapping\map_helpers\gear_marker.dm"
#include "code\modules\mapping\map_helpers\map_helper.dm"
#include "code\modules\mapping\map_helpers\paint.dm"
#include "code\modules\mapping\map_helpers\paint_stripe.dm"
#include "code\modules\mapping\map_helpers\role_marker.dm"
#include "code\modules\mapping\map_helpers\template_loader.dm"
#include "code\modules\mapping\map_helpers\access_helper\access_helper.dm"
#include "code\modules\mapping\map_helpers\access_helper\airlock.dm"
#include "code\modules\mapping\map_helpers\network_builder\_network_builder.dm"
#include "code\modules\mapping\map_helpers\network_builder\power_cable.dm"
#include "code\modules\mapping\map_injection\fixed_template_seeding.dm"
#include "code\modules\mapping\map_injection\legacy_automata_caves.dm"
#include "code\modules\mapping\map_injection\legacy_jigsaw_worldgen_hijinks.dm"
#include "code\modules\mapping\map_injection\legacy_noise_ores.dm"
#include "code\modules\mapping\map_injection\legacy_seed_submaps.dm"
#include "code\modules\mapping\map_injection\map_injection.dm"
#include "code\modules\mapping\map_injection\starting_gear.dm"
#include "code\modules\mapping\map_system\map-legacy-station.dm"
#include "code\modules\mapping\map_system\map-load.dm"
#include "code\modules\mapping\map_system\map.dm"
#include "code\modules\mapping\map_system\map_context.dm"
#include "code\modules\mapping\map_system\map_level-cmp.dm"
#include "code\modules\mapping\map_system\map_level-legacy.dm"
#include "code\modules\mapping\map_system\map_level-load.dm"
Expand All @@ -3671,6 +3713,7 @@
#include "code\modules\mapping\map_system\map_level_trait.dm"
#include "code\modules\mapping\map_system\map_reservation.dm"
#include "code\modules\mapping\map_system\map_template.dm"
#include "code\modules\mapping\map_system\map_template_random.dm"
#include "code\modules\mapping\map_system\map\custom.dm"
#include "code\modules\mapping\map_system\map\gateway.dm"
#include "code\modules\mapping\map_system\map\sector.dm"
Expand All @@ -3681,6 +3724,7 @@
#include "code\modules\mapping\map_tests\map_test.dm"
#include "code\modules\mapping\map_tests\tests\airlock_linkage_test.dm"
#include "code\modules\mapping\spawner\_spawner.dm"
#include "code\modules\mapping\spawner\door.dm"
#include "code\modules\mapping\spawner\gateway.dm"
#include "code\modules\mapping\spawner\tcomms_relay.dm"
#include "code\modules\mapping\spawner\window.dm"
Expand Down Expand Up @@ -6114,13 +6158,17 @@
#include "maps\overmap\shuttles\pirateskiff.dm"
#include "maps\overmap\shuttles\skipjack.dm"
#include "maps\overmap\shuttles\specialops.dm"
#include "maps\sectors\debrisfield_192\debrisfield_192-areas.dm"
#include "maps\sectors\debrisfield_192\debrisfield_192.dm"
#include "maps\sectors\delerict_casino\delerict_casino-areas.dm"
#include "maps\sectors\delerict_casino\delerict_casino-misc.dm"
#include "maps\sectors\delerict_casino\delerict_casino.dm"
#include "maps\sectors\desert_192\desert_192-areas.dm"
#include "maps\sectors\desert_192\desert_192.dm"
#include "maps\sectors\event\halloween_map\halloween_ball.dm"
#include "maps\sectors\frozen_192\frozen_192-areas.dm"
#include "maps\sectors\frozen_192\frozen_192.dm"
#include "maps\sectors\gaia_192\gaia_192-areas.dm"
#include "maps\sectors\gaia_192\gaia_192.dm"
#include "maps\sectors\ice_comet\ice_comet-area.dm"
#include "maps\sectors\ice_comet\ice_comet-misc.dm"
Expand All @@ -6129,6 +6177,7 @@
#include "maps\sectors\miaphus\miaphus-misc.dm"
#include "maps\sectors\miaphus\miaphus-shuttles.dm"
#include "maps\sectors\miaphus\miaphus.dm"
#include "maps\sectors\mining_192\mining_192-areas.dm"
#include "maps\sectors\mining_192\mining_192.dm"
#include "maps\sectors\nebula_tradeport\nebula_tradeport-areas.dm"
#include "maps\sectors\nebula_tradeport\nebula_tradeport-misc.dm"
Expand All @@ -6138,6 +6187,7 @@
#include "maps\sectors\osiris_field\osiris_field-overmap.dm"
#include "maps\sectors\osiris_field\osiris_field-shuttles.dm"
#include "maps\sectors\osiris_field\osiris_field.dm"
#include "maps\sectors\piratebase_192\piratebase_192-areas.dm"
#include "maps\sectors\piratebase_192\piratebase_192.dm"
#include "maps\sectors\roguemining_192\roguemining_192.dm"
#include "maps\sectors\sky_planet\sky_planet-areas.dm"
Expand All @@ -6152,6 +6202,7 @@
#include "maps\sectors\surt\surt_areas.dm"
#include "maps\sectors\virgo2_140\virgo2_140.dm"
#include "maps\sectors\virgo4_140\virgo4_140.dm"
#include "maps\sectors\wasteland_192\wasteland_192-areas.dm"
#include "maps\sectors\wasteland_192\wasteland_192.dm"
#include "maps\shuttles\factions\corporations\nanotrasen\drone_prototype.dm"
#include "maps\shuttles\factions\corporations\nanotrasen\sci_vector.dm"
Expand Down
76 changes: 76 additions & 0 deletions code/__DEFINES/jigsaw.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2026 Citadel Station Developers *//

// --- Defines for 'jigsaw' module, a procedural dungeon / map generator. ---

//* Priorities *//

/**
* Set this if your templates should yield to other templates.
*/
#define JIGSAW_PRIORITY_YIELD_OTHERS -100

#define JIGSAW_PRIORITY_DEFAULT 0

/**
* Set this if your templates should trample over other templates.
*/
#define JIGSAW_PRIORITY_TRAMPLE_OTHERS 100

//* Common match / require / exclude tags *//

/**
* This means;
* * This side of the template is entirely contained within the grid bounds
*/
#define JIGSAW_MATCH_INSIDE_WALL "inside-wall"

/**
* This means;
* * This side of the template has a wall one outside the grid bounds.
*/
#define JIGSAW_MATCH_OUTSIDE_WALL "outside-wall"

/**
* This means;
* * This side of the template may be arbitrarily joined on the center 2 tiles
* of the inside/outside wall (depending on which other 'match' is set)
*/
#define JIGSAW_MATCH_CENTER_JOIN_2 "center-join-2"

/**
* This means;
* * This side of the template may be arbitrarily joined on the center 4 tiles
* of the inside/outside wall (depending on which other 'match' is set)
*/
#define JIGSAW_MATCH_CENTER_JOIN_4 "center-join-4"

/**
* This means;
* * This side of the template will always be airtight sealed on the join point,
* whether with doors or windows or walls.
* * The lack of JOIN_LEAKY doesn't imply JOIN_AIRTIGHT.
*/
#define JIGSAW_MATCH_JOIN_AIRTIGHT "join-airtight"

/**
* This means;
* * This side of the template will always *not* be airtight.
* * The lack of JOIN_AIRTIGHT doesn't imply JOIN_LEAKY.
*/
#define JIGSAW_MATCH_JOIN_LEAKY "join-leaky"

//* Spawn Tags *//

#define JIGSAW_SPAWN_TAG_MOB "mob"
#define JIGSAW_SPAWN_TAG_MOB_BOSS "mob-boss"
#define JIGSAW_SPAWN_TAG_MOB_RANGED "mob-ranged"
#define JIGSAW_SPAWN_TAG_MOB_MELEE "mob-melee"

#define JIGSAW_SPAWN_TAG_ITEM "item"
#define JIGSAW_SPAWN_TAG_ITEM_GUN "item-gun"
#define JIGSAW_SPAWN_TAG_ITEM_MELEE "item-melee"
#define JIGSAW_SPAWN_TAG_ITEM_ARMOR "item-armor"
#define JIGSAW_SPAWN_TAG_ITEM_SPACESUIT "item-spacesuit"
#define JIGSAW_SPAWN_TAG_ITEM_MEDICAL "item-medical"
#define JIGSAW_SPAWN_TAG_ITEM_MATERIALS "item-materials"
4 changes: 2 additions & 2 deletions code/__DEFINES/mapping/system.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
#define BLANK_TURF_TYPE /turf/space
#define BLANK_AREA_TYPE /area/space


/// Turf chunk resolution
///
/// * this is the most granular a turf reservation alloc can be (e.g. 8x8 for '8')
/// * this is the resolution of spatial gridmaps. why? this way spatial queries are aligned and super fast.
#define TURF_CHUNK_RESOLUTION 8
/// * World maxx/maxy must be a multiple of this.
#define TURF_ALIGNMENT 8

/// Z-Level border
///
Expand Down
4 changes: 2 additions & 2 deletions code/__HELPERS/lists/shuffle.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
*
* Shuffle by returning a new list.
*/
/proc/shuffle(list/L)
if(!L)
Expand All @@ -12,7 +12,7 @@
return L

/**
* Randomize: Returns nothing and acts on list in place.
* Shuffle a list in-place.
*/
/proc/shuffle_inplace(list/L)
if(!L)
Expand Down
7 changes: 7 additions & 0 deletions code/controllers/repository/jigsaw_generator_presets.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2024 Citadel Station Developers *//

REPOSITORY_DEF(jigsaw_generator_presets)
name = "Repository - Jigsaw Generator Presets"
expected_type = /datum/prototype/jigsaw_generator_preset
database_key = "jigsaw_generator_preset"
7 changes: 7 additions & 0 deletions code/controllers/repository/jigsaw_template_packs.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2024 Citadel Station Developers *//

REPOSITORY_DEF(jigsaw_template_packs)
name = "Repository - Jigsaw Template Packs"
expected_type = /datum/prototype/jigsaw_template_pack
database_key = "jigsaw_template_pack"
14 changes: 14 additions & 0 deletions code/controllers/repository/jigsaw_templates.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2024 Citadel Station Developers *//

REPOSITORY_DEF(jigsaw_templates)
name = "Repository - Jigsaw Templates"
expected_type = /datum/prototype/jigsaw_template
database_key = "jigsaw_template"

/datum/controller/repository/jigsaw_templates/proc/unload_caches()
for(var/id in id_lookup)
var/datum/prototype/jigsaw_template/instance = id_lookup[id]
if(!istype(instance))
continue
instance.unload_cache()
36 changes: 33 additions & 3 deletions code/controllers/subsystem/mapping/mapping-boot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,33 +37,63 @@
allocate_reserved_level()

/datum/controller/subsystem/mapping/proc/load_station(datum/map/station/instance)
// pull next map if needed
if(isnull(instance))
if(isnull(next_station))
read_next_map()
instance = next_station

// failed? get a random prod-ready map
if(isnull(instance))
var/list/datum/map/station/valid = list()
for(var/id in keyed_maps)
var/datum/map/station/map = keyed_maps[id]
if(!istype(map, /datum/map/station))
continue
if(!map.allow_random_draw)
if(!map.production_ready)
continue
valid += map
instance = pick(valid)

// requires
ASSERT(istype(instance))
ASSERT(isnull(loaded_station))
ASSERT(!initialized)
ASSERT(!world_is_loaded)

// calc size
var/init_width = instance.world_width
var/init_height = instance.world_height

if(init_width != instance.world_width || init_height != instance.world_height)
stack_trace("Station [instance] ([instance.id]) had mismatch width/height (map [init_width]x[init_height] vs declared world [instance.world_width]x[instance.world_height]). \
Stations should have the same width/height as the world.")
init_width = instance.world_width
init_height = instance.world_height

if(init_width % TURF_ALIGNMENT != 0 || init_height % TURF_ALIGNMENT != 0)
stack_trace("Station [instance] ([instance.id]) has world dimensions that are not a multiple of TURF_ALIGNMENT ([TURF_ALIGNMENT]). \
Stations must have world dimensions that are a multiple of TURF_ALIGNMENT. Automatically aligning upwards.")

init_width = CEILING(init_width, TURF_ALIGNMENT)
init_height = CEILING(init_height, TURF_ALIGNMENT)

// bootstrap
bootstrap_world(max(instance.world_width, instance.width), max(instance.world_height, instance.height))
bootstrap_world(
init_width,
init_height,
)

// mark
world_is_loaded = TRUE
loaded_station = instance

// pick gateway level - this must happen after the station is picked as it's added to the lateload list
createRandomGatewayLevel()

// load
load_map(instance, TRUE)

return TRUE

/datum/controller/subsystem/mapping/proc/write_next_map(datum/map/station/next)
Expand Down Expand Up @@ -143,7 +173,7 @@
if(!istype(checking))
// not a station map
continue
if(!checking.allow_random_draw)
if(!checking.production_ready)
continue
potential += checking
return SAFEPICK(potential)
Loading
Loading