Files
Paradise/code/datums/helper_datums/map_template.dm
Charlie Nolan d3584b1d1c LINDA -> MILLA (#25328)
* LINDA -> MILLA

* Tiles now change their atmos mode properly.

* Fixed a bug that made walls generate supercold air when deconstructed/destroyed.

* Apply suggestions from code review

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
Co-authored-by: GDN <96800819+GDNgit@users.noreply.github.com>
Signed-off-by: Charlie Nolan <funnyman3595@gmail.com>

* Begone, var!

* MILLA -> milla

* Lint.

* More lint.

* Prevent negative/NaN atmos from spreading.

* Made fires start more reliably.

* Undef what the rest should not see.

* Enums are nice.

* Match LINDA better.

* Debugging verbs.

* Debug verb fixes.

* Labelled more lavaland stuff with ATMOS_MODE_LAVALAND

* Block superconductivity on a couple more things for Lavaland.

* Updated milla.dll

* Lavaland map fixes.

* Missed a spot.

* Begone, var! (again)

* Add libmilla_ci.so for continuous integration tests.

* Install/contributing instructions for MILLA.

* Directional plasmaglass windows on shuttles shouldn't stop protecting from heat after moving.

* Banish bad naming.

* Better naming and debug stats for SSair.

* Apply suggestions from code review

Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
Signed-off-by: Charlie Nolan <funnyman3595@gmail.com>

* Magic numbers and formatting.

* Don't screw up the temperature during reactions.

* Efficiency and readability.

* Fix hotspots.

* Removed redundant safety (MILLA will already output an error)

* Optimizations.

* oops

* TGS build script update.

* Change API of gas_mixture and how you get one from a turf.

* Get in there.

* so many vars

* MILLA binary updates.

* Lint

* Made MT cost more honest.

* Gave MILLA a read-only mode.

* More read-only vs synchronized mode work.

* Even more.

* Synchronize disposals.

* Updated a bunch of stuff to use SSair.synchronize or GM.synchronize.

* MILLA <3 Tracy

* lint

* cargo fmt

* more lint

* Test needed MILLA sync.

* Silence atmos machinery that's behaving as intended, but continue objecting to other potential failures to synchronize.

* Push new MILLA DLL

* Build MILLA

* Update PR instructions for MILLA.

* Add some fancy plasmaglass windows to the Lifebringers' ship.

* The golems remembered that they should insulate *all* their engines.

* First round of TM bugfixes.

* Build MILLA

* fix two lavaland ruin turf types

* bunch more maps

* fixes milla ci and makes the interesting turf verb better

* Solid turfs can no longer conduct heat (for now...)

* Made indoor tiles in beach and winter biodomes not lavaland air.

* Re-added random IT teleport, adjusted warning message

* Fixed a tinted window on Lavaland to be a plasglass window instead.

* Made firelocks and holofans heatproof

* Made RPD auto-wrench pipes if you have a wrench in your offhand.

* Runtime fixes.

* Made visuals update more reliably.

* Lint

* Update .github/CONTRIBUTING.md

Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
Signed-off-by: Charlie Nolan <funnyman3595@gmail.com>

* Build MILLA

* The Syndicate have installed tiny fans on their research base.

* The syndicate have figured out how to make plastitanium windows heatproof.

* This is getting out of hand. Now there are two of them.

* Un-break the auto-wrenching that I broke before committing.

* Build MILLA

* Build MILLA

* Massive MILLA refactor, assorted bugfixes.

* Build MILLA

* Explicit typing.

* Less sleeping/blocking.

* Build MILLA

* Yes, yes, this part can sleep.

* Build MILLA

* SSair reporting improvements.

* Build MILLA

* Please do not dock twice and splat yourself.

* Build MILLA

* Pls to not make SM go nuts.

* Build MILLA

* Build MILLA

* Added stricter lower bounds on plasmafire, fixing perpetually-burning SM.

* Build MILLA

* Lint

* Temporary logging, begone.

* Build MILLA

* Prevent hotspot strobing.

* Add in radiate_to_spess behavior.

* Build MILLA

* progress

* Compiling is good.

* bugfixes

* Progress.

* Ruins update.

* This one exists.

* Fixup temporary hotspots to last longer than one tick.

* Add/fix comments.

* Cut the slash.

* Fix test.

* No sleep for you.

* Build MILLA

* Prevent nested MILLA safety from runtiming.

* Build MILLA

* Runtime fix.

* Build MILLA

* Fix canisters not updating icon when gas contents change.

* Build MILLA

* Build MILLA

* Fixed an issue that made mechs very cold on environment air.

* Build MILLA

* oops

* Build MILLA

* Walls can make loud noises again.

* Build MILLA

* Fixes a rare runtime.

* Build MILLA

* Update .github/DOWNLOADING.md

Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
Signed-off-by: Charlie Nolan <funnyman3595@gmail.com>

* Review suggestions

* Lint

* Build MILLA

* bound_mixtures now only contains mixtures that can be written

* Build MILLA

* Apply suggestions from code review

Co-authored-by: Matt <116982774+Burzah@users.noreply.github.com>
Signed-off-by: Charlie Nolan <funnyman3595@gmail.com>

* Build MILLA

* Restore the original async behavior of pyro anomalies.

* Build MILLA

* Build MILLA

* Make the safety assertion in /datum/milla_safe safer.

* Build MILLA

---------

Signed-off-by: Charlie Nolan <funnyman3595@gmail.com>
Co-authored-by: FunnyMan3595 (Charlie Nolan) <funnyman@google.com>
Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
Co-authored-by: GDN <96800819+GDNgit@users.noreply.github.com>
Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
Co-authored-by: paradisess13[bot] <165046124+paradisess13[bot]@users.noreply.github.com>
Co-authored-by: warriorstar-orion <orion@snowfrost.garden>
Co-authored-by: GDN <Roanrichards1@Gmail.com>
2024-06-09 07:18:11 +00:00

198 lines
6.7 KiB
Plaintext

/datum/map_template
var/name = "Default Template Name"
var/width = 0
var/height = 0
var/mappath = null
var/mapfile = null
var/loaded = 0 // Times loaded this round
/// Do we exclude this from CI checks? If so, set this to the templates pathtype itself to avoid it getting passed down
var/ci_exclude = null // DO NOT SET THIS IF YOU DO NOT KNOW WHAT YOU ARE DOING
/datum/map_template/New(path = null, map = null, rename = null)
if(path)
mappath = path
if(mappath)
preload_size(mappath)
if(map)
mapfile = map
if(rename)
name = rename
/datum/map_template/proc/preload_size(path)
var/bounds = GLOB.maploader.load_map(file(path), 1, 1, 1, shouldCropMap = FALSE, measureOnly = TRUE)
if(bounds)
width = bounds[MAP_MAXX] // Assumes all templates are rectangular, have a single Z level, and begin at 1,1,1
height = bounds[MAP_MAXY]
return bounds
/datum/map_template/proc/load(turf/T, centered = 0)
var/turf/placement = T
var/min_x = placement.x
var/min_y = placement.y
if(centered)
min_x -= round(width/2)
min_y -= round(height/2)
var/max_x = min_x + width - 1
var/max_y = min_y + height - 1
if(!T)
return 0
var/turf/bot_left = locate(max(1, min_x), max(1, min_y), placement.z)
var/turf/top_right = locate(min(world.maxx, max_x), min(world.maxy, max_y), placement.z)
// 1 bigger, to update the turf smoothing
var/turf/ST_bot_left = locate(max(1, min_x-1), max(1, min_y-1), placement.z)
var/turf/ST_top_right = locate(min(world.maxx, max_x+1), min(world.maxy, max_y+1), placement.z)
// This is to place a freeze on initialization until the map's done loading
// otherwise atmos and stuff will start running mid-load
// This system will metaphorically snap in half (not postpone init everywhere)
// if given a multi-z template
// it might need to be adapted for that when that time comes
GLOB.space_manager.add_dirt(placement.z)
try
var/list/bounds = GLOB.maploader.load_map(get_file(), min_x, min_y, placement.z, shouldCropMap = TRUE)
if(!bounds)
return 0
if(bot_left == null || top_right == null)
stack_trace("One of the late setup corners is bust")
if(ST_bot_left == null || ST_top_right == null)
stack_trace("One of the smoothing corners is bust")
catch(var/exception/e)
GLOB.space_manager.remove_dirt(placement.z)
var/datum/milla_safe/late_setup_level/milla = new()
milla.invoke_async(block(bot_left, top_right), block(ST_bot_left, ST_top_right))
message_admins("Map template [name] threw an error while loading. Safe exit attempted, but check for errors at [ADMIN_COORDJMP(placement)].")
log_admin("Map template [name] threw an error while loading. Safe exit attempted.")
throw e
GLOB.space_manager.remove_dirt(placement.z)
var/datum/milla_safe/late_setup_level/milla = new()
milla.invoke_async(block(bot_left, top_right), block(ST_bot_left, ST_top_right))
log_game("[name] loaded at [min_x],[min_y],[placement.z]")
return 1
/datum/map_template/proc/get_file()
if(mapfile)
. = mapfile
else if(mappath)
. = wrap_file(mappath)
if(!.)
stack_trace(" The file of [src] appears to be empty/non-existent.")
/datum/map_template/proc/get_affected_turfs(turf/T, centered = 0)
var/turf/placement = T
var/min_x = placement.x
var/min_y = placement.y
if(centered)
min_x -= round(width/2)
min_y -= round(height/2)
var/max_x = min_x + width-1
var/max_y = min_y + height-1
placement = locate(max(min_x,1), max(min_y,1), placement.z)
return block(placement, locate(min(max_x, world.maxx), min(max_y, world.maxy), placement.z))
/datum/map_template/proc/fits_in_map_bounds(turf/T, centered = 0)
var/turf/placement = T
var/min_x = placement.x
var/min_y = placement.y
if(centered)
min_x -= round(width/2)
min_y -= round(height/2)
var/max_x = min_x + width-1
var/max_y = min_y + height-1
if(min_x < 1 || min_y < 1 || max_x > world.maxx || max_y > world.maxy)
return 0
else
return 1
/proc/preloadTemplates(path = "_maps/map_files/templates/") //see master controller setup
for(var/map in flist(path))
if(cmptext(copytext(map, length(map) - 3), ".dmm"))
var/datum/map_template/T = new(path = "[path][map]", rename = "[map]")
GLOB.map_templates[T.name] = T
if(GLOB.configuration.ruins.enable_space_ruins) // so we don't unnecessarily clutter start-up
preloadRuinTemplates()
preloadShelterTemplates()
preloadShuttleTemplates()
preloadBridgeTemplates()
preloadEventTemplates()
/proc/preloadRuinTemplates()
// Merge the active lists together
var/list/space_ruins = GLOB.configuration.ruins.active_space_ruins.Copy()
var/list/lava_ruins = GLOB.configuration.ruins.active_lava_ruins.Copy()
var/list/all_ruins = space_ruins | lava_ruins
for(var/item in subtypesof(/datum/map_template/ruin))
var/datum/map_template/ruin/ruin_type = item
// screen out the abstract subtypes
if(!initial(ruin_type.id))
continue
var/datum/map_template/ruin/R = new ruin_type()
// If not in the active list, skip it
if(!(R.mappath in all_ruins))
continue
GLOB.map_templates[R.name] = R
if(istype(R, /datum/map_template/ruin/lavaland))
GLOB.lava_ruins_templates[R.name] = R
if(istype(R, /datum/map_template/ruin/space))
GLOB.space_ruins_templates[R.name] = R
/proc/preloadShelterTemplates()
for(var/item in subtypesof(/datum/map_template/shelter))
var/datum/map_template/shelter/shelter_type = item
if(!(initial(shelter_type.mappath)))
continue
var/datum/map_template/shelter/S = new shelter_type()
GLOB.shelter_templates[S.shelter_id] = S
GLOB.map_templates[S.shelter_id] = S
/proc/preloadShuttleTemplates()
for(var/item in subtypesof(/datum/map_template/shuttle))
var/datum/map_template/shuttle/shuttle_type = item
if(!initial(shuttle_type.suffix))
continue
var/datum/map_template/shuttle/S = new shuttle_type()
GLOB.shuttle_templates[S.shuttle_id] = S
GLOB.map_templates[S.shuttle_id] = S
/proc/preloadBridgeTemplates()
for(var/item in subtypesof(/datum/map_template/ruin/bridge/horizontal))
var/datum/map_template/ruin/bridge/horizontal/horizontal_type = item
if(!(initial(horizontal_type.suffix)))
continue
var/datum/map_template/ruin/bridge/horizontal/S = new horizontal_type()
GLOB.bridge_horizontal_templates[S.suffix] = S
GLOB.map_templates[S.suffix] = S
for(var/item in subtypesof(/datum/map_template/ruin/bridge/vertical))
var/datum/map_template/ruin/bridge/horizontal/vertical_type = item
if(!(initial(vertical_type.suffix)))
continue
var/datum/map_template/ruin/bridge/vertical/V = new vertical_type()
GLOB.bridge_vertical_templates[V.suffix] = V
GLOB.map_templates[V.suffix] = V
/proc/preloadEventTemplates()
for(var/item in subtypesof(/datum/map_template/event))
var/datum/map_template/event/event_type = item
if(!initial(event_type.mappath))
continue
var/datum/map_template/event/E = new event_type()
GLOB.map_templates[E.event_id] = E