Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maploader tweaks #20026

Merged
merged 7 commits into from
Oct 9, 2024
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 code/game/machinery/doors/blast_door.dm
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@
// SUBTYPE: Regular
// Your classical blast door, found almost everywhere.
/obj/machinery/door/blast/regular
name = "blast door" //Because SDMM doesn't recognise the name otherwise, for some reason
icon_state_open = "pdoor0"
icon_state_opening = "pdoorc0"
icon_state_closed = "pdoor1"
Expand All @@ -207,6 +208,7 @@
block_air_zones = 1

/obj/machinery/door/blast/regular/open
name = "blast door" //Because SDMM doesn't recognise the name otherwise, for some reason
icon_state = "pdoor0"
density = FALSE
opacity = FALSE
Expand Down Expand Up @@ -240,6 +242,7 @@
block_air_zones = 1

/obj/machinery/door/blast/odin/open
name = "blast door" //Because SDMM doesn't recognise the name otherwise, for some reason
icon_state = "pdoor0"
density = 0
opacity = 0
Expand Down
6 changes: 3 additions & 3 deletions code/modules/admin/verbs/map_template_loadverb.dm
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
SSair.can_fire = FALSE
log_and_message_admins("is attempting to place a map template [log_name].")
to_chat(usr, "Attempting to place map template [log_name].")
var/new_z_centre = template.load_new_z(FALSE) // Don't skip changeturf
if (new_z_centre)
log_and_message_admins("has placed a map template [log_name].", location = new_z_centre)
var/bounds = template.load_new_z(FALSE) // Don't skip changeturf
if (bounds)
log_and_message_admins("has placed a map template [log_name] on Z bounds [bounds[MAP_MINZ]] - [bounds[MAP_MAXZ]].")
to_chat(usr, "Successfully place map template [log_name].")
else
log_and_message_admins("has failed to place a map template [log_name].")
Expand Down
4 changes: 4 additions & 0 deletions code/modules/library/lib_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,19 @@
update_icon()

/obj/structure/bookcase/libraryspawn/fiction
name = "bookcase" //Because SDMM doesn't recognise the name otherwise, for some reason
spawn_category = "Fiction"

/obj/structure/bookcase/libraryspawn/nonfiction
name = "bookcase" //Because SDMM doesn't recognise the name otherwise, for some reason
spawn_category = "Non-Fiction"

/obj/structure/bookcase/libraryspawn/reference
name = "bookcase" //Because SDMM doesn't recognise the name otherwise, for some reason
spawn_category = "Reference"

/obj/structure/bookcase/libraryspawn/religion
name = "bookcase" //Because SDMM doesn't recognise the name otherwise, for some reason
spawn_category = "Religion"

/obj/structure/bookcase/manuals/medical
Expand Down
2 changes: 0 additions & 2 deletions code/modules/mapping/map_template.dm
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@
return bounds

/datum/map_template/proc/load_new_z(var/no_changeturf = TRUE)
RETURN_TYPE(/turf)

var/x = round((world.maxx - width)/2)
var/y = round((world.maxy - height)/2)
var/initial_z = world.maxz + 1
Expand Down
23 changes: 17 additions & 6 deletions code/modules/mapping/reader.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,22 @@ GLOBAL_DATUM_INIT(_preloader, /dmm_suite/preloader, new)
var/static/regex/trimRegex = new/regex("^\[\\s\n]+|\[\\s\n]+$", "g")
var/static/list/modelCache = list()
var/static/space_key
var/loading = FALSE

//text trimming (both directions) helper macro
#define TRIM_TEXT(text) (replacetext_char(text, trimRegex, ""))

#define MAPLOADING_CHECK_TICK \
if(TICK_CHECK) { \
if(loading) { \
SSatoms.map_loader_stop(REF(src)); \
stoplag(); \
SSatoms.map_loader_begin(REF(src)); \
} else { \
stoplag(); \
} \
}

