From 5a496c5dff0ffa63c2b7dd4665f88963e0339e8d Mon Sep 17 00:00:00 2001 From: silicons <2003111+silicons@users.noreply.github.com> Date: Fri, 6 May 2022 20:13:51 -0700 Subject: [PATCH] Baseturfs (#3938) * ill do this in the coffee shop later * has to go * add stuff * changes * this is going to explode * this is going to explode x2 * more * *scream * move * w * oh god oh fuck now for main proc * progress * wack * next segment.. * update * shuttles are next * AAA * sigh * this is going to be ugly * ugh * epic! * pain * hope this works * patch * patch * patch * patch * patch * epic! * wack * oh god.. * oh god.. * wack Co-authored-by: fake_vm_user --- code/__DEFINES/_lists.dm | 2 + code/__DEFINES/dcs/signals/signals_turf.dm | 2 +- code/__DEFINES/maps.dm | 2 +- code/__DEFINES/turfs/change_turf.dm | 11 + .../lists/{bitflags.dm => bitflag_lists.dm} | 0 code/__HELPERS/lists/string_lists.dm | 31 ++ code/__HELPERS/turfs.dm | 51 +-- code/__HELPERS/unsorted.dm | 82 +--- code/__HELPERS/unsorted/contents.dm | 35 ++ .../controllers/subsystem/mapping/_mapping.dm | 2 +- code/datums/components/thermite.dm | 2 +- code/datums/elements/turf_transparency.dm | 84 ---- code/datums/observation/turf_changed.dm | 27 -- code/game/area/Off Station Areas.dm | 55 --- code/game/area/Space Station 13 areas.dm | 20 - code/game/area/Tether_areas.dm | 11 - code/game/area/{areas.dm => area.dm} | 6 +- code/game/area/ss13_deprecated_areas.dm | 7 +- code/game/base_turf.dm | 31 -- code/game/gamemodes/cult/hell_universe.dm | 12 +- code/game/gamemodes/cult/narsie.dm | 8 +- code/game/gamemodes/endgame/endgame.dm | 4 - .../endgame/supermatter_cascade/universe.dm | 10 +- code/game/gamemodes/events/black_hole.dm | 12 +- code/game/turfs/baseturfs.dm | 69 +++ code/game/turfs/change_turf.dm | 415 +++++++++++++++++- code/game/turfs/simulated/fancy_shuttles.dm | 2 +- code/game/turfs/simulated/floor.dm | 2 +- code/game/turfs/simulated/floor_acts.dm | 4 +- code/game/turfs/simulated/floor_attackby.dm | 2 +- code/game/turfs/simulated/floor_types.dm | 99 +---- code/game/turfs/simulated/floor_types_eris.dm | 5 +- code/game/turfs/simulated/outdoors/dirt.dm | 6 +- code/game/turfs/simulated/outdoors/grass.dm | 5 +- .../game/turfs/simulated/outdoors/outdoors.dm | 51 +-- code/game/turfs/simulated/outdoors/snow.dm | 7 +- code/game/turfs/simulated/wall_attacks.dm | 3 +- code/game/turfs/simulated/walls.dm | 30 +- code/game/turfs/space/space.dm | 8 +- code/game/turfs/turf.dm | 13 +- code/game/turfs/turf_changing.dm | 129 ------ code/modules/admin/verbs/buildmode.dm | 12 +- code/modules/mapping/map_helpers/baseturf.dm | 56 +-- .../space_management/space_reservation.dm | 6 +- .../space_management/space_transition.dm | 2 +- .../away_missions/140x140/snow_outpost.dm | 2 - .../maps/away_missions/140x140/snowfield.dm | 2 - code/modules/maps/generic/shuttles/cruiser.dm | 1 - .../submaps/mountains/mountains_areas_vr.dm | 2 - code/modules/maps/tether/levels/alienship.dm | 2 - .../maps/tether/levels/tether_turfs.dm | 5 +- code/modules/maps/tether/levels/virgo2.dm | 4 - code/modules/maps/tether/levels/virgo4.dm | 21 - .../maps/tether/submaps/virgo2_areas.dm | 1 - code/modules/maps/triumph/levels/classd.dm | 2 +- code/modules/mining/mine_turfs.dm | 9 +- code/modules/mob/living/living.dm | 2 - code/modules/multiz/turf.dm | 19 +- code/modules/overmap/champagne.dm | 2 +- code/modules/overmap/turfs.dm | 2 - code/modules/power/singularity/act.dm | 8 +- code/modules/random_map/automata/caves.dm | 5 +- code/modules/shuttles/landmarks.dm | 3 +- code/modules/shuttles/shuttle.dm | 32 +- code/modules/turbolift/turbolift_map.dm | 3 + .../unit_tests/chain_pull_through_space.dm | 2 +- code/world.dm | 2 +- icons/turf/debug.dmi | Bin 0 -> 207 bytes maps/nsv_triumph/submaps/_triumph_submaps.dm | 8 + .../nsv_triumph/submaps/lavaland/_lavaland.dm | 2 +- maps/nsv_triumph/triumph_turfs.dm | 5 +- maps/tether/tether_defines.dm | 3 + maps/~map_system/maps.dm | 2 +- vorestation.dme | 14 +- 74 files changed, 766 insertions(+), 832 deletions(-) create mode 100644 code/__DEFINES/turfs/change_turf.dm rename code/__HELPERS/lists/{bitflags.dm => bitflag_lists.dm} (100%) create mode 100644 code/__HELPERS/lists/string_lists.dm create mode 100644 code/__HELPERS/unsorted/contents.dm delete mode 100644 code/datums/elements/turf_transparency.dm delete mode 100644 code/datums/observation/turf_changed.dm rename code/game/area/{areas.dm => area.dm} (99%) delete mode 100644 code/game/base_turf.dm create mode 100644 code/game/turfs/baseturfs.dm delete mode 100644 code/game/turfs/turf_changing.dm delete mode 100644 code/modules/maps/generic/submaps/mountains/mountains_areas_vr.dm create mode 100644 icons/turf/debug.dmi diff --git a/code/__DEFINES/_lists.dm b/code/__DEFINES/_lists.dm index 0db2eb265da..a33b3b1197d 100644 --- a/code/__DEFINES/_lists.dm +++ b/code/__DEFINES/_lists.dm @@ -14,6 +14,8 @@ #define LAZYADD(L, I) if(!L) { L = list(); } L += I; /// Adds I to L, initalizing L if necessary, if I is not already in L #define LAZYDISTINCTADD(L, I) if(!L) { L = list(); } L |= I; +/// please use LAZYDISTINCTADD instead, this is juts an alias for tgcode ports +#define LAZYOR(L, I) LAZYDISTINCTADD(L, I) #define LAZYFIND(L, V) (L ? L.Find(V) : 0) /// Reads I from L safely - Works with both associative and traditional lists. #define LAZYACCESS(L, I) (L ? (isnum(I) ? (I > 0 && I <= length(L) ? L[I] : null) : L[I]) : null) diff --git a/code/__DEFINES/dcs/signals/signals_turf.dm b/code/__DEFINES/dcs/signals/signals_turf.dm index 14d7df54be8..29cc6fdd01e 100644 --- a/code/__DEFINES/dcs/signals/signals_turf.dm +++ b/code/__DEFINES/dcs/signals/signals_turf.dm @@ -7,7 +7,7 @@ /// From base of turf/ChangeTurf(): (path, list/new_baseturfs, flags, list/post_change_callbacks). /// `post_change_callbacks` is a list that signal handlers can mutate to append `/datum/callback` objects. /// They will be called with the new turf after the turf has changed. -////#define COMSIG_TURF_CHANGE "turf_change" +#define COMSIG_TURF_CHANGE "turf_change" /// From base of atom/has_gravity(): (atom/asker, list/forced_gravities) ////#define COMSIG_TURF_HAS_GRAVITY "turf_has_gravity" /// From base of turf/multiz_turf_del(): (turf/source, direction) diff --git a/code/__DEFINES/maps.dm b/code/__DEFINES/maps.dm index efd704350ea..f627254006f 100644 --- a/code/__DEFINES/maps.dm +++ b/code/__DEFINES/maps.dm @@ -131,7 +131,7 @@ require only minor tweaks. //Reserved/Transit turf type #define RESERVED_TURF_TYPE /turf/space -// #define RESERVED_TURF_TYPE /turf/open/space/basic //What the turf is when not being used +// #define RESERVED_TURF_TYPE /turf/space/basic //What the turf is when not being used /* //Ruin Generation diff --git a/code/__DEFINES/turfs/change_turf.dm b/code/__DEFINES/turfs/change_turf.dm new file mode 100644 index 00000000000..dfcce6cbe8e --- /dev/null +++ b/code/__DEFINES/turfs/change_turf.dm @@ -0,0 +1,11 @@ +// ChangeTurf() flags +#define CHANGETURF_DEFER_CHANGE 1 +#define CHANGETURF_IGNORE_AIR 2 // This flag prevents changeturf from gathering air from nearby turfs to fill the new turf with an approximation of local air +#define CHANGETURF_FORCEOP 4 +#define CHANGETURF_SKIP 8 // A flag for PlaceOnTop to just instance the new turf instead of calling ChangeTurf. Used for uninitialized turfs NOTHING ELSE +#define CHANGETURF_INHERIT_AIR 16 // Inherit air from previous turf. Implies CHANGETURF_IGNORE_AIR +/// preserves the outdoors variable +#define CHANGETURF_PRESERVE_OUTDOORS 32 + +// CopyTurf() flags +// -- currently none -- diff --git a/code/__HELPERS/lists/bitflags.dm b/code/__HELPERS/lists/bitflag_lists.dm similarity index 100% rename from code/__HELPERS/lists/bitflags.dm rename to code/__HELPERS/lists/bitflag_lists.dm diff --git a/code/__HELPERS/lists/string_lists.dm b/code/__HELPERS/lists/string_lists.dm new file mode 100644 index 00000000000..e854e554351 --- /dev/null +++ b/code/__HELPERS/lists/string_lists.dm @@ -0,0 +1,31 @@ +GLOBAL_LIST_EMPTY(string_lists) + +/** + * Caches lists with non-numeric stringify-able values (text or typepath). + */ +/proc/string_list(list/values) + var/string_id = values.Join("-") + + . = GLOB.string_lists[string_id] + + if(.) + return + + return GLOB.string_lists[string_id] = values + +///A wrapper for baseturf string lists, to offer support of non list values, and a stack_trace if we have major issues +/proc/baseturfs_string_list(list/values, turf/baseturf_holder) + if(!islist(values)) + return values //baseturf things + // return values + if(length(values) > 10) + stack_trace("The baseturfs list of [baseturf_holder] at [baseturf_holder.x], [baseturf_holder.y], [baseturf_holder.x] is [length(values)], it should never be this long, investigate. I've set baseturfs to a flashing wall as a visual queue") + baseturf_holder.ChangeTurf(/turf/baseturfs_ded, list(/turf/baseturfs_ded), flags = CHANGETURF_FORCEOP) + return string_list(list(/turf/baseturfs_ded)) //I want this reported god damn it + return string_list(values) + +/turf/baseturfs_ded + name = "Report this" + desc = "It looks like base turfs went to the fucking moon, TELL YOUR LOCAL CODER TODAY" + icon = 'icons/turf/debug.dmi' + icon_state = "" diff --git a/code/__HELPERS/turfs.dm b/code/__HELPERS/turfs.dm index 12b28d8be6f..d74eecfb42b 100644 --- a/code/__HELPERS/turfs.dm +++ b/code/__HELPERS/turfs.dm @@ -79,10 +79,12 @@ var/turf/target = translation[source] if(target) - if(base_area) ChangeArea(target, get_area(source)) - var/leave_turf = base_turf ? base_turf : get_base_turf_by_area(base_area ? base_area : source) + if(base_area) + ChangeArea(target, get_area(source)) + var/leave_turf = base_turf ? base_turf : /turf/simulated/floor/plating translate_turf(source, target, leave_turf) - if(base_area) ChangeArea(source, base_area) + if(base_area) + ChangeArea(source, base_area) // Change the old turfs (Currently done by translate_turf for us) //for(var/turf/source in translation) @@ -100,31 +102,19 @@ var/turf/X // New Destination Turf - // Are we doing shuttlework? Just to save another type check later. - var/shuttlework = 0 + var/old_dir1 = T.dir + var/old_icon_state1 = T.icon_state + var/old_icon1 = T.icon + var/old_underlays = T.underlays.Copy() + var/old_decals = T.decals ? T.decals.Copy() : null - // Shuttle turfs handle their own fancy moving. - if(istype(T,/turf/simulated/shuttle)) - shuttlework = 1 - var/turf/simulated/shuttle/SS = T - if(!SS.landed_holder) SS.landed_holder = new(turf = SS) - X = SS.landed_holder.land_on(B) - - // Generic non-shuttle turf move. - else - var/old_dir1 = T.dir - var/old_icon_state1 = T.icon_state - var/old_icon1 = T.icon - var/old_underlays = T.underlays.Copy() - var/old_decals = T.decals ? T.decals.Copy() : null - - X = B.ChangeTurf(T.type) - X.setDir(old_dir1) - X.icon_state = old_icon_state1 - X.icon = old_icon1 - X.copy_overlays(T, TRUE) - X.underlays = old_underlays - X.decals = old_decals + X = B.PlaceOnTop(T.type) + X.setDir(old_dir1) + X.icon_state = old_icon_state1 + X.icon = old_icon1 + X.copy_overlays(T, TRUE) + X.underlays = old_underlays + X.decals = old_decals // Move the air from source to dest var/turf/simulated/ST = T @@ -159,13 +149,10 @@ var/mob/living/LM = M LM.check_shadow() // Need to check their Z-shadow, which is normally done in forceMove(). - if(shuttlework) - var/turf/simulated/shuttle/SS = T - SS.landed_holder.leave_turf(turftoleave) - else if(turftoleave) + if(turftoleave) T.ChangeTurf(turftoleave) else - T.ChangeTurf(get_base_turf_by_area(T)) + T.ScrapeAway() return TRUE diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index f9e39461e7d..dbf5b67f63f 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -594,43 +594,6 @@ proc/GaussRand(var/sigma) proc/GaussRandRound(var/sigma,var/roundto) return round(GaussRand(sigma),roundto) - -///Gets all contents of contents and returns them all in a list. -/atom/proc/GetAllContents(var/T) - var/list/processing_list = list(src) - var/i = 0 - var/lim = 1 - if(T) - . = list() - while(i < lim) - var/atom/A = processing_list[++i] - //Byond does not allow things to be in multiple contents, or double parent-child hierarchies, so only += is needed - //This is also why we don't need to check against assembled as we go along - processing_list += A.contents - lim = processing_list.len - if(istype(A,T)) - . += A - else - while(i < lim) - var/atom/A = processing_list[++i] - processing_list += A.contents - lim = processing_list.len - return processing_list - -/atom/proc/GetAllContentsIgnoring(list/ignore_typecache) - if(!length(ignore_typecache)) - return GetAllContents() - var/list/processing = list(src) - . = list() - var/i = 0 - var/lim = 1 - while(i < lim) - var/atom/A = processing[++i] - if(!ignore_typecache[A.type]) - processing += A.contents - lim = processing.len - . += A - ///Step-towards method of determining whether one atom can see another. Similar to viewers() /proc/can_see(var/atom/source, var/atom/target, var/length=5) //I couldn't be arsed to do actual raycasting :I This is horribly inaccurate. var/turf/current = get_turf(source) @@ -762,31 +725,19 @@ proc/GaussRandRound(var/sigma,var/roundto) var/turf/X //New Destination Turf - //Are we doing shuttlework? Just to save another type check later. - var/shuttlework = 0 + var/old_dir1 = T.dir + var/old_icon_state1 = T.icon_state + var/old_icon1 = T.icon + var/old_underlays = T.underlays.Copy() + var/old_decals = T.decals ? T.decals.Copy() : null - //Shuttle turfs handle their own fancy moving. - if(istype(T,/turf/simulated/shuttle)) - shuttlework = 1 - var/turf/simulated/shuttle/SS = T - if(!SS.landed_holder) SS.landed_holder = new(turf = SS) - X = SS.landed_holder.land_on(B) - - //Generic non-shuttle turf move. - else - var/old_dir1 = T.dir - var/old_icon_state1 = T.icon_state - var/old_icon1 = T.icon - var/old_underlays = T.underlays.Copy() - var/old_decals = T.decals ? T.decals.Copy() : null - - X = B.ChangeTurf(T.type) - X.setDir(old_dir1) - X.icon_state = old_icon_state1 - X.icon = old_icon1 - X.copy_overlays(T, TRUE) - X.underlays = old_underlays - X.decals = old_decals + X = B.ChangeTurf(T.type) + X.setDir(old_dir1) + X.icon_state = old_icon_state1 + X.icon = old_icon1 + X.copy_overlays(T, TRUE) + X.underlays = old_underlays + X.decals = old_decals //Move the air from source to dest var/turf/simulated/ST = T @@ -820,13 +771,10 @@ proc/GaussRandRound(var/sigma,var/roundto) var/mob/living/LM = M LM.check_shadow() // Need to check their Z-shadow, which is normally done in forceMove(). - if(shuttlework) - var/turf/simulated/shuttle/SS = T - SS.landed_holder.leave_turf() - else if(turftoleave) + if(turftoleave) T.ChangeTurf(turftoleave) else - T.ChangeTurf(get_base_turf_by_area(T)) + T.ScrapeAway() refined_src -= T refined_trg -= B @@ -914,7 +862,7 @@ proc/DuplicateObject(obj/original, var/perfectcopy = 0 , var/sameloc = 0) var/old_underlays = T.underlays.Copy() if(platingRequired) - if(istype(B, get_base_turf_by_area(B))) + if(istype(B, GLOB.using_map.base_turf_by_z[B.z])) continue moving var/turf/X = B diff --git a/code/__HELPERS/unsorted/contents.dm b/code/__HELPERS/unsorted/contents.dm new file mode 100644 index 00000000000..0f32f6ff0e1 --- /dev/null +++ b/code/__HELPERS/unsorted/contents.dm @@ -0,0 +1,35 @@ +///Gets all contents of contents and returns them all in a list. +/atom/proc/GetAllContents(var/T) + var/list/processing_list = list(src) + var/i = 0 + var/lim = 1 + if(T) + . = list() + while(i < lim) + var/atom/A = processing_list[++i] + //Byond does not allow things to be in multiple contents, or double parent-child hierarchies, so only += is needed + //This is also why we don't need to check against assembled as we go along + processing_list += A.contents + lim = processing_list.len + if(istype(A,T)) + . += A + else + while(i < lim) + var/atom/A = processing_list[++i] + processing_list += A.contents + lim = processing_list.len + return processing_list + +/atom/proc/GetAllContentsIgnoring(list/ignore_typecache) + if(!length(ignore_typecache)) + return GetAllContents() + var/list/processing = list(src) + . = list() + var/i = 0 + var/lim = 1 + while(i < lim) + var/atom/A = processing[++i] + if(!ignore_typecache[A.type]) + processing += A.contents + lim = processing.len + . += A diff --git a/code/controllers/subsystem/mapping/_mapping.dm b/code/controllers/subsystem/mapping/_mapping.dm index feb00bfd592..af97a45d9bc 100644 --- a/code/controllers/subsystem/mapping/_mapping.dm +++ b/code/controllers/subsystem/mapping/_mapping.dm @@ -267,7 +267,7 @@ SUBSYSTEM_DEF(mapping) var/block = block(A, B) for(var/t in block) // No need to empty() these, because it's world init and they're - // already /turf/open/space/basic. + // already /turf/space/basic. var/turf/T = t T.flags |= UNUSED_RESERVATION_TURF unused_turfs["[z]"] = block diff --git a/code/datums/components/thermite.dm b/code/datums/components/thermite.dm index 660b4eee2d2..5a6dfcd0183 100644 --- a/code/datums/components/thermite.dm +++ b/code/datums/components/thermite.dm @@ -6,7 +6,7 @@ var/static/list/blacklist = typecacheof(list( /turf/open/lava, - /turf/open/space, + /turf/space, /turf/open/water, /turf/open/chasm) ) diff --git a/code/datums/elements/turf_transparency.dm b/code/datums/elements/turf_transparency.dm deleted file mode 100644 index 37cffdb70f7..00000000000 --- a/code/datums/elements/turf_transparency.dm +++ /dev/null @@ -1,84 +0,0 @@ - -/datum/element/turf_z_transparency - var/show_bottom_level = FALSE - -///This proc sets up the signals to handle updating viscontents when turfs above/below update. Handle plane and layer here too so that they don't cover other obs/turfs in Dream Maker -/datum/element/turf_z_transparency/Attach(datum/target, show_bottom_level = TRUE) - . = ..() - if(!isturf(target)) - return ELEMENT_INCOMPATIBLE - - var/turf/our_turf = target - - src.show_bottom_level = show_bottom_level - - our_turf.plane = OPENSPACE_PLANE - //our_turf.layer = OPENSPACE_LAYER - - RegisterSignal(target, COMSIG_TURF_MULTIZ_DEL, .proc/on_multiz_turf_del, override = TRUE) - RegisterSignal(target, COMSIG_TURF_MULTIZ_NEW, .proc/on_multiz_turf_new, override = TRUE) - - update_multiz(our_turf, TRUE, TRUE) - -/datum/element/turf_z_transparency/Detach(datum/source) - . = ..() - var/turf/our_turf = source - our_turf.vis_contents.len = 0 - UnregisterSignal(our_turf, COMSIG_TURF_MULTIZ_DEL) - UnregisterSignal(our_turf, COMSIG_TURF_MULTIZ_NEW) - -///Updates the viscontents or underlays below this tile. -/datum/element/turf_z_transparency/proc/update_multiz(turf/our_turf, prune_on_fail = FALSE, init = FALSE) - var/turf/below_turf = GetBelow(our_turf) - if(!below_turf) - our_turf.vis_contents.len = 0 - if(!show_bottom_level(our_turf) && prune_on_fail) //If we cant show whats below, and we prune on fail, change the turf to plating as a fallback - our_turf.ChangeTurf(/turf/simulated/floor/plating) - return FALSE - else - return TRUE - if(init) - below_turf?.update_icon() // So the 'ceiling-less' overlay gets added. - our_turf.vis_contents += below_turf - - if(is_blocked_turf(our_turf)) //Show girders below closed turfs - var/mutable_appearance/girder_underlay = mutable_appearance('icons/obj/structures.dmi', "girder", layer = TURF_LAYER-0.01) - girder_underlay.appearance_flags = RESET_ALPHA | RESET_COLOR - our_turf.underlays += girder_underlay - var/mutable_appearance/plating_underlay = mutable_appearance('icons/turf/floors.dmi', "plating", layer = TURF_LAYER-0.02) - plating_underlay = RESET_ALPHA | RESET_COLOR - our_turf.underlays += plating_underlay - return TRUE - -/datum/element/turf_z_transparency/proc/on_multiz_turf_del(turf/our_turf, turf/below_turf, dir) - if(dir != DOWN) - return - - update_multiz(our_turf) - -/datum/element/turf_z_transparency/proc/on_multiz_turf_new(turf/our_turf, turf/below_turf, dir) - - if(dir != DOWN) - return - - update_multiz(our_turf) - -///Called when there is no real turf below this turf -/datum/element/turf_z_transparency/proc/show_bottom_level(turf/our_turf) - if(!show_bottom_level) - return FALSE - var/turf/path = get_base_turf_by_area(our_turf) || /turf/space - if(!ispath(path)) - path = text2path(path) - if(!ispath(path)) - warning("Z-level [our_turf] has invalid baseturf '[get_base_turf_by_area(our_turf)]' in area '[get_area(our_turf)]'") - path = /turf/space - - var/do_plane = ispath(path, /turf/space) ? SPACE_PLANE : null - var/do_state = ispath(path, /turf/space) ? "white" : initial(path.icon_state) - - var/mutable_appearance/underlay_appearance = mutable_appearance(initial(path.icon), do_state, layer = TURF_LAYER-0.02, plane = do_plane) - underlay_appearance.appearance_flags = RESET_ALPHA | RESET_COLOR - our_turf.underlays += underlay_appearance - - return TRUE diff --git a/code/datums/observation/turf_changed.dm b/code/datums/observation/turf_changed.dm deleted file mode 100644 index a1b15b0ff30..00000000000 --- a/code/datums/observation/turf_changed.dm +++ /dev/null @@ -1,27 +0,0 @@ -// Observer Pattern Implementation: Turf Changed -// Registration type: /turf -// -// Raised when: A turf has been changed using the ChangeTurf proc. -// -// Arguments that the called proc should expect: -// /turf/affected: The turf that has changed -// /old_density: Density before the change -// /new_density: Density after the change -// /old_opacity: Opacity before the change -// /new_opacity: Opacity after the change -GLOBAL_DATUM_INIT(turf_changed_event, /decl/observ/turf_changed, new) - -/decl/observ/turf_changed - name = "Turf Changed" - expected_type = /turf - -/************************ -* Turf Changed Handling * -************************/ - -/turf/ChangeTurf(var/turf/N, var/tell_universe, var/force_lighting_update, var/preserve_outdoors) - var/old_density = density - var/old_opacity = opacity - . = ..(N, tell_universe, force_lighting_update, preserve_outdoors) - if(.) - GLOB.turf_changed_event.raise_event(src, old_density, density, old_opacity, opacity) diff --git a/code/game/area/Off Station Areas.dm b/code/game/area/Off Station Areas.dm index 5d2c84ed449..d37ddb52030 100644 --- a/code/game/area/Off Station Areas.dm +++ b/code/game/area/Off Station Areas.dm @@ -155,17 +155,14 @@ /area/shuttle/triumph/crash1 name = "\improper Crash Site 1" icon_state = "shuttle2" - base_turf = /turf/simulated/floor/outdoors/dirt /area/shuttle/triumph/crash2 name = "\improper Crash Site 2" icon_state = "shuttle2" - base_turf = /turf/simulated/floor/outdoors/dirt // Class D world areas /area/class_d name = "Class D World" icon_state = "away" - base_turf = /turf/simulated/mineral/floor/classd requires_power = 1 dynamic_lighting = 1 @@ -178,10 +175,8 @@ icon_state = "unexplored" /area/class_d/unexplored/underground // Caves would be protected from weather. Still valid for POI generation do to being a dependent of /area/poi_d/unexplored - base_turf = /turf/simulated/mineral/floor/classd/indoors /area/class_d/explored/underground - base_turf = /turf/simulated/mineral/floor/classd/indoors /area/class_d/wildcat_mining_base name = "Abandoned Facility" @@ -201,7 +196,6 @@ name = "Exterior Workshop" /area/class_d/wildcat_mining_base/interior - base_turf = /turf/simulated/floor/classd/indoors /area/class_d/wildcat_mining_base/interior/main_room name = "Main Room" @@ -217,42 +211,33 @@ /area/class_d/POIs/ship name = "Crashed Ship Fragment" - base_turf = /turf/simulated/mineral/floor/classd/indoors /area/class_d/plains name = "Plains" - base_turf = /turf/simulated/mineral/floor/classd /area/class_d/crater name = "Crater" - base_turf = /turf/simulated/mineral/floor/classd /area/class_d/Mountain name = "Mountain" - base_turf = /turf/simulated/mineral/floor/classd/indoors /area/class_d/Crevices name = "Crevices" - base_turf = /turf/simulated/mineral/floor/classd/indoors /area/class_d/POIs/solar_farm name = "Prefab Solar Farm" - base_turf = /turf/simulated/mineral/floor/classd /area/class_d/POIs/landing_pad name = "Prefab Homestead" - base_turf = /turf/simulated/mineral/floor/classd requires_power = FALSE /area/class_d/POIs/reactor name = "Prefab Reactor" - base_turf = /turf/simulated/mineral/floor/classd/indoors // Class G world areas /area/class_g name = "Class G World" icon_state = "away" - base_turf = /turf/simulated/mineral/floor/ requires_power = 1 dynamic_lighting = 1 @@ -268,62 +253,48 @@ // Desert Planet world areas /area/class_h name = "Class H World" - base_turf = /turf/simulated/floor/outdoors/beach/sand/desert/classh requires_power = 1 dynamic_lighting = 1 icon_state = "away" /area/class_h/POIs/WW_Town name = "Ghost Town" - base_turf = /turf/simulated/floor/outdoors/beach/sand/desert/classh /area/class_h/POIs/landing_pad name = "Prefab Homestead" - base_turf = /turf/simulated/floor/outdoors/beach/sand/desert/classh /area/class_h/POIs/solar_farm name = "Prefab Solar Farm" - base_turf = /turf/simulated/floor/outdoors/beach/sand/desert/classh /area/class_h/POIs/dirt_farm name = "Abandoned Farmstead" - base_turf = /turf/simulated/floor/outdoors/beach/sand/desert/classh /area/class_h/POIs/graveyard name = "Desert Graveyard" - base_turf = /turf/simulated/floor/outdoors/beach/sand/desert/classh /area/class_h/POIs/goldmine name = "Desert Goldmine" - base_turf = /turf/simulated/floor/outdoors/beach/sand/desert/classh /area/class_h/POIs/ranch name = "Abandoned Ranch" - base_turf = /turf/simulated/floor/outdoors/beach/sand/desert/classh /area/class_h/POIs/saloon name = "Saloon" - base_turf = /turf/simulated/floor/outdoors/beach/sand/desert/classh /area/class_h/POIs/temple name = "Old Temple" - base_turf = /turf/simulated/floor/outdoors/beach/sand/desert/classh /area/class_h/POIs/tomb name = "Old Tomb" - base_turf = /turf/simulated/floor/outdoors/beach/sand/desert/classh /area/class_h/POIs/AuxiliaryResearchFacility name = "Research Facility" - base_turf = /turf/simulated/floor/outdoors/beach/sand/desert/classh /area/class_h/POIs/vault name = "Desert Bunker" - base_turf = /turf/simulated/floor/outdoors/beach/sand/desert/classh /area/class_h/POIs/covert_post name = "Clown Listening Post" - base_turf = /turf/simulated/floor/outdoors/beach/sand/desert/classh /area/class_h/explored name = "Class H World - Explored (E)" @@ -337,7 +308,6 @@ /area/class_m name = "Class M World" icon_state = "away" - base_turf = /turf/simulated/floor/outdoors/dirt requires_power = 1 dynamic_lighting = 1 @@ -353,7 +323,6 @@ /area/class_p name = "Class P World" icon_state = "away" - base_turf = /turf/simulated/floor/outdoors/dirt requires_power = 1 dynamic_lighting = 1 @@ -402,7 +371,6 @@ /area/space/debrisfield/asteroids/rocks icon_state = "debrisexplored" - base_turf = /turf/simulated/mineral/floor/vacuum /area/space/debrisfield/oldshuttle name = "POI - Old Shuttle" @@ -450,10 +418,8 @@ /area/mine/unexplored/underdark name = "\improper Mining Underdark" - base_turf = /turf/simulated/mineral/floor/virgo3b /area/mine/explored/underdark name = "\improper Mining Underdark" - base_turf = /turf/simulated/mineral/floor/virgo3b // Mining outpost areas /area/outpost/mining_main/passage @@ -528,7 +494,6 @@ /area/mothership requires_power = 1 flags = RAD_SHIELDED - base_turf = /turf/space icon_state = "blue-red2" /area/mothership/breakroom name = "Warship - Breakroom" @@ -616,7 +581,6 @@ /area/skipjack_station/transit name = "transit" icon_state = "shuttlered" - base_turf = /turf/space/transit/north /area/skipjack_station/orbit name = "near the Tether" icon_state = "northwest" @@ -638,14 +602,12 @@ /area/ninja_dojo/start name = "\improper Clan Dojo" icon_state = "shuttlered" - base_turf = /turf/simulated/floor/plating /area/ninja_dojo/orbit name = "near the Tether" icon_state = "south" /area/ninja_dojo/transit name = "transit" icon_state = "shuttlered" - base_turf = /turf/space/transit/north /area/ninja_dojo/arrivals_dock name = "\improper docked with Tether" icon_state = "shuttle" @@ -655,31 +617,25 @@ // Lavaland /area/shuttle/excursion/lavaland name = "Shuttle Landing Point" - base_turf = /turf/simulated/floor/outdoors/lavaland flags = RAD_SHIELDED /area/lavaland name = "Lava Land" icon_state = "away" - base_turf = /turf/simulated/floor/outdoors/lavaland requires_power = 1 dynamic_lighting = 1 /area/lavaland/horrors name = "Lava Land - Horrors" - base_turf = /turf/simulated/floor/outdoors/lavaland /area/lavaland/dogs name = "Lava Land - Dogs" - base_turf = /turf/simulated/floor/outdoors/lavaland /area/lavaland/idleruins name = "Lava Land - Idle Ruins" - base_turf = /turf/simulated/floor/outdoors/lavaland /area/lavaland/bosses name = "Lava Land - Boss" - base_turf = /turf/simulated/floor/outdoors/lavaland requires_power = 0 /area/lavaland/central/base @@ -768,29 +724,24 @@ // Aerostat /area/shuttle/excursion/away_aerostat name = "\improper Excursion Shuttle - Aerostat" - base_turf = /turf/unsimulated/floor/sky/virgo2_sky // The aerostat shuttle /area/shuttle/aerostat/docked name = "\improper Aerostat Shuttle - Dock" - base_turf = /turf/unsimulated/floor/sky/virgo2_sky /area/shuttle/aerostat/landed name = "\improper Aerostat Shuttle - Surface" - base_turf = /turf/simulated/floor/plating/virgo2 // The aerostat itself /area/aerostat name = "\improper Away Mission - Aerostat Outside" icon_state = "away" - base_turf = /turf/unsimulated/floor/sky/virgo2_sky requires_power = FALSE dynamic_lighting = FALSE /area/aerostat/inside name = "\improper Away Mission - Aerostat Inside" icon_state = "crew_quarters" - base_turf = /turf/simulated/floor/plating/virgo2 requires_power = TRUE dynamic_lighting = TRUE forced_ambience = list('sound/ambience/tension/tension.ogg', 'sound/ambience/tension/argitoth.ogg', 'sound/ambience/tension/burning_terror.ogg') @@ -798,13 +749,11 @@ /area/aerostat/solars name = "\improper Away Mission - Aerostat Solars" icon_state = "crew_quarters" - base_turf = /turf/simulated/floor/plating/virgo2 dynamic_lighting = TRUE /area/aerostat/surface flags = RAD_SHIELDED ambience = list('sound/ambience/ambimine.ogg', 'sound/ambience/song_game.ogg') - base_turf = /turf/simulated/mineral/floor/ignore_mapgen/virgo2 /area/aerostat/surface/explored name = "Away Mission - Aerostat Surface (E)" @@ -937,9 +886,7 @@ /area/awaymission/snow_outpost icon_state = "blank" requires_power = 0 - base_turf = /turf/snow/snow2 ambience = list('sound/music/main.ogg', 'sound/ambience/maintenance/maintenance4.ogg', 'sound/ambience/sif/sif1.ogg', 'sound/ambience/ruins/ruins1.ogg') - base_turf = /turf/simulated/floor/snow/snow2 /area/awaymission/snow_outpost/outside icon_state = "away1" @@ -977,9 +924,7 @@ /area/awaymission/snowfield icon_state = "blank" // requires_power = 0 - base_turf = /turf/snow/snow2 ambience = list('sound/ambience/ambispace.ogg','sound/music/title2.ogg','sound/music/space.ogg','sound/music/main.ogg','sound/music/traitor.ogg') - base_turf = /turf/simulated/floor/snow/snow2 /area/awaymission/snowfield/outside icon_state = "green" diff --git a/code/game/area/Space Station 13 areas.dm b/code/game/area/Space Station 13 areas.dm index 6f4936388ea..b288cbb84c4 100644 --- a/code/game/area/Space Station 13 areas.dm +++ b/code/game/area/Space Station 13 areas.dm @@ -30,7 +30,6 @@ NOTE: there are two lists of areas in the end of this file: centcom and station has_gravity = 0 power_equip = 0 power_environ = 0 - base_turf = /turf/space ambience = AMBIENCE_SPACE /area/space/atmosalert() @@ -71,7 +70,6 @@ NOTE: there are two lists of areas in the end of this file: centcom and station requires_power = 0 flags = RAD_SHIELDED sound_env = SMALL_ENCLOSED - base_turf = /turf/space /area/shuttle/arrival name = "\improper Arrival Shuttle" @@ -125,7 +123,6 @@ NOTE: there are two lists of areas in the end of this file: centcom and station name = "\improper Mining Elevator" music = "music/escape.ogg" dynamic_lighting = 0 - base_turf = /turf/simulated/mineral/floor/ignore_mapgen /area/shuttle/transport1/centcom icon_state = "shuttle" @@ -202,7 +199,6 @@ NOTE: there are two lists of areas in the end of this file: centcom and station name = "\improper Research Elevator" music = "music/escape.ogg" dynamic_lighting = 0 - base_turf = /turf/simulated/mineral/floor/ignore_mapgen /area/shuttle/awaymission/home name = "NSB Adephagia (AM)" @@ -227,12 +223,10 @@ NOTE: there are two lists of areas in the end of this file: centcom and station /area/shuttle/cruiser/cruiser name = "Small Cruiser Shuttle - Cruiser" icon_state = "blue2" - base_turf = /turf/simulated/floor/tiled/techfloor /area/shuttle/tether/surface name = "Tether Shuttle Landed" icon_state = "shuttle" - base_turf = /turf/simulated/floor/reinforced /area/shuttle/tether/station name = "Tether Shuttle Dock" @@ -404,7 +398,6 @@ NOTE: there are two lists of areas in the end of this file: centcom and station /area/shuttle/cruiser/cruiser name = "Small Cruiser Shuttle - Cruiser" icon_state = "blue2" - base_turf = /turf/simulated/floor/tiled/techfloor /area/shuttle/cruiser/station name = "Small Cruiser Shuttle - Station" icon_state = "blue2" @@ -413,14 +406,12 @@ NOTE: there are two lists of areas in the end of this file: centcom and station /area/shuttle/specialops/centcom name = "Special Operations Shuttle - Centcom" icon_state = "shuttlered" - base_turf = /turf/unsimulated/floor/shuttle_ceiling /area/shuttle/specialops/tether name = "Special Operations Shuttle - Tether" icon_state = "shuttlered" /area/shuttle/specialops/transit name = "transit" icon_state = "shuttlered" - base_turf = /turf/space/transit/east // Tether Map has this shuttle /area/shuttle/tether @@ -597,7 +588,6 @@ NOTE: there are two lists of areas in the end of this file: centcom and station icon_state = "yellow" requires_power = 0 flags = RAD_SHIELDED - base_turf = /turf/space ambience = AMBIENCE_HIGHSEC /area/syndicate_station/start @@ -659,7 +649,6 @@ NOTE: there are two lists of areas in the end of this file: centcom and station name = "\improper Skipjack" icon_state = "yellow" requires_power = 0 - base_turf = /turf/space ambience = AMBIENCE_HIGHSEC /area/skipjack_station/start @@ -1176,23 +1165,19 @@ NOTE: there are two lists of areas in the end of this file: centcom and station /area/hallway/secondary/entry/D1 name = "\improper Shuttle Dock Hallway - Dock One" icon_state = "entry_D1" - base_turf = /turf/space /area/hallway/secondary/entry/D2 name = "\improper Shuttle Dock Hallway - Dock Two" icon_state = "entry_D2" - base_turf = /turf/space /area/hallway/secondary/entry/D2/arrivals name = "\improper Shuttle Dock Hallway - Dock Two" icon_state = "entry_D2" - base_turf = /turf/space requires_power = 0 /area/hallway/secondary/entry/D3 name = "\improper Shuttle Dock Hallway - Dock Three" icon_state = "entry_D3" - base_turf = /turf/space /area/hallway/secondary/entry/D4 name = "\improper Shuttle Dock Hallway - Dock Four" @@ -3034,7 +3019,6 @@ NOTE: there are two lists of areas in the end of this file: centcom and station name = "\improper Construction Site Shuttle" icon_state = "yellow" dynamic_lighting = 0 - base_turf = /turf/simulated/mineral/floor/ignore_mapgen /area/shuttle/constructionsite/station name = "\improper Construction Site Shuttle" @@ -3290,7 +3274,6 @@ NOTE: there are two lists of areas in the end of this file: centcom and station requires_power = 0 flags = RAD_SHIELDED sound_env = SMALL_ENCLOSED - base_turf = /turf/space icon_state = "red2" /area/bigship/teleporter @@ -3300,7 +3283,6 @@ NOTE: there are two lists of areas in the end of this file: centcom and station name = "Small Cruiser" requires_power = 0 flags = RAD_SHIELDED - base_turf = /turf/space icon_state = "red2" lightswitch = TRUE @@ -3418,7 +3400,6 @@ NOTE: there are two lists of areas in the end of this file: centcom and station // Used for creating the exchange areas. /area/turbolift name = "Turbolift" - base_turf = /turf/simulated/open requires_power = 0 sound_env = SMALL_ENCLOSED @@ -3437,7 +3418,6 @@ NOTE: there are two lists of areas in the end of this file: centcom and station lift_floor_label = "Deck 1" lift_floor_name = "Engineering, Reactor, Telecomms, Trash Pit, Atmospherics" lift_announce_str = "Arriving at Deck 1." - base_turf = /turf/simulated/floor/plating /area/turbolift/t_ship/level2 diff --git a/code/game/area/Tether_areas.dm b/code/game/area/Tether_areas.dm index 649b89c05f4..aeabab40362 100644 --- a/code/game/area/Tether_areas.dm +++ b/code/game/area/Tether_areas.dm @@ -41,7 +41,6 @@ lift_floor_label = "Surface 1" lift_floor_name = "Tram, Dorms, Mining, Surf. EVA" lift_announce_str = "Arriving at Base Level 1." - base_turf = /turf/simulated/floor/plating /area/turbolift/t_surface/level2 name = "surface (level 2)" @@ -311,10 +310,8 @@ // Mining Underdark /area/mine/unexplored/underdark name = "\improper Mining Underdark" - base_turf = /turf/simulated/mineral/floor/virgo3b /area/mine/explored/underdark name = "\improper Mining Underdark" - base_turf = /turf/simulated/mineral/floor/virgo3b // Mining outpost areas /area/outpost/mining_main/passage @@ -1324,11 +1321,9 @@ /area/shuttle/tether/crash1 name = "\improper Crash Site 1" icon_state = "shuttle2" - base_turf = /turf/simulated/floor/outdoors/dirt/virgo3b /area/shuttle/tether/crash2 name = "\improper Crash Site 2" icon_state = "shuttle2" - base_turf = /turf/simulated/floor/outdoors/dirt/virgo3b // Exploration Shuttle stuff // /area/tether/exploration @@ -1538,7 +1533,6 @@ area/shuttle/mining_outpost/shuttle requires_power = 0 flags = RAD_SHIELDED sound_env = SMALL_ENCLOSED - base_turf = /turf/space icon_state = "red2" /area/bigship/teleporter @@ -1572,7 +1566,6 @@ area/shuttle/mining_outpost/shuttle /area/shuttle/specialops/centcom name = "Special Operations Shuttle - Centcom" icon_state = "shuttlered" - base_turf = /turf/unsimulated/floor/shuttle_ceiling /area/shuttle/specialops/tether name = "Special Operations Shuttle - Tether" @@ -1581,7 +1574,6 @@ area/shuttle/mining_outpost/shuttle /area/shuttle/specialops/transit name = "transit" icon_state = "shuttlered" - base_turf = /turf/space/transit/east // Tether Map has this shuttle /area/shuttle/tether @@ -1601,7 +1593,6 @@ area/shuttle/mining_outpost/shuttle /area/skipjack_station/transit name = "transit" icon_state = "shuttlered" - base_turf = /turf/space/transit/north /area/skipjack_station/orbit name = "near the Tether" @@ -1626,7 +1617,6 @@ area/shuttle/mining_outpost/shuttle /area/ninja_dojo/start name = "\improper Clan Dojo" icon_state = "shuttlered" - base_turf = /turf/simulated/floor/plating /area/ninja_dojo/orbit name = "near the Tether" @@ -1635,7 +1625,6 @@ area/shuttle/mining_outpost/shuttle /area/ninja_dojo/transit name = "transit" icon_state = "shuttlered" - base_turf = /turf/space/transit/north /area/ninja_dojo/arrivals_dock name = "\improper docked with Tether" diff --git a/code/game/area/areas.dm b/code/game/area/area.dm similarity index 99% rename from code/game/area/areas.dm rename to code/game/area/area.dm index d796d8d208a..fb3575db3ee 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/area.dm @@ -63,8 +63,6 @@ var/list/forced_ambience = null /// Used to decide what kind of reverb the area makes sound have var/sound_env = STANDARD_STATION - - var/turf/base_turf //The base turf type of the area, which can be used to override the z-level's base turf var/global/global_uid = 0 var/uid @@ -595,6 +593,10 @@ GLOBAL_LIST_EMPTY(forced_ambiance_list) /area/drop_location() CRASH("Bad op: area/drop_location() called") +// A hook so areas can modify the incoming args +/area/proc/PlaceOnTopReact(list/new_baseturfs, turf/fake_turf_type, flags) + return flags + /*Adding a wizard area teleport list because motherfucking lag -- Urist*/ /*I am far too lazy to make it a proper list of areas so I'll just make it run the usual telepot routine at the start of the game*/ diff --git a/code/game/area/ss13_deprecated_areas.dm b/code/game/area/ss13_deprecated_areas.dm index 5094456e51a..1502ded3858 100644 --- a/code/game/area/ss13_deprecated_areas.dm +++ b/code/game/area/ss13_deprecated_areas.dm @@ -99,7 +99,6 @@ /area/shuttle/cryo/station icon_state = "shuttle2" - base_turf = /turf/simulated/mineral/floor/ignore_mapgen /area/shuttle/cryo/centcom icon_state = "shuttle" @@ -156,11 +155,9 @@ /area/supply/station name = "Supply Shuttle" icon_state = "shuttle3" - requires_power = 0 - base_turf = /turf/space + requires_power = FALSE /area/supply/dock name = "Supply Shuttle" icon_state = "shuttle3" - requires_power = 0 - base_turf = /turf/space + requires_power = FALSE diff --git a/code/game/base_turf.dm b/code/game/base_turf.dm deleted file mode 100644 index 8a81a6efd1a..00000000000 --- a/code/game/base_turf.dm +++ /dev/null @@ -1,31 +0,0 @@ -// Returns the lowest turf available on a given Z-level, defaults to asteroid for Polaris. - -proc/get_base_turf(var/z) - if(!GLOB.using_map.base_turf_by_z["[z]"]) - GLOB.using_map.base_turf_by_z["[z]"] = /turf/space - return GLOB.using_map.base_turf_by_z["[z]"] - -//An area can override the z-level base turf, so our solar array areas etc. can be space-based. -proc/get_base_turf_by_area(var/turf/T) - var/area/A = T.loc - if(A.base_turf) - return A.base_turf - return get_base_turf(T.z) - -/client/proc/set_base_turf() - set category = "Debug" - set name = "Set Base Turf" - set desc = "Set the base turf for a z-level." - - if(!holder) return - - var/choice = input("Which Z-level do you wish to set the base turf for?") as num|null - if(!choice) - return - - var/new_base_path = input("Please select a turf path (cancel to reset to /turf/space).") as null|anything in typesof(/turf) - if(!new_base_path) - new_base_path = /turf/space - GLOB.using_map.base_turf_by_z["[choice]"] = new_base_path - message_admins("[key_name_admin(usr)] has set the base turf for z-level [choice] to [get_base_turf(choice)].") - log_admin("[key_name(usr)] has set the base turf for z-level [choice] to [get_base_turf(choice)].") diff --git a/code/game/gamemodes/cult/hell_universe.dm b/code/game/gamemodes/cult/hell_universe.dm index 285143eab0e..9a6f5f645a1 100644 --- a/code/game/gamemodes/cult/hell_universe.dm +++ b/code/game/gamemodes/cult/hell_universe.dm @@ -26,15 +26,6 @@ In short: for(var/obj/machinery/light/L in T.contents) new /obj/structure/cult/pylon(L.loc) qdel(L) - return - - -/datum/universal_state/hell/OnTurfChange(var/turf/T) - var/turf/space/S = T - if(istype(S)) - S.color = "#FF0000" - else - S.color = initial(S.color) // Apply changes when entering state /datum/universal_state/hell/OnEnter() @@ -64,9 +55,8 @@ In short: spawn(0) for(var/datum/lighting_corner/L in world) L.update_lumcount(1, 0, 0) - for(var/turf/space/T in world) - OnTurfChange(T) + T.color = "#FF0000" /datum/universal_state/hell/proc/MiscSet() for(var/turf/simulated/floor/T in world) diff --git a/code/game/gamemodes/cult/narsie.dm b/code/game/gamemodes/cult/narsie.dm index 1fac179f6cd..15d51fdc08a 100644 --- a/code/game/gamemodes/cult/narsie.dm +++ b/code/game/gamemodes/cult/narsie.dm @@ -223,9 +223,9 @@ var/global/list/narsie_list = list() consume(AM2) continue - if (dist <= consume_range && !istype(A, get_base_turf_by_area(A))) + if (dist <= consume_range) var/turf/T2 = A - T2.ChangeTurf(get_base_turf_by_area(A)) + T2.ScrapeAway(flags = CHANGETURF_INHERIT_AIR) /obj/singularity/narsie/consume(const/atom/A) //This one is for the small ones. if(!(A.singuloCanEat())) @@ -265,9 +265,9 @@ var/global/list/narsie_list = list() spawn (0) AM2.singularity_pull(src, src.current_size) - if (dist <= consume_range && !istype(A, get_base_turf_by_area(A))) + if (dist <= consume_range) var/turf/T2 = A - T2.ChangeTurf(get_base_turf_by_area(A)) + T2.ScrapeAway(flags = CHANGETURF_INHERIT_AIR) /obj/singularity/narsie/ex_act(severity) //No throwing bombs at it either. --NEO return diff --git a/code/game/gamemodes/endgame/endgame.dm b/code/game/gamemodes/endgame/endgame.dm index 721ae98f716..8508557de93 100644 --- a/code/game/gamemodes/endgame/endgame.dm +++ b/code/game/gamemodes/endgame/endgame.dm @@ -56,10 +56,6 @@ /datum/universal_state/proc/OnEnter() // Does nothing by default -// Apply changes to a new turf. -/datum/universal_state/proc/OnTurfChange(var/turf/NT) - return - /datum/universal_state/proc/OverlayAndAmbientSet() return diff --git a/code/game/gamemodes/endgame/supermatter_cascade/universe.dm b/code/game/gamemodes/endgame/supermatter_cascade/universe.dm index 1ddcc35d470..f00321c589f 100644 --- a/code/game/gamemodes/endgame/supermatter_cascade/universe.dm +++ b/code/game/gamemodes/endgame/supermatter_cascade/universe.dm @@ -12,13 +12,6 @@ var/global/universe_has_ended = 0 to_chat(user, "All you hear on the frequency is static and panicked screaming. There will be no shuttle call today.") return 0 -/datum/universal_state/supermatter_cascade/OnTurfChange(var/turf/T) - var/turf/space/S = T - if(istype(S)) - S.color = "#0066FF" - else - S.color = initial(S.color) - /datum/universal_state/supermatter_cascade/DecayTurf(var/turf/T) if(istype(T,/turf/simulated/wall)) var/turf/simulated/wall/W=T @@ -97,9 +90,8 @@ The access requirements on the Asteroid Shuttles' consoles have now been revoked L.update_lumcount(1,1,1) else L.update_lumcount(0.0, 0.4, 1) - for(var/turf/space/T in world) - OnTurfChange(T) + T.color = "#0066FF" /datum/universal_state/supermatter_cascade/proc/MiscSet() for (var/obj/machinery/firealarm/alm in machines) diff --git a/code/game/gamemodes/events/black_hole.dm b/code/game/gamemodes/events/black_hole.dm index 268f651b8f8..2e6121bd63c 100644 --- a/code/game/gamemodes/events/black_hole.dm +++ b/code/game/gamemodes/events/black_hole.dm @@ -23,11 +23,9 @@ qdel(M) for(var/obj/O in orange(1,src)) qdel(O) - var/base_turf = get_base_turf_by_area(src) - for(var/turf/simulated/ST in orange(1,src)) - if(ST.type == base_turf) - continue - ST.ChangeTurf(base_turf) + + for(var/turf/simulated/ST in orange(1, src)) + ST.ScrapeAway(flags = CHANGETURF_INHERIT_AIR) switch(++process_step) if(1) @@ -86,6 +84,4 @@ //Destroying the turf if( T && istype(T,/turf/simulated) && prob(turf_removal_chance) ) var/turf/simulated/ST = T - var/base_turf = get_base_turf_by_area(src) - if(ST.type != base_turf) - ST.ChangeTurf(base_turf) + ST.ScrapeAway() diff --git a/code/game/turfs/baseturfs.dm b/code/game/turfs/baseturfs.dm new file mode 100644 index 00000000000..89d9d8b2afd --- /dev/null +++ b/code/game/turfs/baseturfs.dm @@ -0,0 +1,69 @@ +// This is a typepath to just sit in baseturfs and act as a marker for other things. +/turf/baseturf_skipover + name = "Baseturf skipover placeholder" + desc = "This shouldn't exist" + +/turf/baseturf_skipover/Initialize(mapload) + . = ..() + stack_trace("[src]([type]) was instanced which should never happen. Changing into the next baseturf down...") + ScrapeAway() + +/turf/baseturf_skipover/shuttle + name = "Shuttle baseturf skipover" + desc = "Acts as the bottom of the shuttle, if this isn't here the shuttle floor is broken through." + +/turf/baseturf_bottom + name = "Z-level baseturf placeholder" + desc = "Marker for z-level baseturf, usually resolves to space." + baseturfs = /turf/baseturf_bottom + +GLOBAL_LIST_EMPTY(created_baseturf_lists) + +// A proc in case it needs to be recreated or badmins want to change the baseturfs +/turf/proc/assemble_baseturfs(turf/fake_baseturf_type) + var/list/created_baseturf_lists = GLOB.created_baseturf_lists + var/turf/current_target + if(fake_baseturf_type) + if(length(fake_baseturf_type)) // We were given a list, just apply it and move on + baseturfs = baseturfs_string_list(fake_baseturf_type, src) + return + current_target = fake_baseturf_type + else + if(length(baseturfs)) + return // No replacement baseturf has been given and the current baseturfs value is already a list/assembled + if(!baseturfs) + current_target = initial(baseturfs) || type // This should never happen but just in case... + stack_trace("baseturfs var was null for [type]. Failsafe activated and it has been given a new baseturfs value of [current_target].") + else + current_target = baseturfs + + // If we've made the output before we don't need to regenerate it + if(created_baseturf_lists[current_target]) + var/list/premade_baseturfs = created_baseturf_lists[current_target] + if(length(premade_baseturfs)) + baseturfs = baseturfs_string_list(premade_baseturfs.Copy(), src) + else + baseturfs = baseturfs_string_list(premade_baseturfs, src) + return baseturfs + + var/turf/next_target = initial(current_target.baseturfs) + //Most things only have 1 baseturf so this loop won't run in most cases + if(current_target == next_target) + baseturfs = current_target + created_baseturf_lists[current_target] = current_target + return current_target + var/list/new_baseturfs = list(current_target) + for(var/i=0;current_target != next_target;i++) + if(i > 100) + // A baseturfs list over 100 members long is silly + // Because of how this is all structured it will only runtime/message once per type + stack_trace("A turf <[type]> created a baseturfs list over 100 members long. This is most likely an infinite loop.") + message_admins("A turf <[type]> created a baseturfs list over 100 members long. This is most likely an infinite loop.") + break + new_baseturfs.Insert(1, next_target) + current_target = next_target + next_target = initial(current_target.baseturfs) + + baseturfs = baseturfs_string_list(new_baseturfs, src) + created_baseturf_lists[new_baseturfs[new_baseturfs.len]] = new_baseturfs.Copy() + return new_baseturfs diff --git a/code/game/turfs/change_turf.dm b/code/game/turfs/change_turf.dm index 912a2d0e17d..822352eb7a9 100644 --- a/code/game/turfs/change_turf.dm +++ b/code/game/turfs/change_turf.dm @@ -1,8 +1,20 @@ -//pending tg change turf stuff +// This is a list of turf types we dont want to assign to baseturfs unless through initialization or explicitly +GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list( + /turf/space, + /turf/baseturf_bottom, + /turf/simulated/open, + ))) + +/// list of turf types that are logically "below" the last turf layer, and are therefore things we should inject above when doing things like injecting shuttle ceilings +GLOBAL_LIST_INIT(multiz_hole_baseturfs, typecacheof(list( + /turf/space, + /turf/simulated/open, + /turf/baseturf_bottom, +))) /turf/proc/empty(turf_type=/turf/space, baseturf_type, list/ignore_typecache, flags) // Remove all atoms except observers, landmarks, docking ports - var/static/list/ignored_atoms = typecacheof(list(/mob/observer, /atom/movable/landmark, /atom/movable/lighting_object)) // typecacheof(list(/mob/dead, /atom/movable/landmark, /obj/docking_port, /atom/movable/lighting_object)) + var/static/list/ignored_atoms = typecacheof(list(/mob/observer, /atom/movable/landmark, /atom/movable/lighting_object, /obj/effect/shuttle_landmark)) var/list/allowed_contents = typecache_filter_list_reverse(GetAllContentsIgnoring(ignore_typecache), ignored_atoms) allowed_contents -= src for(var/i in 1 to allowed_contents.len) @@ -11,12 +23,395 @@ if(turf_type) ChangeTurf(turf_type) -// var/turf/newT = ChangeTurf(turf_type) -/* - SSair.remove_from_active(newT) - CALCULATE_ADJACENT_TURFS(newT) - SSair.add_to_active(newT,1) -*/ -/turf/proc/ScrapeAway() - return ChangeTurf(get_base_turf_by_area(loc)) +/turf/proc/CopyTurf(turf/T, copy_flags = NONE) + if(T.type != type) + T.ChangeTurf(type) + if(T.icon_state != icon_state) + T.icon_state = icon_state + if(T.icon != icon) + T.icon = icon + if(color) + T.atom_colours = atom_colours.Copy() + T.update_atom_colour() + if(T.dir != dir) + T.setDir(dir) + return T + +//wrapper for ChangeTurf()s that you want to prevent/affect without overriding ChangeTurf() itself +/turf/proc/TerraformTurf(path, new_baseturf, flags) + return ChangeTurf(path, new_baseturf, flags) + +// Creates a new turf +// new_baseturfs can be either a single type or list of types, formated the same as baseturfs. see turf.dm +/turf/proc/ChangeTurf(path, list/new_baseturfs, flags) + switch(path) + if(null) + return + if(/turf/baseturf_bottom) + path = SSmapping.level_trait(z, ZTRAIT_BASETURF) || GLOB.using_map.base_turf_by_z["[z]"] || /turf/space + if(!ispath(path)) + path = text2path(path) + if (!ispath(path)) + warning("Z-level [z] has invalid baseturf '[SSmapping.level_trait(z, ZTRAIT_BASETURF)]'") + path = /turf/space + if(path == /turf/space) // no space/basic check, if you use space/basic in a map honestly get bent + if(istype(GetBelow(src), /turf/simulated)) + path = /turf/simulated/open + if(/turf/space/basic) + // basic doesn't initialize and this will cause issues + // no warning though because this can happen naturaly as a result of it being built on top of + if(istype(GetBelow(src), /turf/simulated)) + path = /turf/simulated/open + else + path = /turf/space + if(/turf/space) + if(istype(GetBelow(src), /turf/simulated)) + path = /turf/simulated/open + if(/turf/simulated/open) + if(istype(GetBelow(src), /turf/space)) + path = /turf/space + + if(!GLOB.use_preloader && path == type && !(flags & CHANGETURF_FORCEOP) && (baseturfs == new_baseturfs)) // Don't no-op if the map loader requires it to be reconstructed, or if this is a new set of baseturfs + return src + if(flags & CHANGETURF_SKIP) + return new path(src) + + // store lighting + var/old_opacity = opacity + var/old_dynamic_lighting = dynamic_lighting + var/old_affecting_lights = affecting_lights + var/old_lighting_object = lighting_object + var/old_lc_topright = lc_topright + var/old_lc_topleft = lc_topleft + var/old_lc_bottomright = lc_bottomright + var/old_lc_bottomleft = lc_bottomleft + + // store/invalidae atmos + var/atom/movable/fire/old_fire = fire + if(connections) + connections.erase_all() + + // store planet stuff + var/old_outdoors = outdoors + var/old_dangerous_objects = dangerous_objects + + // prep for change + var/list/old_baseturfs = baseturfs + var/old_type = type + + var/list/post_change_callbacks = list() + SEND_SIGNAL(src, COMSIG_TURF_CHANGE, path, new_baseturfs, flags, post_change_callbacks) + + // change + changing_turf = TRUE + qdel(src) //Just get the side effects and call Destroy + //We do this here so anything that doesn't want to persist can clear itself + var/list/old_comp_lookup = comp_lookup?.Copy() + var/list/old_signal_procs = signal_procs?.Copy() + var/turf/W = new path(src) + + // WARNING WARNING + // Turfs DO NOT lose their signals when they get replaced, REMEMBER THIS + // It's possible because turfs are fucked, and if you have one in a list and it's replaced with another one, the list ref points to the new turf + if(old_comp_lookup) + LAZYOR(W.comp_lookup, old_comp_lookup) + if(old_signal_procs) + LAZYOR(W.signal_procs, old_signal_procs) + + for(var/datum/callback/callback as anything in post_change_callbacks) + callback.InvokeAsync(W) + + if(new_baseturfs) + W.baseturfs = baseturfs_string_list(new_baseturfs, W) + else + W.baseturfs = baseturfs_string_list(old_baseturfs, W) //Just to be safe + + if(!(flags & CHANGETURF_DEFER_CHANGE)) + W.AfterChange(flags, old_type) + + // restore planet stuff + dangerous_objects = old_dangerous_objects + if(flags & CHANGETURF_PRESERVE_OUTDOORS) + outdoors = old_outdoors + + // restore/update atmos + if(old_fire) + fire = old_fire + air_master.mark_for_update(src) + + // restore lighting + if(SSlighting.subsystem_initialized) + recalc_atom_opacity() + lighting_object = old_lighting_object + affecting_lights = old_affecting_lights + lc_topright = old_lc_topright + lc_topleft = old_lc_topleft + lc_bottomright = old_lc_bottomright + lc_bottomleft = old_lc_bottomleft + if (old_opacity != opacity || dynamic_lighting != old_dynamic_lighting) + reconsider_lights() + + if (dynamic_lighting != old_dynamic_lighting) + if (IS_DYNAMIC_LIGHTING(src)) + lighting_build_overlay() + else + lighting_clear_overlay() + + // todo: non dynamic lighting space starlight + for(var/turf/space/S in RANGE_TURFS(1, src)) //RANGE_TURFS is in code\__HELPERS\game.dm + S.update_starlight() + + QUEUE_SMOOTH(src) + QUEUE_SMOOTH_NEIGHBORS(src) + + return W + +// todo: zas refactor +/turf/simulated/ChangeTurf(path, list/new_baseturfs, flags) + if((flags & CHANGETURF_INHERIT_AIR) && ispath(path, /turf/simulated)) + // invalidate zone + if(zone) + if(can_safely_remove_from_zone()) + zone.remove(src) + SSair.mark_for_update(src) + else + zone.rebuild() + // store air + var/datum/gas_mixture/GM = remove_cell_volume() + . = ..() + if(!.) + return + if(air_master.has_valid_zone(src)) + stack_trace("zone rebuilt too fast") + // restore air + air = GM + else + // if we're not doing so, + if(zone) + // remove and rebuild zone + if(can_safely_remove_from_zone()) + zone.remove(src) + SSair.mark_for_update(src) + else + zone.rebuild() + // at this point the zone does not have our gas mixture in it, and is invalidated + . = ..() + if(!.) + return + // ensure zone didn't rebuild yet + if(air_master.has_valid_zone(src)) + stack_trace("zone reubilt too fast") + // reset air + if(!air) + air = new /datum/gas_mixture(CELL_VOLUME) + air.parse_gas_string(initial_gas_mix) + +/// Take off the top layer turf and replace it with the next baseturf down +/turf/proc/ScrapeAway(amount=1, flags) + if(!amount) + return + if(length(baseturfs)) + var/list/new_baseturfs = baseturfs.Copy() + var/turf_type = new_baseturfs[max(1, new_baseturfs.len - amount + 1)] + while(ispath(turf_type, /turf/baseturf_skipover)) + amount++ + if(amount > new_baseturfs.len) + CRASH("The bottommost baseturf of a turf is a skipover [src]([type])") + turf_type = new_baseturfs[max(1, new_baseturfs.len - amount + 1)] + new_baseturfs.len -= min(amount, new_baseturfs.len - 1) // No removing the very bottom + if(new_baseturfs.len == 1) + new_baseturfs = new_baseturfs[1] + return ChangeTurf(turf_type, new_baseturfs, flags) + + if(baseturfs == type) + return src + + return ChangeTurf(baseturfs, baseturfs, flags) // The bottom baseturf will never go away + +/** + * scrape away a turf from the bottom above logically multiz hole baseturfs + * used for shuttle ceilings + */ +/turf/proc/ScrapeFromLogicalBottom(flags, this_type_only) + // if we're already logically bottomless, don't bother + if(GLOB.multiz_hole_baseturfs[src.type]) + return + // ensure baseturfs list + if(!islist(baseturfs)) + baseturfs = list(baseturfs) + var/i + var/p + for(i in 1 to baseturfs.len) + p = baseturfs[i] + if(GLOB.multiz_hole_baseturfs[p]) + continue + if(GLOB.multiz_hole_baseturfs[p]) + if(this_type_only && this_type_only != type) + return + ScrapeAway(1, flags) // we had no baseturfs that were logically bottom + return + // make sure baseturfs are copied + var/list/new_baseturfs = baseturfs.Copy() + new_baseturfs.Cut(i, i+1) // cut out found + baseturfs = baseturfs_string_list(new_baseturfs, src) + +/** + * put a turf in from the bottom above logically multiz hole baseturfs. can changeturf. + * used for shuttle ceilings + */ +/turf/proc/PlaceBelowLogicalBottom(type, flags) + ASSERT(!GLOB.multiz_hole_baseturfs[type]) + // if we're already bottomless, just place on us + if(GLOB.multiz_hole_baseturfs[src.type]) + PlaceOnTop(type, flags = flags) + return + // ensure baseturfs list + if(!islist(baseturfs)) + baseturfs = list(baseturfs) + var/i + var/p + for(i in 1 to baseturfs.len) + p = baseturfs[i] + if(GLOB.multiz_hole_baseturfs[p]) + continue + var/list/new_baseturfs = baseturfs.Copy() + if(GLOB.multiz_hole_baseturfs[p]) + // entire list was bottomless, add on top + baseturfs = baseturfs_string_list(new_baseturfs + type, src) + return + new_baseturfs.Insert(i, type) + baseturfs = baseturfs_string_list(new_baseturfs, src) + +/** + * put a turf one below the logical top. can changeturf if logical top is a hole. + * used for shuttle floors + */ +/turf/proc/PlaceBelowLogicalTop(type, flags) + ASSERT(!GLOB.multiz_hole_baseturfs[type]) + // if we're already bottomless, just place on us + if(GLOB.multiz_hole_baseturfs[src.type]) + PlaceOnTop(type, flags = flags) + return + // ensure baseturfs list + if(!islist(baseturfs)) + baseturfs = list(baseturfs) + var/list/new_baseturfs = baseturfs.Copy() + // see i just realized "the logical top is the current turf" so uh, that's easy. + new_baseturfs.Insert(new_baseturfs.len + 1, type) + baseturfs = baseturfs_string_list(new_baseturfs, src) + +// Take the input as baseturfs and put it underneath the current baseturfs +// If fake_turf_type is provided and new_baseturfs is not the baseturfs list will be created identical to the turf type's +// If both or just new_baseturfs is provided they will be inserted below the existing baseturfs +/turf/proc/PlaceOnBottom(list/new_baseturfs, turf/fake_turf_type) + if(fake_turf_type) + if(!new_baseturfs) + if(!length(baseturfs)) + baseturfs = list(baseturfs) + var/list/old_baseturfs = baseturfs.Copy() + assemble_baseturfs(fake_turf_type) + if(!length(baseturfs)) + baseturfs = list(baseturfs) + baseturfs = baseturfs_string_list((baseturfs - (baseturfs & GLOB.blacklisted_automated_baseturfs)) + old_baseturfs, src) + return + else if(!length(new_baseturfs)) + new_baseturfs = list(new_baseturfs, fake_turf_type) + else + new_baseturfs += fake_turf_type + if(!length(baseturfs)) + baseturfs = list(baseturfs) + baseturfs = baseturfs_string_list(new_baseturfs + baseturfs, src) + +// Make a new turf and put it on top +// The args behave identical to PlaceOnBottom except they go on top +// Things placed on top of closed turfs will ignore the topmost closed turf +// Returns the new turf +/** + * WARNING WARNING: CITRP EDIT: /turf/closed check replaced with TURF DENSITY CHECK. + * every if(!density) is a if(!istype(src, /turf/closed)) in this version. + */ +/turf/proc/PlaceOnTop(list/new_baseturfs, turf/fake_turf_type, flags) + var/area/turf_area = loc + if(new_baseturfs && !length(new_baseturfs)) + new_baseturfs = list(new_baseturfs) + flags = turf_area.PlaceOnTopReact(new_baseturfs, fake_turf_type, flags) // A hook so areas can modify the incoming args + + var/turf/newT + if(flags & CHANGETURF_SKIP) // We haven't been initialized + if(src.flags & INITIALIZED) + stack_trace("CHANGETURF_SKIP was used in a PlaceOnTop call for a turf that's initialized. This is a mistake. [src]([type])") + assemble_baseturfs() + if(fake_turf_type) + if(!new_baseturfs) // If no baseturfs list then we want to create one from the turf type + if(!length(baseturfs)) + baseturfs = list(baseturfs) + var/list/old_baseturfs = baseturfs.Copy() + if(!density) + old_baseturfs += type + newT = ChangeTurf(fake_turf_type, null, flags) + newT.assemble_baseturfs(initial(fake_turf_type.baseturfs)) // The baseturfs list is created like roundstart + if(!length(newT.baseturfs)) + newT.baseturfs = list(baseturfs) + // The old baseturfs are put underneath, and we sort out the unwanted ones + newT.baseturfs = baseturfs_string_list(old_baseturfs + (newT.baseturfs - GLOB.blacklisted_automated_baseturfs), newT) + return newT + if(!length(baseturfs)) + baseturfs = list(baseturfs) + if(!density) + new_baseturfs = list(type) + new_baseturfs + baseturfs = baseturfs_string_list(baseturfs + new_baseturfs, src) + return ChangeTurf(fake_turf_type, null, flags) + if(!length(baseturfs)) + baseturfs = list(baseturfs) + if(!density) + baseturfs = baseturfs_string_list(baseturfs + type, src) + var/turf/change_type + if(length(new_baseturfs)) + change_type = new_baseturfs[new_baseturfs.len] + new_baseturfs.len-- + if(new_baseturfs.len) + baseturfs = baseturfs_string_list(baseturfs + new_baseturfs, src) + else + change_type = new_baseturfs + return ChangeTurf(change_type, null, flags) + +// Copy an existing turf and put it on top +// Returns the new turf +/turf/proc/CopyOnTop(turf/copytarget, ignore_bottom=1, depth=INFINITY, copy_air = FALSE) + var/list/new_baseturfs = list() + new_baseturfs += baseturfs + new_baseturfs += type + + if(depth) + var/list/target_baseturfs + if(length(copytarget.baseturfs)) + // with default inputs this would be Copy(clamp(2, -INFINITY, baseturfs.len)) + // Don't forget a lower index is lower in the baseturfs stack, the bottom is baseturfs[1] + target_baseturfs = copytarget.baseturfs.Copy(clamp(1 + ignore_bottom, 1 + copytarget.baseturfs.len - depth, copytarget.baseturfs.len)) + else if(!ignore_bottom) + target_baseturfs = list(copytarget.baseturfs) + if(target_baseturfs) + target_baseturfs -= new_baseturfs & GLOB.blacklisted_automated_baseturfs + new_baseturfs += target_baseturfs + + var/turf/newT = copytarget.CopyTurf(src, copy_air) + newT.baseturfs = baseturfs_string_list(new_baseturfs, newT) + return newT + +//If you modify this function, ensure it works correctly with lateloaded map templates. +/turf/proc/AfterChange(flags, oldType) //called after a turf has been replaced in ChangeTurf() + levelupdate() + update_vertical_turf_graphics() + +/turf/simulated/AfterChange(flags, oldType) + ..() + RemoveLattice() + +/turf/proc/RemoveLattice() + for(var/obj/structure/lattice/L in src) + qdel(L) + +/turf/proc/ReplaceWithLattice() + ScrapeAway(flags = CHANGETURF_INHERIT_AIR) + new /obj/structure/lattice(locate(x, y, z)) diff --git a/code/game/turfs/simulated/fancy_shuttles.dm b/code/game/turfs/simulated/fancy_shuttles.dm index 910afccf759..cd2aa22db7f 100644 --- a/code/game/turfs/simulated/fancy_shuttles.dm +++ b/code/game/turfs/simulated/fancy_shuttles.dm @@ -107,7 +107,7 @@ GLOBAL_LIST_EMPTY(fancy_shuttles) /turf/simulated/wall/fancy_shuttle/proc/apply_underlay() remove_underlay() - var/turf/path = get_base_turf_by_area(src) || /turf/space + var/turf/path = (baseturfs && (islist(baseturfs)? baseturfs[1] : baseturfs)) || /turf/space var/do_plane = null var/do_state = initial(path.icon_state) diff --git a/code/game/turfs/simulated/floor.dm b/code/game/turfs/simulated/floor.dm index 670d4eb32fa..0187e7ea257 100644 --- a/code/game/turfs/simulated/floor.dm +++ b/code/game/turfs/simulated/floor.dm @@ -164,5 +164,5 @@ return TRUE if(RCD_DECONSTRUCT) to_chat(user, SPAN_NOTICE("You deconstruct \the [src].")) - ChangeTurf(get_base_turf_by_area(src), preserve_outdoors = TRUE) + ScrapeAway(flags = CHANGETURF_INHERIT_AIR|CHANGETURF_PRESERVE_OUTDOORS) return TRUE diff --git a/code/game/turfs/simulated/floor_acts.dm b/code/game/turfs/simulated/floor_acts.dm index fac9fe3d06b..34244a53960 100644 --- a/code/game/turfs/simulated/floor_acts.dm +++ b/code/game/turfs/simulated/floor_acts.dm @@ -2,14 +2,14 @@ //set src in oview(1) switch(severity) if(1.0) - src.ChangeTurf(get_base_turf_by_area(src)) + ScrapeAway(flags = CHANGETURF_INHERIT_AIR) if(2.0) switch(pick(40;1,40;2,3)) if (1) if(prob(33)) new /obj/item/stack/material/steel(src) src.ReplaceWithLattice() if(2) - src.ChangeTurf(get_base_turf_by_area(src)) + ScrapeAway(flags = CHANGETURF_INHERIT_AIR) if(3) if(prob(33)) new /obj/item/stack/material/steel(src) if(prob(80)) diff --git a/code/game/turfs/simulated/floor_attackby.dm b/code/game/turfs/simulated/floor_attackby.dm index b3a150891b4..14bf99ca0f8 100644 --- a/code/game/turfs/simulated/floor_attackby.dm +++ b/code/game/turfs/simulated/floor_attackby.dm @@ -33,7 +33,7 @@ if(R.use(1)) // Cost of roofing tiles is 1:1 with cost to place lattice and plating T.ReplaceWithLattice() - T.ChangeTurf(/turf/simulated/floor, preserve_outdoors = TRUE) + T.ChangeTurf(/turf/simulated/floor, flags = CHANGETURF_INHERIT_AIR | CHANGETURF_PRESERVE_OUTDOORS) playsound(src, 'sound/weapons/Genhit.ogg', 50, 1) user.visible_message("[user] patches a hole in the ceiling.", "You patch a hole in the ceiling.") expended_tile = TRUE diff --git a/code/game/turfs/simulated/floor_types.dm b/code/game/turfs/simulated/floor_types.dm index dc3df2bcd2c..2974488716e 100644 --- a/code/game/turfs/simulated/floor_types.dm +++ b/code/game/turfs/simulated/floor_types.dm @@ -5,71 +5,12 @@ /turf/simulated/floor/diona/attackby() return -// Shuttle Floors -/obj/landed_holder - name = "landed turf holder" - desc = "holds all the info about the turf this turf 'landed on'" - var/turf/turf_type - var/turf/simulated/shuttle/my_turf - var/image/turf_image - var/list/decals - - New(var/location = null, var/turf/simulated/shuttle/turf) - ..(null) - my_turf = turf - -/obj/landed_holder/proc/land_on(var/turf/T) - // Gather destination information - var/obj/landed_holder/new_holder = new(null) - new_holder.turf_type = T.type - new_holder.dir = T.dir - new_holder.icon = T.icon - new_holder.icon_state = T.icon_state - new_holder.copy_overlays(T, TRUE) - new_holder.underlays = T.underlays.Copy() - new_holder.decals = T.decals ? T.decals.Copy() : null - - // Set the destination to be like us - T.Destroy() - var/turf/simulated/shuttle/new_dest = T.ChangeTurf(my_turf.type,,1) - new_dest.setDir(my_turf.dir) - new_dest.icon_state = my_turf.icon_state - new_dest.icon = my_turf.icon - new_dest.copy_overlays(my_turf, TRUE) - new_dest.underlays = my_turf.underlays - new_dest.decals = my_turf.decals - // Shuttle specific stuff - new_dest.interior_corner = my_turf.interior_corner - new_dest.takes_underlays = my_turf.takes_underlays - new_dest.under_turf = my_turf.under_turf - new_dest.join_flags = my_turf.join_flags - new_dest.join_group = my_turf.join_group - - // Associate the holder with the new turf. - new_holder.my_turf = new_dest - new_dest.landed_holder = new_holder - - // Update underlays if necessary (interior corners won't have changed). - if(new_dest.takes_underlays && !new_dest.interior_corner) - new_dest.underlay_update() - - return new_dest - -/obj/landed_holder/proc/leave_turf(var/turf/base_turf = null) - var/turf/new_source - // Change our source to whatever it was before - if(turf_type) - new_source = my_turf.ChangeTurf(turf_type,,1) - new_source.setDir(dir) - new_source.icon_state = icon_state - new_source.icon = icon - new_source.copy_overlays(src, TRUE) - new_source.underlays = underlays - new_source.decals = decals - else - new_source = my_turf.ChangeTurf(base_turf ? base_turf : get_base_turf_by_area(my_turf),,1) - - return new_source +/turf/simulated/shuttle_ceiling + name = "shuttle ceiling" + icon = 'icons/turf/shuttle_white.dmi' + icon_state = "floor_glass" + desc = "An extremely thick segment of hull used by spacefaring vessels. Doesn't look like you'll be able to break it." + baseturfs = /turf/simulated/shuttle_ceiling /turf/simulated/shuttle name = "shuttle" @@ -77,9 +18,8 @@ thermal_conductivity = 0.05 heat_capacity = 0 - var/obj/landed_holder/landed_holder var/interior_corner = 0 - var/takes_underlays = 0 + var/takes_underlays = TRUE var/turf/under_turf // Underlay override turf path. var/join_flags = 0 // Bitstring to represent adjacency of joining walls var/join_group = "shuttle" // A tag for what other walls to join with. Null if you don't want them to. @@ -94,10 +34,6 @@ I.plane = LIGHTING_PLANE antilight_cache["[diag]"] = I -/turf/simulated/shuttle/Destroy() - landed_holder = null - ..() - // For joined corners touching static lighting turfs, add an overlay to cancel out that part of our lighting overlay. /turf/simulated/shuttle/proc/update_breaklights() if(join_flags in GLOB.cornerdirs) // We're joined at an angle @@ -121,23 +57,6 @@ if(under_turf) under = under_turf - // Well if this isn't our first rodeo, we know EXACTLY what we landed on, and it looks like this. - if(landed_holder && !interior_corner) - // Space gets special treatment - if(ispath(landed_holder.turf_type, /turf/space)) - var/image/spaceimage = image(landed_holder.icon, landed_holder.icon_state) - spaceimage.plane = SPACE_PLANE - underlays = list(spaceimage) - else - var/mutable_appearance/landed_on = new(landed_holder) - landed_on.layer = FLOAT_LAYER // Not turf - landed_on.plane = FLOAT_PLANE // Not turf - us.underlays = list(landed_on) - appearance = us - - spawn update_breaklights() // So that we update the breaklight overlays only after turfs are connected - return - if(!under) var/turf/T1 var/turf/T2 @@ -151,10 +70,10 @@ under = T1 else if(isfloor(T2) && T2.type == T3.type) under = T2 - else if(isfloor(T3) || istype(T3,/turf/space/transit)) + else if(isfloor(T3) || istype(T3, /turf/space)) under = T3 else - under = get_base_turf_by_area(src) + under = (baseturfs && (islist(baseturfs)? baseturfs[1] : baseturfs)) || /turf/space if(istype(under,/turf/simulated/shuttle)) interior_corner = 1 // Prevents us from 'landing on grass' and having interior corners update. diff --git a/code/game/turfs/simulated/floor_types_eris.dm b/code/game/turfs/simulated/floor_types_eris.dm index 3923c858d37..cb1b4354915 100644 --- a/code/game/turfs/simulated/floor_types_eris.dm +++ b/code/game/turfs/simulated/floor_types_eris.dm @@ -876,10 +876,7 @@ icon_state = "grass-heavy0" edge_blending_priority = 4 initial_flooring = /decl/flooring/grass/heavy - turf_layers = list( - /turf/simulated/floor/outdoors/rocks, - /turf/simulated/floor/outdoors/dirt - ) + baseturfs = /turf/simulated/floor/outdoors/dirt grass_chance = 40 grass_types = list( diff --git a/code/game/turfs/simulated/outdoors/dirt.dm b/code/game/turfs/simulated/outdoors/dirt.dm index e2d588b3446..40a0c65f1fb 100644 --- a/code/game/turfs/simulated/outdoors/dirt.dm +++ b/code/game/turfs/simulated/outdoors/dirt.dm @@ -4,8 +4,7 @@ icon_state = "dirt-dark" edge_blending_priority = 2 initial_flooring = /decl/flooring/outdoors/dirt - turf_layers = list(/turf/simulated/floor/outdoors/rocks) - + baseturfs = /turf/baseturf_bottom /turf/simulated/floor/outdoors/dirtlight name = "dirt" @@ -13,5 +12,4 @@ icon_state = "dirt-light" edge_blending_priority = 2 initial_flooring = /decl/flooring/outdoors/dirt - turf_layers = list(/turf/simulated/floor/outdoors/rocks) - + baseturfs = /turf/baseturf_bottom diff --git a/code/game/turfs/simulated/outdoors/grass.dm b/code/game/turfs/simulated/outdoors/grass.dm index 691ae210732..63439044c83 100644 --- a/code/game/turfs/simulated/outdoors/grass.dm +++ b/code/game/turfs/simulated/outdoors/grass.dm @@ -7,10 +7,7 @@ var/list/grass_types = list( icon_state = "grass" edge_blending_priority = 4 initial_flooring = /decl/flooring/outdoors/grass - turf_layers = list( - /turf/simulated/floor/outdoors/rocks, - /turf/simulated/floor/outdoors/dirt - ) + baseturfs = /turf/simulated/floor/outdoors/dirt var/grass_chance = 20 var/list/grass_types = list( diff --git a/code/game/turfs/simulated/outdoors/outdoors.dm b/code/game/turfs/simulated/outdoors/outdoors.dm index 8aa2f16356a..a031492da51 100644 --- a/code/game/turfs/simulated/outdoors/outdoors.dm +++ b/code/game/turfs/simulated/outdoors/outdoors.dm @@ -16,9 +16,7 @@ var/list/turf_edge_cache = list() outdoors = TRUE // This variable is used for weather effects. can_dirty = FALSE // Looks hideous with dirt on it. can_build_into_floor = TRUE - - // When a turf gets demoted or promoted, this list gets adjusted. The top-most layer is the layer on the bottom of the list, due to how pop() works. - var/list/turf_layers = list(/turf/simulated/floor/outdoors/rocks) + baseturfs = /turf/simulated/floor/outdoors/rocks /turf/simulated/floor/outdoors/Initialize(mapload) update_icon() @@ -42,8 +40,8 @@ var/list/turf_edge_cache = list() outdoors = FALSE SSplanets.removeTurf(src) -/turf/simulated/post_change() - ..() +/turf/simulated/AfterChange(flags, oldType) + . = ..() // If it was outdoors and still is, it will not get added twice when the planet controller gets around to putting it in. if(outdoors) make_outdoors() @@ -64,40 +62,17 @@ var/list/turf_edge_cache = list() desc = "Hard as a rock." icon_state = "rock" edge_blending_priority = 1 + baseturfs = /turf/baseturf_bottom /turf/simulated/floor/outdoors/rocks/caves outdoors = FALSE -// This proc adds a 'layer' on top of the turf. -/turf/simulated/floor/outdoors/proc/promote(var/new_turf_type) - var/list/new_turf_layer_list = turf_layers.Copy() - var/list/coords = list(x, y, z) - - new_turf_layer_list.Add(src.type) - - ChangeTurf(new_turf_type) - var/turf/simulated/floor/outdoors/T = locate(coords[1], coords[2], coords[3]) - if(istype(T)) - T.turf_layers = new_turf_layer_list.Copy() - -// This proc removes the topmost layer. -/turf/simulated/floor/outdoors/proc/demote() - if(!turf_layers.len) - return // Cannot demote further. - var/list/new_turf_layer_list = turf_layers.Copy() - var/list/coords = list(x, y, z) - - ChangeTurf(pop(new_turf_layer_list)) - var/turf/simulated/floor/outdoors/T = locate(coords[1], coords[2], coords[3]) - if(istype(T)) - T.turf_layers = new_turf_layer_list.Copy() - // Called by weather processes, and maybe technomancers in the future. /turf/simulated/floor/proc/chill() return /turf/simulated/floor/outdoors/chill() - promote(/turf/simulated/floor/outdoors/snow) + PlaceOnTop(/turf/simulated/floor/outdoors/snow, flags = CHANGETURF_PRESERVE_OUTDOORS|CHANGETURF_INHERIT_AIR) /turf/simulated/floor/outdoors/snow/chill() return // Todo: Add heavy snow. @@ -106,17 +81,11 @@ var/list/turf_edge_cache = list() switch(severity) //VOREStation Edit - Outdoor turfs less explosion resistant if(1) - if(prob(66)) - ChangeTurf(get_base_turf_by_area(src)) - return - demote() + ScrapeAway(flags = CHANGETURF_INHERIT_AIR|CHANGETURF_PRESERVE_OUTDOORS) if(2) - if(prob(33)) - return - else if(prob(33)) - demote() + if(prob(66)) + ScrapeAway(flags = CHANGETURF_INHERIT_AIR|CHANGETURF_PRESERVE_OUTDOORS) //VOREStation Edit End if(3) - if(prob(66)) - return - demote() + if(prob(15)) + ScrapeAway(flags = CHANGETURF_INHERIT_AIR|CHANGETURF_PRESERVE_OUTDOORS) diff --git a/code/game/turfs/simulated/outdoors/snow.dm b/code/game/turfs/simulated/outdoors/snow.dm index c8f3810a733..c4ff91c2dd1 100644 --- a/code/game/turfs/simulated/outdoors/snow.dm +++ b/code/game/turfs/simulated/outdoors/snow.dm @@ -4,10 +4,7 @@ edge_blending_priority = 6 movement_cost = 2 initial_flooring = /decl/flooring/snow - turf_layers = list( - /turf/simulated/floor/outdoors/rocks, - /turf/simulated/floor/outdoors/dirt - ) + baseturfs = /turf/simulated/floor/outdoors/dirt var/list/crossed_dirs = list() @@ -32,7 +29,7 @@ if(do_after(user, 4 SECONDS * W.toolspeed)) to_chat(user, "\The [src] has been dug up, and now lies in a pile nearby.") new /obj/item/stack/material/snow(src) - demote() + ScrapeAway(flags = CHANGETURF_INHERIT_AIR|CHANGETURF_PRESERVE_OUTDOORS) else to_chat(user, "You decide to not finish removing \the [src].") else diff --git a/code/game/turfs/simulated/wall_attacks.dm b/code/game/turfs/simulated/wall_attacks.dm index 8a74c37dc1a..8f1c5f653f8 100644 --- a/code/game/turfs/simulated/wall_attacks.dm +++ b/code/game/turfs/simulated/wall_attacks.dm @@ -181,8 +181,7 @@ if(T) if(istype(T, /turf/simulated/open) || istype(T, /turf/space)) if(R.use(1)) // Cost of roofing tiles is 1:1 with cost to place lattice and plating - T.ReplaceWithLattice() - T.ChangeTurf(/turf/simulated/floor, preserve_outdoors = TRUE) + T.ChangeTurf(/turf/simulated/floor/plating, flags = CHANGETURF_PRESERVE_OUTDOORS) playsound(src, 'sound/weapons/Genhit.ogg', 50, 1) user.visible_message("[user] patches a hole in the ceiling.", "You patch a hole in the ceiling.") expended_tile = TRUE diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm index 2b9ba6b30bf..195e4bf971c 100644 --- a/code/game/turfs/simulated/walls.dm +++ b/code/game/turfs/simulated/walls.dm @@ -9,6 +9,7 @@ // air_status = AIR_STATUS_BLOCK thermal_conductivity = WALL_HEAT_TRANSFER_COEFFICIENT heat_capacity = 312500 //a little over 5 cm thick , 312500 for 1 m by 2.5 m by 0.25 m plasteel wall + baseturfs = /turf/simulated/floor/plating var/icon/wall_masks = 'icons/turf/wall_masks.dmi' var/damage = 0 @@ -46,7 +47,11 @@ /turf/simulated/wall/Destroy() STOP_PROCESSING(SSturfs, src) - dismantle_wall(null, null, TRUE, !changing_turf) + clear_plants() + material = get_material_by_name("placeholder") + reinf_material = null + girder_material = null + update_connections(1) return ..() /turf/simulated/wall/process(delta_time) @@ -120,10 +125,6 @@ plant.pixel_y = 0 plant.update_neighbors() -/turf/simulated/wall/ChangeTurf(var/turf/N, var/tell_universe, var/force_lighting_update, var/preserve_outdoors) - clear_plants() - return ..(N, tell_universe, force_lighting_update, preserve_outdoors) - //Appearance /turf/simulated/wall/examine(mob/user) . = ..() @@ -190,8 +191,7 @@ return ..() -/turf/simulated/wall/proc/dismantle_wall(var/devastated, var/explode, var/no_product, changeturf = TRUE) - +/turf/simulated/wall/proc/dismantle_wall(var/devastated, var/explode, var/no_product) playsound(src, 'sound/items/Welder.ogg', 100, 1) if(!no_product) if(reinf_material) @@ -209,22 +209,14 @@ P.roll_and_drop(src) else O.forceMove(src) - - clear_plants() - material = get_material_by_name("placeholder") - reinf_material = null - girder_material = null - update_connections(1) - - if(changeturf) - ChangeTurf(/turf/simulated/floor/plating) + ScrapeAway() /turf/simulated/wall/ex_act(severity) switch(severity) if(1.0) if(girder_material.explosion_resistance >= 25 && prob(girder_material.explosion_resistance)) new /obj/structure/girder/displaced(src, girder_material.name) - src.ChangeTurf(get_base_turf_by_area(src)) + ScrapeAway() if(2.0) if(prob(75)) take_damage(rand(150, 250)) @@ -232,8 +224,6 @@ dismantle_wall(1,1) if(3.0) take_damage(rand(0, 250)) - else - return // Wall-rot effect, a nasty fungus that destroys walls. /turf/simulated/wall/proc/rot() @@ -314,6 +304,6 @@ /turf/simulated/wall/rcd_act(mob/living/user, obj/item/rcd/the_rcd, passed_mode) if(passed_mode == RCD_DECONSTRUCT) to_chat(user, SPAN_NOTICE("You deconstruct \the [src].")) - ChangeTurf(/turf/simulated/floor/airless, preserve_outdoors = TRUE) + ChangeTurf(/turf/simulated/floor/airless, flags = CHANGETURF_PRESERVE_OUTDOORS) return TRUE return FALSE diff --git a/code/game/turfs/space/space.dm b/code/game/turfs/space/space.dm index a1bf2a40471..9b7b5e01e3e 100644 --- a/code/game/turfs/space/space.dm +++ b/code/game/turfs/space/space.dm @@ -14,7 +14,10 @@ var/edge = 0 // If we're an edge var/forced_dirs = 0 // Force this one to pretend it's an overedge turf -/turf/open/space/basic/New() //Do not convert to Initialize +/turf/space/basic + flags = INITIALIZED + +/turf/space/basic/New() //Do not convert to Initialize //This is used to optimize the map loader return @@ -121,6 +124,3 @@ /turf/space/proc/on_atom_edge_touch(atom/movable/AM) if(!QDELETED(AM) && (AM.loc == src)) AM.touch_map_edge() - -/turf/space/ChangeTurf(var/turf/N, var/tell_universe, var/force_lighting_update, var/preserve_outdoors) - return ..(N, tell_universe, 1, preserve_outdoors) diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 11b0f3a48b0..fb11743261c 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -22,7 +22,16 @@ /// Does this turf contain air/let air through? var/blocks_air = FALSE + // Baseturfs System + // baseturfs can be either a list or a single turf type. + // In class definition like here it should always be a single type. + // A list will be created in initialization that figures out the baseturf's baseturf etc. + // In the case of a list it is sorted from bottom layer to top. + // This shouldn't be modified directly, use the helper procs. + var/list/baseturfs = /turf/baseturf_bottom + /// are we mid changeturf? var/changing_turf = FALSE + // End /// Icon-smoothing variable to map a diagonal wall corner with a fixed underlay. var/list/fixed_underlay = null @@ -70,6 +79,8 @@ // by default, vis_contents is inherited from the turf that was here before vis_contents.Cut() + assemble_baseturfs() + //atom color stuff if(color) add_atom_colour(color, FIXED_COLOUR_PRIORITY) @@ -357,7 +368,7 @@ /turf/rcd_act(mob/living/user, obj/item/rcd/the_rcd, passed_mode) if(passed_mode == RCD_FLOORWALL) to_chat(user, SPAN_NOTICE("You build a floor.")) - ChangeTurf(/turf/simulated/floor/airless, preserve_outdoors = TRUE) + ChangeTurf(/turf/simulated/floor, flags = CHANGETURF_INHERIT_AIR|CHANGETURF_PRESERVE_OUTDOORS) return TRUE return FALSE diff --git a/code/game/turfs/turf_changing.dm b/code/game/turfs/turf_changing.dm deleted file mode 100644 index 43b491fb6ba..00000000000 --- a/code/game/turfs/turf_changing.dm +++ /dev/null @@ -1,129 +0,0 @@ -/turf/proc/ReplaceWithLattice() - src.ChangeTurf(get_base_turf_by_area(src)) - spawn() - new /obj/structure/lattice( locate(src.x, src.y, src.z) ) - -// Removes all signs of lattice on the pos of the turf -Donkieyo -/turf/proc/RemoveLattice() - var/obj/structure/lattice/L = locate(/obj/structure/lattice, src) - if(L) - qdel(L) - -// Called after turf replaces old one -/turf/proc/post_change() - levelupdate() - - var/turf/simulated/open/above = GetAbove(src) - if(istype(above)) - above.update_icon() - - var/turf/simulated/below = GetBelow(src) - if(istype(below)) - below.update_icon() // To add or remove the 'ceiling-less' overlay. - -//Creates a new turf -/turf/proc/ChangeTurf(var/turf/N, var/tell_universe=1, var/force_lighting_update = 0, var/preserve_outdoors = FALSE) - if (!N) - return - - if(N == /turf/space) - var/turf/below = GetBelow(src) - if(istype(below) && (air_master.has_valid_zone(below) || air_master.has_valid_zone(src)) && (!istype(below, /turf/unsimulated/wall) && !istype(below, /turf/simulated/sky))) // VOREStation Edit: Weird open space - N = /turf/simulated/open - - var/old_opacity = opacity - var/old_dynamic_lighting = dynamic_lighting - var/old_affecting_lights = affecting_lights - var/old_lighting_object = lighting_object - var/old_lc_topright = lc_topright - var/old_lc_topleft = lc_topleft - var/old_lc_bottomright = lc_bottomright - var/old_lc_bottomleft = lc_bottomleft - - var/atom/movable/fire/old_fire = fire - var/old_outdoors = outdoors - var/old_dangerous_objects = dangerous_objects - - //to_chat(world, "Replacing [src.type] with [N]") - - if(connections) - connections.erase_all() - - if(istype(src, /turf/simulated)) - //Yeah, we're just going to rebuild the whole thing. - //Despite this being called a bunch during explosions, - //the zone will only really do heavy lifting once. - var/turf/simulated/S = src - if(S.zone) - S.zone.rebuild() - - changing_turf = TRUE - qdel(src) //Just get the side effects and call Destroy - - if(ispath(N, /turf/simulated/floor)) - var/turf/simulated/W = new N( locate(src.x, src.y, src.z) ) - if(old_fire) - fire = old_fire - - if (istype(W,/turf/simulated/floor)) - W.RemoveLattice() - - if(tell_universe) - universe.OnTurfChange(W) - - if(air_master) - air_master.mark_for_update(src) //handle the addition of the new turf. - - for(var/turf/space/S in range(W,1)) - S.update_starlight() - - W.levelupdate() - W.update_icon(1) - W.post_change() - . = W - - else - - var/turf/W = new N( locate(src.x, src.y, src.z) ) - - if(old_fire) - qdel(old_fire) - - if(tell_universe) - universe.OnTurfChange(W) - - if(air_master) - air_master.mark_for_update(src) - - for(var/turf/space/S in range(W,1)) - S.update_starlight() - - W.levelupdate() - W.update_icon(1) - W.post_change() - . = W - - dangerous_objects = old_dangerous_objects - - if(SSlighting.subsystem_initialized) - recalc_atom_opacity() - lighting_object = old_lighting_object - affecting_lights = old_affecting_lights - lc_topright = old_lc_topright - lc_topleft = old_lc_topleft - lc_bottomright = old_lc_bottomright - lc_bottomleft = old_lc_bottomleft - if (old_opacity != opacity || dynamic_lighting != old_dynamic_lighting) - reconsider_lights() - - if (dynamic_lighting != old_dynamic_lighting) - if (IS_DYNAMIC_LIGHTING(src)) - lighting_build_overlay() - else - lighting_clear_overlay() - - for(var/turf/space/S in RANGE_TURFS(1, src)) //RANGE_TURFS is in code\__HELPERS\game.dm - S.update_starlight() - - if(preserve_outdoors) - outdoors = old_outdoors diff --git a/code/modules/admin/verbs/buildmode.dm b/code/modules/admin/verbs/buildmode.dm index 6a87204e12f..db9d77e38ac 100644 --- a/code/modules/admin/verbs/buildmode.dm +++ b/code/modules/admin/verbs/buildmode.dm @@ -316,17 +316,9 @@ T.ChangeTurf(/turf/simulated/wall/r_wall) return else if(pa.Find("right")) - if(istype(object,/turf/simulated/wall)) + if(istype(object, /turf)) var/turf/T = object - T.ChangeTurf(/turf/simulated/floor) - return - else if(istype(object,/turf/simulated/floor)) - var/turf/T = object - T.ChangeTurf(/turf/space) - return - else if(istype(object,/turf/simulated/wall/r_wall)) - var/turf/T = object - T.ChangeTurf(/turf/simulated/wall) + T.ScrapeAway() return else if(istype(object,/obj)) qdel(object) diff --git a/code/modules/mapping/map_helpers/baseturf.dm b/code/modules/mapping/map_helpers/baseturf.dm index 156b09fc367..d1c2d07794c 100644 --- a/code/modules/mapping/map_helpers/baseturf.dm +++ b/code/modules/mapping/map_helpers/baseturf.dm @@ -1,12 +1,12 @@ /obj/effect/baseturf_helper //Set the baseturfs of every turf in the /area/ it is placed. name = "baseturf editor" - icon = 'icons/effects/mapping_helpers.dmi' + icon = 'icons/mapping/helpers/mapping_helpers.dmi' icon_state = "" var/list/baseturf_to_replace var/baseturf - layer = POINT_LAYER + layer = ABOVE_WINDOW_LAYER /obj/effect/baseturf_helper/Initialize(mapload) . = ..() @@ -14,7 +14,7 @@ /obj/effect/baseturf_helper/LateInitialize() if(!baseturf_to_replace) - baseturf_to_replace = typecacheof(list(/turf/open/space,/turf/baseturf_bottom)) + baseturf_to_replace = typecacheof(list(/turf/space, /turf/baseturf_bottom)) else if(!length(baseturf_to_replace)) baseturf_to_replace = list(baseturf_to_replace = TRUE) else if(baseturf_to_replace[baseturf_to_replace[1]] != TRUE) // It's not associative @@ -46,37 +46,37 @@ /obj/effect/baseturf_helper/space name = "space baseturf editor" - baseturf = /turf/open/space + baseturf = /turf/space -/obj/effect/baseturf_helper/asteroid - name = "asteroid baseturf editor" - baseturf = /turf/open/floor/plating/asteroid +// /obj/effect/baseturf_helper/asteroid +// name = "asteroid baseturf editor" +// baseturf = /turf/open/floor/plating/asteroid -/obj/effect/baseturf_helper/asteroid/airless - name = "asteroid airless baseturf editor" - baseturf = /turf/open/floor/plating/asteroid/airless +// /obj/effect/baseturf_helper/asteroid/airless +// name = "asteroid airless baseturf editor" +// baseturf = /turf/open/floor/plating/asteroid/airless -/obj/effect/baseturf_helper/asteroid/basalt - name = "asteroid basalt baseturf editor" - baseturf = /turf/open/floor/plating/asteroid/basalt +// /obj/effect/baseturf_helper/asteroid/basalt +// name = "asteroid basalt baseturf editor" +// baseturf = /turf/open/floor/plating/asteroid/basalt -/obj/effect/baseturf_helper/asteroid/snow - name = "asteroid snow baseturf editor" - baseturf = /turf/open/floor/plating/asteroid/snow +// /obj/effect/baseturf_helper/asteroid/snow +// name = "asteroid snow baseturf editor" +// baseturf = /turf/open/floor/plating/asteroid/snow -/obj/effect/baseturf_helper/beach/sand - name = "beach sand baseturf editor" - baseturf = /turf/open/floor/plating/beach/sand +// /obj/effect/baseturf_helper/beach/sand +// name = "beach sand baseturf editor" +// baseturf = /turf/open/floor/plating/beach/sand -/obj/effect/baseturf_helper/beach/water - name = "water baseturf editor" - baseturf = /turf/open/floor/plating/beach/water +// /obj/effect/baseturf_helper/beach/water +// name = "water baseturf editor" +// baseturf = /turf/open/floor/plating/beach/water -/obj/effect/baseturf_helper/lava - name = "lava baseturf editor" - baseturf = /turf/open/lava/smooth +// /obj/effect/baseturf_helper/lava +// name = "lava baseturf editor" +// baseturf = /turf/open/lava/smooth -/obj/effect/baseturf_helper/lava_land/surface - name = "lavaland baseturf editor" - baseturf = /turf/open/lava/smooth/lava_land_surface +// /obj/effect/baseturf_helper/lava_land/surface +// name = "lavaland baseturf editor" +// baseturf = /turf/open/lava/smooth/lava_land_surface diff --git a/code/modules/mapping/space_management/space_reservation.dm b/code/modules/mapping/space_management/space_reservation.dm index 84386f66c11..bdc9053b704 100644 --- a/code/modules/mapping/space_management/space_reservation.dm +++ b/code/modules/mapping/space_management/space_reservation.dm @@ -13,8 +13,8 @@ /* /datum/turf_reservation/transit - turf_type = /turf/open/space/transit - borderturf = /turf/open/space/transit/border + turf_type = /turf/space/transit + borderturf = /turf/space/transit/border */ /datum/turf_reservation/proc/Release() @@ -26,7 +26,7 @@ /* /datum/turf_reservation/transit/Release() - for(var/turf/open/space/transit/T in reserved_turfs) + for(var/turf/space/transit/T in reserved_turfs) for(var/atom/movable/AM in T) T.throw_atom(AM) . = ..() diff --git a/code/modules/mapping/space_management/space_transition.dm b/code/modules/mapping/space_management/space_transition.dm index acde399251f..5b637f21eb5 100644 --- a/code/modules/mapping/space_management/space_transition.dm +++ b/code/modules/mapping/space_management/space_transition.dm @@ -122,7 +122,7 @@ D = D.neigbours["[dirside]"] zdestination = D.z_value D = I - for(var/turf/open/space/S in turfblock) + for(var/turf/space/S in turfblock) S.destination_x = x_pos_transition[side] == 1 ? S.x : x_pos_transition[side] S.destination_y = y_pos_transition[side] == 1 ? S.y : y_pos_transition[side] S.destination_z = zdestination diff --git a/code/modules/maps/away_missions/140x140/snow_outpost.dm b/code/modules/maps/away_missions/140x140/snow_outpost.dm index a77c03451f1..85dbe0c984a 100644 --- a/code/modules/maps/away_missions/140x140/snow_outpost.dm +++ b/code/modules/maps/away_missions/140x140/snow_outpost.dm @@ -13,9 +13,7 @@ icon_state = "blank" mobcountmax = 0 floracountmax = 0 - base_turf = /turf/snow/snow2 ambience = list('sound/music/main.ogg', 'sound/ambience/maintenance/maintenance4.ogg', 'sound/ambience/sif/sif1.ogg', 'sound/ambience/ruins/ruins1.ogg') - base_turf = /turf/simulated/floor/snow/snow2 /area/awaymission/snow_outpost/outside icon_state = "away1" diff --git a/code/modules/maps/away_missions/140x140/snowfield.dm b/code/modules/maps/away_missions/140x140/snowfield.dm index 9c9ee9e2c43..4eb7ec94125 100644 --- a/code/modules/maps/away_missions/140x140/snowfield.dm +++ b/code/modules/maps/away_missions/140x140/snowfield.dm @@ -12,9 +12,7 @@ /area/awaymission/snowfield icon_state = "blank" // requires_power = 0 - base_turf = /turf/snow/snow2 ambience = list('sound/ambience/ambispace.ogg','sound/music/title2.ogg','sound/music/space.ogg','sound/music/main.ogg','sound/music/traitor.ogg') - base_turf = /turf/simulated/floor/snow/snow2 /area/awaymission/snowfield/outside icon_state = "green" diff --git a/code/modules/maps/generic/shuttles/cruiser.dm b/code/modules/maps/generic/shuttles/cruiser.dm index 5566330300a..9f003bdb077 100644 --- a/code/modules/maps/generic/shuttles/cruiser.dm +++ b/code/modules/maps/generic/shuttles/cruiser.dm @@ -3,7 +3,6 @@ /area/mothership requires_power = 1 flags = RAD_SHIELDED - base_turf = /turf/space icon_state = "blue2" /area/mothership/breakroom diff --git a/code/modules/maps/generic/submaps/mountains/mountains_areas_vr.dm b/code/modules/maps/generic/submaps/mountains/mountains_areas_vr.dm deleted file mode 100644 index 8fb98ffe547..00000000000 --- a/code/modules/maps/generic/submaps/mountains/mountains_areas_vr.dm +++ /dev/null @@ -1,2 +0,0 @@ -/area/submap/cave - base_turf = /turf/simulated/mineral/floor/ignore_mapgen/cave diff --git a/code/modules/maps/tether/levels/alienship.dm b/code/modules/maps/tether/levels/alienship.dm index c7abfbef624..075d9ebf9b0 100644 --- a/code/modules/maps/tether/levels/alienship.dm +++ b/code/modules/maps/tether/levels/alienship.dm @@ -107,7 +107,6 @@ /area/shuttle/excursion/away_alienship name = "\improper Excursion Shuttle - Alien Ship" - base_turf = /turf/simulated/shuttle/floor/alienplating var/did_entry = FALSE var/list/teleport_to var/area/dump_area @@ -174,7 +173,6 @@ /area/tether_away/alienship name = "\improper Away Mission - Unknown Vessel" icon_state = "away" - base_turf = /turf/space requires_power = FALSE /area/tether_away/alienship/equip_dump diff --git a/code/modules/maps/tether/levels/tether_turfs.dm b/code/modules/maps/tether/levels/tether_turfs.dm index b5a908e553e..9069ac33d2f 100644 --- a/code/modules/maps/tether/levels/tether_turfs.dm +++ b/code/modules/maps/tether/levels/tether_turfs.dm @@ -44,10 +44,7 @@ VIRGO3B_TURF_CREATE(/turf/simulated/floor/outdoors/rocks) VIRGO3B_TURF_CREATE(/turf/simulated/floor/outdoors/grass/sif) /turf/simulated/floor/outdoors/grass/sif - turf_layers = list( - /turf/simulated/floor/outdoors/rocks/virgo3b, - /turf/simulated/floor/outdoors/dirt/virgo3b - ) + baseturfs = /turf/simulated/floor/outdoors/dirt/virgo3b // Overriding these for the sake of submaps that use them on other planets. // This means that mining on tether base and space is oxygen-generating, but solars and mining should use the virgo3b subtype diff --git a/code/modules/maps/tether/levels/virgo2.dm b/code/modules/maps/tether/levels/virgo2.dm index ee9f88d6136..b9b7034e444 100644 --- a/code/modules/maps/tether/levels/virgo2.dm +++ b/code/modules/maps/tether/levels/virgo2.dm @@ -157,14 +157,12 @@ VIRGO2_TURF_CREATE(/turf/simulated/mineral/floor/ignore_mapgen) /area/tether_away/aerostat name = "\improper Away Mission - Aerostat Outside" icon_state = "away" - base_turf = /turf/unsimulated/floor/sky/virgo2_sky requires_power = FALSE dynamic_lighting = FALSE /area/tether_away/aerostat/inside name = "\improper Away Mission - Aerostat Inside" icon_state = "crew_quarters" - base_turf = /turf/simulated/floor/plating/virgo2 requires_power = TRUE dynamic_lighting = TRUE forced_ambience = list('sound/ambience/tension/tension.ogg', 'sound/ambience/tension/argitoth.ogg', 'sound/ambience/tension/burning_terror.ogg') @@ -172,13 +170,11 @@ VIRGO2_TURF_CREATE(/turf/simulated/mineral/floor/ignore_mapgen) /area/tether_away/aerostat/solars name = "\improper Away Mission - Aerostat Solars" icon_state = "crew_quarters" - base_turf = /turf/simulated/floor/plating/virgo2 dynamic_lighting = TRUE /area/tether_away/aerostat/surface flags = RAD_SHIELDED ambience = list('sound/ambience/ambimine.ogg', 'sound/ambience/song_game.ogg') - base_turf = /turf/simulated/mineral/floor/ignore_mapgen/virgo2 /area/tether_away/aerostat/surface/explored name = "Away Mission - Aerostat Surface (E)" diff --git a/code/modules/maps/tether/levels/virgo4.dm b/code/modules/maps/tether/levels/virgo4.dm index 8c63797a77b..a2e381112fd 100644 --- a/code/modules/maps/tether/levels/virgo4.dm +++ b/code/modules/maps/tether/levels/virgo4.dm @@ -118,34 +118,28 @@ /area/tether_away/beach name = "\improper Away Mission - Virgo 4 Beach" icon_state = "away" - base_turf = /turf/simulated/floor/outdoors/beach/sand //This is what the ground turns into if destroyed/bombed/etc dynamic_lighting = 1 requires_power = 1 /area/tether_away/beach/powershed name = "\improper Away Mission - Virgo 4 Coast PS" icon_state = "blue2" - base_turf = /turf/simulated/floor/outdoors/beach/sand /area/tether_away/beach/coast name = "\improper Away Mission - Virgo 4 Coast" icon_state = "blue2" - base_turf = /turf/simulated/floor/outdoors/beach/coastline /area/tether_away/beach/water name = "\improper Away Mission - Virgo 4 Water" icon_state = "bluenew" - base_turf = /turf/simulated/floor/outdoors/beach/water /area/tether_away/beach/jungle name = "\improper Away Mission - Virgo 4 Desert" icon_state = "green" - base_turf = /turf/simulated/floor/outdoors/beach/sand/desert /area/tether_away/beach/resort icon = 'icons/turf/areas_vr.dmi' icon_state = "yellow" - base_turf = /turf/simulated/floor/outdoors/beach/sand /area/tether_away/beach/resort/kitchen name = "\improper Away Mission - Virgo 4 Kitchen" @@ -186,7 +180,6 @@ /area/tether_away/cave flags = RAD_SHIELDED ambience = list('sound/ambience/ambimine.ogg', 'sound/ambience/song_game.ogg') - base_turf = /turf/simulated/mineral/floor/ignore_mapgen/cave /area/tether_away/cave/explored/normal name = "\improper Away Mission - Virgo 4 Cave (E)" @@ -209,7 +202,6 @@ /area/tether_away/beach/desert/poi name = "\improper Away Mission - Virgo 4 Desert" icon_state = "away" - base_turf = /turf/simulated/floor/outdoors/beach/sand/desert/classh requires_power = 1 /area/tether_away/beach/desert/explored @@ -222,52 +214,39 @@ /area/tether_away/beach/desert/poi/WW_Town name = "V4 - Ghost Town" - base_turf = /turf/simulated/floor/outdoors/beach/sand/desert/classh /area/tether_away/beach/desert/poi/landing_pad name = "V4 - Prefab Homestead" - base_turf = /turf/simulated/floor/outdoors/beach/sand/desert/classh /area/tether_away/beach/desert/poi/solar_farm name = "V4 - Prefab Solar Farm" - base_turf = /turf/simulated/floor/outdoors/beach/sand/desert/classh /area/tether_away/beach/desert/poi/dirt_farm name = "V4 - Abandoned Farmstead" - base_turf = /turf/simulated/floor/outdoors/beach/sand/desert/classh /area/tether_away/beach/desert/poi/graveyard name = "V4 - Desert Graveyard" - base_turf = /turf/simulated/floor/outdoors/beach/sand/desert/classh /area/tether_away/beach/desert/poi/goldmine name = "V4 - Desert Goldmine" - base_turf = /turf/simulated/floor/outdoors/beach/sand/desert/classh /area/tether_away/beach/desert/poi/ranch name = "V4 - Abandoned Ranch" - base_turf = /turf/simulated/floor/outdoors/beach/sand/desert/classh /area/tether_away/beach/desert/poi/saloon name = "V4 - Saloon" - base_turf = /turf/simulated/floor/outdoors/beach/sand/desert/classh /area/tether_away/beach/desert/poi/temple name = "V4 - Old Temple" - base_turf = /turf/simulated/floor/outdoors/beach/sand/desert/classh /area/tether_away/beach/desert/poi/tomb name = "V4 - Old Tomb" - base_turf = /turf/simulated/floor/outdoors/beach/sand/desert/classh /area/tether_away/beach/desert/poi/AuxiliaryResearchFacility name = "V4 - Research Facility" - base_turf = /turf/simulated/floor/outdoors/beach/sand/desert/classh /area/tether_away/beach/desert/poi/vault name = "V4 - Desert Bunker" - base_turf = /turf/simulated/floor/outdoors/beach/sand/desert/classh /area/tether_away/beach/desert/poi/covert_post name = "V4 - Clown Listening Post" - base_turf = /turf/simulated/floor/outdoors/beach/sand/desert/classh diff --git a/code/modules/maps/tether/submaps/virgo2_areas.dm b/code/modules/maps/tether/submaps/virgo2_areas.dm index dd79be26382..0e48e7c2e64 100644 --- a/code/modules/maps/tether/submaps/virgo2_areas.dm +++ b/code/modules/maps/tether/submaps/virgo2_areas.dm @@ -2,7 +2,6 @@ name = "Submap Area" icon_state = "submap" dynamic_lighting = FALSE - base_turf = /turf/simulated/mineral/floor/ignore_mapgen/virgo2 /area/submap/virgo2/spider1 name = "POI - spider nest" diff --git a/code/modules/maps/triumph/levels/classd.dm b/code/modules/maps/triumph/levels/classd.dm index 27a2fa24e1c..60b3bedd73f 100644 --- a/code/modules/maps/triumph/levels/classd.dm +++ b/code/modules/maps/triumph/levels/classd.dm @@ -137,7 +137,7 @@ CLASSD_TURF_CREATE(/turf/simulated/floor/outdoors/rocks) color = "#eaa17c" base_icon_state = "asteroid" initial_gas_mix = ATMOSPHERE_ID_CLASSD - turf_layers = list(/turf/simulated/mineral/floor/classd) + baseturfs = /turf/simulated/mineral/floor/classd initial_flooring = /decl/flooring/outdoors/classd ///Indoor usage turfs with Class D's Atmos. Unaffected by weather etc (Important because radioactive fallout will happen on a regular basis!) diff --git a/code/modules/mining/mine_turfs.dm b/code/modules/mining/mine_turfs.dm index f2fffbd330a..184ede71bda 100644 --- a/code/modules/mining/mine_turfs.dm +++ b/code/modules/mining/mine_turfs.dm @@ -93,9 +93,6 @@ turf/simulated/mineral/floor/light_corner SSplanets.addTurf(src) update_general() -/turf/simulated/mineral/proc/make_floor_lavaland() // so when a turf is mined in lavaland, it places the correct one - src.ChangeTurf(get_base_turf_by_area(src)) - /turf/simulated/mineral/proc/make_wall() if(density && opacity) return @@ -640,11 +637,7 @@ turf/simulated/mineral/floor/light_corner visible_message("An old dusty crate was buried within!") new /obj/structure/closet/crate/secure/loot(src) - var/the_z = get_z(src) - if(the_z == 20) - src.make_floor_lavaland() - else - make_floor() + make_floor() update_icon(1) /turf/simulated/mineral/proc/excavate_find(var/is_clean = 0, var/datum/find/F) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index c0786d42eb1..0ba58ad713d 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -1,7 +1,5 @@ /mob/living/Initialize(mapload) . = ..() - //Prime this list if we need it. - prepare_huds() //I'll just hang my coat up over here dsoverlay = image('icons/mob/darksight.dmi', GLOB.global_hud.darksight) //This is a secret overlay! Go look at the file, you'll see. diff --git a/code/modules/multiz/turf.dm b/code/modules/multiz/turf.dm index a2dfa9c6384..52936b0df4a 100644 --- a/code/modules/multiz/turf.dm +++ b/code/modules/multiz/turf.dm @@ -19,6 +19,19 @@ /turf/proc/multiz_turf_new(turf/T, dir) SEND_SIGNAL(src, COMSIG_TURF_MULTIZ_NEW, T, dir) +/** + * called during AfterChange() to request the turfs above and below us update their graphics. + */ +/turf/proc/update_vertical_turf_graphics() + var/turf/simulated/open/above = GetAbove(src) + if(istype(above)) + above.update_icon() + + var/turf/simulated/below = GetBelow(src) + if(istype(below)) + below.update_icon() // To add or remove the 'ceiling-less' overlay. + + // // Open Space - "empty" turf that lets stuff fall thru it to the layer below // @@ -36,10 +49,6 @@ var/turf/below -/turf/simulated/open/post_change() - ..() - update() - /turf/simulated/open/Initialize(mapload) . = ..() ASSERT(HasBelow(z)) @@ -59,8 +68,6 @@ /turf/simulated/open/proc/update() plane = OPENSPACE_PLANE + src.z below = GetBelow(src) - GLOB.turf_changed_event.register(below, src, /atom/proc/update_icon) - levelupdate() below.update_icon() // So the 'ceiling-less' overlay gets added. for(var/atom/movable/A in src) if(A.movement_type & GROUND) diff --git a/code/modules/overmap/champagne.dm b/code/modules/overmap/champagne.dm index 87fe2657c9f..44c7f6f132a 100644 --- a/code/modules/overmap/champagne.dm +++ b/code/modules/overmap/champagne.dm @@ -70,7 +70,7 @@ // WARNING - We can't figure out a good base_area or base_turf from inspecttion, as the shuttle is already built! // For now its going to just do world.area and z level base turf. Beware! var/area/base_area = world.area - var/base_turf = get_base_turf(get_z(start_loc)) + var/base_turf = GLOB.using_map.base_turf_by_z[get_z(start_loc)] || /turf/simulated/floor/plating var/obj/effect/shuttle_landmark/automatic/champagne/starting_landmark = new(start_loc, base_area, base_turf) // Okay first things first create the shuttle Override to no areas to prevent runtimes, then add them in. diff --git a/code/modules/overmap/turfs.dm b/code/modules/overmap/turfs.dm index 23a67764da9..3c70e20248b 100644 --- a/code/modules/overmap/turfs.dm +++ b/code/modules/overmap/turfs.dm @@ -6,7 +6,6 @@ var/global/list/map_sectors = list() icon_state = "start" requires_power = 0 dynamic_lighting = DYNAMIC_LIGHTING_FORCED - base_turf = /turf/unsimulated/map /turf/unsimulated/map icon = 'icons/turf/space.dmi' @@ -77,7 +76,6 @@ var/global/list/map_sectors = list() if(x == GLOB.using_map.overmap_size) I.pixel_x = 5*i + 2 add_overlay(I) - AddElement(/datum/element/turf_z_transparency) /turf/unsimulated/map/Entered(var/atom/movable/O, var/atom/oldloc) ..() diff --git a/code/modules/power/singularity/act.dm b/code/modules/power/singularity/act.dm index 8a0cd8f521e..260317ea97b 100644 --- a/code/modules/power/singularity/act.dm +++ b/code/modules/power/singularity/act.dm @@ -104,13 +104,7 @@ return 1000 /turf/singularity_act(S, current_size) - if(!is_plating()) - for(var/obj/O in contents) - if(O.level != 1) - continue - if(O.invisibility == 101) - O.singularity_act(src, current_size) - ChangeTurf(get_base_turf_by_area(src)) + ScrapeAway() return 2 /turf/simulated/floor/singularity_pull(S, current_size) diff --git a/code/modules/random_map/automata/caves.dm b/code/modules/random_map/automata/caves.dm index 30b0033feb5..6366928e8cb 100644 --- a/code/modules/random_map/automata/caves.dm +++ b/code/modules/random_map/automata/caves.dm @@ -49,10 +49,7 @@ var/turf/simulated/mineral/T = locate((origin_x-1)+x,(origin_y-1)+y,origin_z) if(istype(T) && !T.ignore_mapgen && !T.ignore_cavegen) //VOREStation Edit: ignore cavegen if(map[current_cell] == FLOOR_CHAR) - if(origin_z == 20) // lavaland specific Z level - T.make_floor_lavaland() - else - T.make_floor() //VOREStation Edit - Don't make cracked sand on surface map, jerk. + T.make_floor() //VOREStation Edit - Don't make cracked sand on surface map, jerk. //if(prob(90)) //T.make_floor() //else diff --git a/code/modules/shuttles/landmarks.dm b/code/modules/shuttles/landmarks.dm index 05e15438647..f75c11ac8b2 100644 --- a/code/modules/shuttles/landmarks.dm +++ b/code/modules/shuttles/landmarks.dm @@ -146,8 +146,7 @@ ..() for(var/turf/T in range(radius, src)) if(T.density) - T.ChangeTurf(get_base_turf_by_area(T)) - + T.ScrapeAway(flags = CHANGETURF_INHERIT_AIR) // Subtype that also queues a shuttle datum (for shuttles starting on maps loaded at runtime) /obj/effect/shuttle_landmark/shuttle_initializer diff --git a/code/modules/shuttles/shuttle.dm b/code/modules/shuttles/shuttle.dm index 2eb8be52d4d..f4e6a389f5a 100644 --- a/code/modules/shuttles/shuttle.dm +++ b/code/modules/shuttles/shuttle.dm @@ -14,7 +14,7 @@ var/category = /datum/shuttle var/multiz = 0 // How many multiz levels, starts at 0 TODO Leshana - Are we porting this? - var/ceiling_type // Type path of turf to roof over the shuttle when at multi-z landmarks. Ignored if null. + var/ceiling_type = /turf/simulated/shuttle_ceiling // Type path of turf to roof over the shuttle when at multi-z landmarks. Ignored if null. var/sound_takeoff = 'sound/effects/shuttles/shuttle_takeoff.ogg' var/sound_landing = 'sound/effects/shuttles/shuttle_landing.ogg' @@ -40,11 +40,25 @@ var/list/areas = list() if(!islist(shuttle_area)) shuttle_area = list(shuttle_area) - for(var/T in shuttle_area) - var/area/A = locate(T) + for(var/path in shuttle_area) + var/area/A = locate(path) if(!istype(A)) - CRASH("Shuttle \"[name]\" couldn't locate area [T].") + CRASH("Shuttle \"[name]\" couldn't locate area [path].") areas += A + // todo: less shit shuttle system + for(var/turf/T in A.contents) + // inject ceiling + if(ceiling_type) + var/turf/above = GetAbove(T) + if(above && !(above.loc in shuttle_area)) + above.PlaceBelowLogicalBottom(ceiling_type) + // inject floor + // but only if we are.. floor + if(GLOB.multiz_hole_baseturfs[T.type]) + // don't bother + continue + T.PlaceBelowLogicalTop(/turf/simulated/floor/plating, CHANGETURF_INHERIT_AIR) + shuttle_area = areas if(initial_location) @@ -314,8 +328,7 @@ if(ceiling_type && HasAbove(current_location.z)) for(var/turf/TO in A.contents) var/turf/TA = GetAbove(TO) - if(istype(TA, ceiling_type)) - TA.ChangeTurf(get_base_turf_by_area(TA), 1, 1) + TA.ScrapeFromLogicalBottom(CHANGETURF_INHERIT_AIR | CHANGETURF_PRESERVE_OUTDOORS, ceiling_type) if(knockdown) for(var/mob/living/M in A) spawn(0) @@ -347,10 +360,9 @@ for(var/area/A in shuttle_area) for(var/turf/TD in A.contents) var/turf/TA = GetAbove(TD) - if(istype(TA, get_base_turf_by_area(TA)) || isopenturf(TA)) - if(get_area(TA) in shuttle_area) - continue - TA.ChangeTurf(ceiling_type, TRUE, TRUE, TRUE) + if(TA.loc in shuttle_area) + continue + TA.PlaceBelowLogicalBottom(ceiling_type, CHANGETURF_INHERIT_AIR | CHANGETURF_PRESERVE_OUTDOORS) // Power-related checks. If shuttle contains power related machinery, update powernets. // Note: Old way was to rebuild ALL powernets: if(powernets.len) SSmachines.makepowernets() diff --git a/code/modules/turbolift/turbolift_map.dm b/code/modules/turbolift/turbolift_map.dm index e6dd78ae397..479d5a776ea 100644 --- a/code/modules/turbolift/turbolift_map.dm +++ b/code/modules/turbolift/turbolift_map.dm @@ -143,8 +143,11 @@ else swap_to = floor_type + if(checking.type != swap_to) checking.ChangeTurf(swap_to) + // /tg/ baseturfs - IMPORTANT - inject plating beneath + checking.PlaceBelowLogicalTop(/turf/simulated/floor/plating) // Let's make absolutely sure that we have the right turf. checking = locate(tx,ty,cz) diff --git a/code/modules/unit_tests/chain_pull_through_space.dm b/code/modules/unit_tests/chain_pull_through_space.dm index ffdd1bf7c90..0d86db2a5be 100644 --- a/code/modules/unit_tests/chain_pull_through_space.dm +++ b/code/modules/unit_tests/chain_pull_through_space.dm @@ -1,5 +1,5 @@ /datum/unit_test/chain_pull_through_space - var/turf/open/space/space_tile + var/turf/space/space_tile var/turf/claimed_tile var/mob/living/carbon/human/alice var/mob/living/carbon/human/bob diff --git a/code/world.dm b/code/world.dm index 74e59020bc0..f1516d05d7c 100644 --- a/code/world.dm +++ b/code/world.dm @@ -3,7 +3,7 @@ //Try looking in game/world.dm /world mob = /mob/new_player - turf = /turf/space + turf = /turf/space/basic area = /area/space view = "15x15" cache_lifespan = 7 diff --git a/icons/turf/debug.dmi b/icons/turf/debug.dmi new file mode 100644 index 0000000000000000000000000000000000000000..bcee5de8321a8a5ced71cbf5e0a2f748bfc66635 GIT binary patch literal 207 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnL3?x0byx0z;*aCb)T+cB4H)de4PPMWCilkJ9 zM3lIs7AF^F7L;V>=P@u;%n1%FC@TH_CAi?@*C$%ux?1PXoDbd*YH-o`!6TjXKAI;P zih6o?SQrNxUpDqqnDc1Tkx3y6!JeJn#;TiFNSrWv^2kTq>x^&fhN+@4e`5})F)_^A zF2P;9y3rYEpNOZ6V+hC0Rd literal 0 HcmV?d00001 diff --git a/maps/nsv_triumph/submaps/_triumph_submaps.dm b/maps/nsv_triumph/submaps/_triumph_submaps.dm index 88a24cd1579..0d21f56f3e6 100644 --- a/maps/nsv_triumph/submaps/_triumph_submaps.dm +++ b/maps/nsv_triumph/submaps/_triumph_submaps.dm @@ -61,6 +61,7 @@ /datum/map_z_level/triumph_lateload/away_piratebase name = "Away Mission - Pirate Base" z = Z_LEVEL_PIRATEBASE + base_turf = /turf/space // lavaland start #include "lavaland/_lavaland.dm" @@ -74,6 +75,7 @@ /datum/map_z_level/triumph_lateload/lavaland name = "Away Mission - Lava Land" z = Z_LEVEL_LAVALAND + base_turf = /turf/simulated/mineral/floor/lavaland /datum/map_template/triumph_lateload/lavaland/on_map_loaded(z) . = ..() @@ -134,6 +136,7 @@ /datum/map_z_level/triumph_lateload/away_g_world name = "Away Mission - Mining Planet" z = Z_LEVEL_MININGPLANET + base_turf = /turf/simulated/mineral/floor/classg /datum/map_template/triumph_lateload/away_g_world/on_map_loaded(z) . = ..() @@ -158,6 +161,7 @@ /datum/map_z_level/triumph_lateload/away_d_world name = "Away Mission - Rogue Planet" z = Z_LEVEL_UNKNOWN_PLANET + base_turf = /turf/simulated/floor/outdoors/rocks/classd // Class H Desert Planet Exploration Zone. /datum/map_template/triumph_lateload/away_h_world @@ -177,6 +181,7 @@ /datum/map_z_level/triumph_lateload/away_h_world name = "Away Mission - Desert Planet" z = Z_LEVEL_DESERT_PLANET + base_turf = /turf/simulated/floor/outdoors/beach/sand/desert/classh // Gaia Planet Zone. /datum/map_template/triumph_lateload/away_m_world @@ -196,6 +201,7 @@ /datum/map_z_level/triumph_lateload/away_m_world name = "Away Mission - Gaia Planet" z = Z_LEVEL_GAIA_PLANET + base_turf = /turf/simulated/floor/outdoors/grass/forest // Frozen Planet Zone. /datum/map_template/triumph_lateload/away_p_world @@ -213,6 +219,7 @@ /datum/map_z_level/triumph_lateload/away_p_world name = "Away Mission - Frozen Planet" z = Z_LEVEL_FROZEN_PLANET + base_turf = /turf/simulated/floor/outdoors/snow/classp // Trade post #include "space/trade_port/_tradeport.dm" @@ -227,6 +234,7 @@ /datum/map_z_level/triumph_lateload/away_tradeport name = "Away Mission - Trade Port" z = Z_LEVEL_TRADEPORT + base_turf = /turf/space ////////////////////////////////////////////////////////////////////////////////////// // Code Shenanigans for Triumph lateload maps diff --git a/maps/nsv_triumph/submaps/lavaland/_lavaland.dm b/maps/nsv_triumph/submaps/lavaland/_lavaland.dm index ac12234cf00..63eb68efd71 100644 --- a/maps/nsv_triumph/submaps/lavaland/_lavaland.dm +++ b/maps/nsv_triumph/submaps/lavaland/_lavaland.dm @@ -97,7 +97,7 @@ icon_state = "asteroid" outdoors = 1 base_icon_state = "asteroid" - turf_layers = list(/turf/simulated/mineral/floor/lavaland) + baseturfs = /turf/simulated/mineral/floor/lavaland initial_flooring = /decl/flooring/outdoors/lavaland /turf/simulated/floor/tiled/steel_dirty/lavaland/exterior diff --git a/maps/nsv_triumph/triumph_turfs.dm b/maps/nsv_triumph/triumph_turfs.dm index 4ca2e42d368..4f5f6f6f1e8 100644 --- a/maps/nsv_triumph/triumph_turfs.dm +++ b/maps/nsv_triumph/triumph_turfs.dm @@ -12,10 +12,7 @@ allow_gas_overlays = FALSE /turf/simulated/floor/outdoors/grass/sif - turf_layers = list( - /turf/simulated/floor/outdoors/rocks, - /turf/simulated/floor/outdoors/dirt - ) + baseturfs = /turf/simulated/floor/outdoors/dirt // Overriding these for the sake of submaps that use them on other planets. // This means that mining on tether base and space is oxygen-generating, but solars and mining should use the triumph subtype diff --git a/maps/tether/tether_defines.dm b/maps/tether/tether_defines.dm index 75c5c0e4695..8828c651b22 100644 --- a/maps/tether/tether_defines.dm +++ b/maps/tether/tether_defines.dm @@ -402,6 +402,9 @@ Allignment: Neutral to NanoTrasen. No Discount for services expected."} #define TETHER_HOLOMAP_MARGIN_Y ((HOLOMAP_ICON_SIZE - (3*TETHER_MAP_SIZE)) / 2) // 30 // We have a bunch of stuff common to the station z levels +/datum/map_z_level/tether + base_turf = /turf/simulated/floor/outdoors/rocks/virgo3b + /datum/map_z_level/tether/station flags = MAP_LEVEL_STATION|MAP_LEVEL_CONTACT|MAP_LEVEL_PLAYER|MAP_LEVEL_CONSOLES|MAP_LEVEL_XENOARCH_EXEMPT holomap_legend_x = 220 diff --git a/maps/~map_system/maps.dm b/maps/~map_system/maps.dm index a70050e858e..3e392aace95 100644 --- a/maps/~map_system/maps.dm +++ b/maps/~map_system/maps.dm @@ -261,7 +261,7 @@ var/list/all_maps = list() var/z = 0 // Actual z-index of the zlevel. This had better be right! var/name // Friendly name of the zlevel var/flags = 0 // Bitflag of which *_levels lists this z should be put into. - var/turf/base_turf // Type path of the base turf for this z + var/turf/base_turf = /turf/space // Type path of the base turf for this z var/transit_chance = 0 // Percentile chance this z will be chosen for map-edge space transit. // Holomaps diff --git a/vorestation.dme b/vorestation.dme index eaa755981b1..cdabd470c05 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -158,6 +158,7 @@ #include "code\__DEFINES\research\integrated_circuits.dm" #include "code\__DEFINES\research\research.dm" #include "code\__DEFINES\research\xenoarcheaology.dm" +#include "code\__DEFINES\turfs\change_turf.dm" #include "code\__DEFINES\turfs\turfmakers.dm" #include "code\__HELPERS\_core.dm" #include "code\__HELPERS\_global_objects.dm" @@ -190,7 +191,7 @@ #include "code\__HELPERS\vector.dm" #include "code\__HELPERS\view.dm" #include "code\__HELPERS\lists\associations.dm" -#include "code\__HELPERS\lists\bitflags.dm" +#include "code\__HELPERS\lists\bitflag_lists.dm" #include "code\__HELPERS\lists\copy.dm" #include "code\__HELPERS\lists\counter.dm" #include "code\__HELPERS\lists\json.dm" @@ -199,6 +200,7 @@ #include "code\__HELPERS\lists\queue.dm" #include "code\__HELPERS\lists\shuffle.dm" #include "code\__HELPERS\lists\string.dm" +#include "code\__HELPERS\lists\string_lists.dm" #include "code\__HELPERS\lists\traverse.dm" #include "code\__HELPERS\lists\types_typecaches.dm" #include "code\__HELPERS\lists\unique.dm" @@ -211,6 +213,7 @@ #include "code\__HELPERS\sorts\TimSort.dm" #include "code\__HELPERS\text\scramble.dm" #include "code\__HELPERS\type2type\color.dm" +#include "code\__HELPERS\unsorted\contents.dm" #include "code\__HELPERS\vfx\shake_camera.dm" #include "code\_globals\regexes.dm" #include "code\_globalvars\bitfields.dm" @@ -420,7 +423,6 @@ #include "code\datums\elements\conflict_checking.dm" #include "code\datums\elements\icon_scaling.dm" #include "code\datums\elements\persistence.dm" -#include "code\datums\elements\turf_transparency.dm" #include "code\datums\elements\clothing\_clothing.dm" #include "code\datums\elements\clothing\hud_granter.dm" #include "code\datums\helper_datums\construction_datum.dm" @@ -448,7 +450,6 @@ #include "code\datums\observation\shuttle_added.dm" #include "code\datums\observation\shuttle_moved.dm" #include "code\datums\observation\stat_set.dm" -#include "code\datums\observation\turf_changed.dm" #include "code\datums\observation\~cleanup.dm" #include "code\datums\outfits\_defines.dm" #include "code\datums\outfits\horror_killers.dm" @@ -534,7 +535,6 @@ #include "code\game\atoms_movable.dm" #include "code\game\atoms_movable_movement.dm" #include "code\game\atoms_movable_pulling.dm" -#include "code\game\base_turf.dm" #include "code\game\periodic_news.dm" #include "code\game\response_team.dm" #include "code\game\shuttle_engines.dm" @@ -577,7 +577,7 @@ #include "code\game\antagonist\station\thug.dm" #include "code\game\antagonist\station\traitor.dm" #include "code\game\area\ai_monitored.dm" -#include "code\game\area\areas.dm" +#include "code\game\area\area.dm" #include "code\game\area\areas_movement.dm" #include "code\game\area\asteroid_areas.dm" #include "code\game\area\Away Mission areas.dm" @@ -1449,10 +1449,10 @@ #include "code\game\objects\structures\stool_bed_chair_nest\chairs_vr.dm" #include "code\game\objects\structures\stool_bed_chair_nest\stools.dm" #include "code\game\objects\structures\stool_bed_chair_nest\wheelchair.dm" +#include "code\game\turfs\baseturfs.dm" #include "code\game\turfs\change_turf.dm" #include "code\game\turfs\simulated.dm" #include "code\game\turfs\turf.dm" -#include "code\game\turfs\turf_changing.dm" #include "code\game\turfs\turf_flick_animations.dm" #include "code\game\turfs\turf_movement.dm" #include "code\game\turfs\unsimulated.dm" @@ -2406,6 +2406,7 @@ #include "code\modules\mapping\shuttle.dm" #include "code\modules\mapping\submap.dm" #include "code\modules\mapping\map_helpers\_map_helpers.dm" +#include "code\modules\mapping\map_helpers\baseturf.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\space_management\multiz_helpers.dm" @@ -2440,7 +2441,6 @@ #include "code\modules\maps\generic\shuttles\vespa.dm" #include "code\modules\maps\generic\submaps\mountains\mountains.dm" #include "code\modules\maps\generic\submaps\mountains\mountains_areas.dm" -#include "code\modules\maps\generic\submaps\mountains\mountains_areas_vr.dm" #include "code\modules\maps\generic\submaps\plains\plains.dm" #include "code\modules\maps\generic\submaps\plains\plains_areas.dm" #include "code\modules\maps\generic\submaps\wilderness\wilderness.dm"