/**
* Construct the model map and control the loading process
*
Expand Down Expand Up @@ -166,6 +178,7 @@ GLOBAL_DATUM_INIT(_preloader, /dmm_suite/preloader, new)
else
//turn off base new Initialization until the whole thing is loaded
SSatoms.map_loader_begin(REF(src))
loading = TRUE

for(var/line in gridLines)
if((ycrd - y_offset + 1) < y_lower || (ycrd - y_offset + 1) > y_upper) //Reverse operation and check if it is out of bounds of cropping.
Expand Down Expand Up @@ -199,6 +212,7 @@ GLOBAL_DATUM_INIT(_preloader, /dmm_suite/preloader, new)
++xcrd
--ycrd

loading = FALSE
//Restore initialization to the previous value
SSatoms.map_loader_stop(REF(src))

Expand Down Expand Up @@ -312,7 +326,7 @@ GLOBAL_DATUM_INIT(_preloader, /dmm_suite/preloader, new)
members_attributes.len++
members_attributes[index++] = fields

CHECK_TICK
MAPLOADING_CHECK_TICK
while(dpos != 0)

//check and see if we can just skip this turf
Expand Down Expand Up @@ -403,11 +417,7 @@ GLOBAL_DATUM_INIT(_preloader, /dmm_suite/preloader, new)
if(GLOB.use_preloader && .)//second preloader pass, for those atoms that don't ..() in New()
GLOB._preloader.load(.)

//custom CHECK_TICK here because we don't want things created while we're sleeping to not initialize
if(TICK_CHECK)
SSatoms.map_loader_stop(REF(src))
stoplag()
SSatoms.map_loader_begin(REF(src))
MAPLOADING_CHECK_TICK

/dmm_suite/proc/create_atom(path, crds)
set waitfor = FALSE
Expand Down Expand Up @@ -539,3 +549,4 @@ GLOBAL_LIST_INIT(_preloader_path, null)
icon_state = "noop"

#undef TRIM_TEXT
#undef MAPLOADING_CHECK_TICK
2 changes: 1 addition & 1 deletion code/modules/recycling/disposal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@

level = 1 // underfloor only
var/dpdir = 0 // bitmask of pipe directions
dir = 0 // dir will contain dominant direction for junction pipes
//dir = 0 // dir will contain dominant direction for junction pipes
var/health = 10 // health points 0-10
layer = EXPOSED_DISPOSALS_PIPE_LAYER
var/sortType = ""
Expand Down
14 changes: 14 additions & 0 deletions code/unit_tests/map_tests.dm
Original file line number Diff line number Diff line change
Expand Up @@ -343,5 +343,19 @@

return test_status

/datum/unit_test/map_test/no_dirty_vars
name = "MAP: No Dirty Vars"

/datum/unit_test/map_test/no_dirty_vars/start_test()
var/test_status

if(length(GLOB.dirty_vars))
test_status = TEST_FAIL("There are dirty vars in the map! Read the logs above!")
TEST_DEBUG(json_encode(GLOB.dirty_vars))
else
test_status = TEST_PASS("No dirty vars in the map.")

return test_status

#undef SUCCESS
#undef FAILURE
58 changes: 58 additions & 0 deletions html/changelogs/fluffyghost-maploadertweaks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# - (fixes bugs)
# wip
# - (work in progress)
# qol
# - (quality of life)
# soundadd
# - (adds a sound)
# sounddel
# - (removes a sound)
# rscadd
# - (adds a feature)
# rscdel
# - (removes a feature)
# imageadd
# - (adds an image or sprite)
# imagedel
# - (removes an image or sprite)
# spellcheck
# - (fixes spelling or grammar)
# experiment
# - (experimental change)
# balance
# - (balance changes)
# code_imp
# - (misc internal code change)
# refactor
# - (refactors code)
# config
# - (makes a change to the config files)
# admin
# - (makes changes to administrator tools)
# server
# - (miscellaneous changes to server)
#################################

# Your name.
author: FluffyGhost

# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True

# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit.
# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog.
changes:
- bugfix: "Fixed the maploader sleeping without reinitializing SSAtoms to initialize, which caused some runtimes in niche cases in the CI."
6 changes: 0 additions & 6 deletions maps/away/away_site/abandoned_diner/abandoned_diner.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -2627,7 +2627,6 @@
/obj/machinery/atmospherics/pipe/simple/hidden/supply,
/obj/machinery/atmospherics/pipe/simple/hidden/scrubbers,
/obj/structure/disposalpipe/junction{
dir = 2;
icon_state = "pipe-j2"
},
/obj/structure/cable/green{
Expand Down Expand Up @@ -2826,7 +2825,6 @@
dir = 6
},
/obj/structure/disposalpipe/segment{
dir = 2;
icon_state = "pipe-c"
},
/obj/structure/bed/stool/chair/folding{
Expand Down Expand Up @@ -3114,7 +3112,6 @@
},
/obj/effect/floor_decal/corner_wide/green/diagonal,
/obj/structure/disposalpipe/segment{
dir = 2;
icon_state = "pipe-c"
},
/obj/structure/cable/green{
Expand Down Expand Up @@ -3491,7 +3488,6 @@
id = "diner_a"
},
/obj/structure/disposalpipe/segment{
dir = 2;
icon_state = "pipe-c"
},
/obj/machinery/atmospherics/unary/vent_pump/on,
Expand Down Expand Up @@ -3691,7 +3687,6 @@
dir = 10
},
/obj/structure/disposalpipe/segment{
dir = 2;
icon_state = "pipe-c"
},
/obj/structure/cable/green{
Expand Down Expand Up @@ -4209,7 +4204,6 @@
icon_state = "4-8"
},
/obj/structure/disposalpipe/segment{
dir = 2;
icon_state = "pipe-c"
},
/turf/simulated/floor/tiled/dark,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8654,9 +8654,7 @@
"Bi" = (
/obj/random/dirt_75,
/obj/random/dirt_75,
/obj/structure/safe/cash{
pixel_y = 0
},
/obj/structure/safe/cash,
/turf/simulated/floor/plating,
/area/abandoned_industrial_station/operations)
"Bj" = (
Expand Down
18 changes: 5 additions & 13 deletions maps/away/away_site/abandoned_mining/cursed.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@
/obj/machinery/door/firedoor,
/turf/simulated/floor/tiled/yellow,
/area/cursed/storage)
"aab" = (
/obj/machinery/door/airlock/glass_mining{
dir = 4
},
/obj/machinery/door/firedoor,
/turf/simulated/floor/tiled/yellow,
/area/cursed/storage)
"afk" = (
/obj/effect/floor_decal/corner/red/diagonal,
/obj/effect/decal/cleanable/dirt,
Expand Down Expand Up @@ -181,7 +174,7 @@
/area/mine)
"aQn" = (
/obj/machinery/atmospherics/portables_connector{
dir = 4;
dir = 4
},
/turf/simulated/floor,
/area/cursed/hangar)
Expand Down Expand Up @@ -1151,8 +1144,7 @@
/obj/item/bodybag/cryobag,
/obj/item/bodybag/cryobag,
/obj/item/reagent_containers/blood/OMinus,
/obj/item/storage/firstaid/fire{
},
/obj/item/storage/firstaid/fire,
/turf/simulated/floor/tiled/white,
/area/cursed/medical)
"gNq" = (
Expand Down Expand Up @@ -1849,7 +1841,7 @@
/area/cursed/living_area)
"lrD" = (
/obj/machinery/atmospherics/portables_connector{
dir = 4;
dir = 4
},
/obj/machinery/portable_atmospherics/powered/pump/filled,
/turf/simulated/floor,
Expand Down Expand Up @@ -2181,7 +2173,7 @@
/area/cursed/mineral_processing)
"mTG" = (
/obj/machinery/atmospherics/binary/pump/high_power{
dir = 8;
dir = 8
},
/turf/simulated/floor,
/area/cursed/engineering)
Expand Down Expand Up @@ -37134,7 +37126,7 @@ npR
xHS
lyG
lyG
aab
aaa
lyG
lyG
lyG
Expand Down
Loading
Loading