Merge pull request #10238 from Ghommie/Ghommie-cit478
Brings in some mapping code updates.
This commit is contained in:
@@ -35,6 +35,9 @@ GLOBAL_LIST_INIT(admin_verbs_debug_mapping, list(
|
||||
/client/proc/cmd_admin_grantfullaccess,
|
||||
/client/proc/cmd_admin_areatest_all,
|
||||
/client/proc/cmd_admin_areatest_station,
|
||||
#ifdef TESTING
|
||||
/client/proc/see_dirty_varedits,
|
||||
#endif
|
||||
/client/proc/cmd_admin_test_atmos_controllers,
|
||||
/client/proc/cmd_admin_rejuvenate,
|
||||
/datum/admins/proc/show_traitor_panel,
|
||||
@@ -84,8 +87,24 @@ GLOBAL_PROTECT(admin_verbs_debug_mapping)
|
||||
SSblackbox.record_feedback("tally", "admin_verb", 1, "Show Camera Range") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
SSblackbox.record_feedback("tally", "admin_verb", 1, "Show Camera Range")
|
||||
|
||||
#ifdef TESTING
|
||||
GLOBAL_LIST_EMPTY(dirty_vars)
|
||||
|
||||
|
||||
/client/proc/see_dirty_varedits()
|
||||
set category = "Mapping"
|
||||
set name = "Dirty Varedits"
|
||||
|
||||
var/list/dat = list()
|
||||
dat += "<h3>Abandon all hope ye who enter here</h3><br><br>"
|
||||
for(var/thing in GLOB.dirty_vars)
|
||||
dat += "[thing]<br>"
|
||||
CHECK_TICK
|
||||
var/datum/browser/popup = new(usr, "dirty_vars", "Dirty Varedits", 900, 750)
|
||||
popup.set_content(dat.Join())
|
||||
popup.open()
|
||||
#endif
|
||||
|
||||
/client/proc/sec_camera_report()
|
||||
set category = "Mapping"
|
||||
set name = "Camera Report"
|
||||
|
||||
@@ -57,10 +57,10 @@
|
||||
if(item.parent)
|
||||
var/static/pipenetwarnings = 10
|
||||
if(pipenetwarnings > 0)
|
||||
warning("build_pipeline(): [item.type] added to a pipenet while still having one. (pipes leading to the same spot stacking in one turf) Nearby: ([item.x], [item.y], [item.z])")
|
||||
log_mapping("build_pipeline(): [item.type] added to a pipenet while still having one. (pipes leading to the same spot stacking in one turf) Nearby: ([item.x], [item.y], [item.z]).")
|
||||
pipenetwarnings -= 1
|
||||
if(pipenetwarnings == 0)
|
||||
warning("build_pipeline(): further messages about pipenets will be suppressed")
|
||||
log_mapping("build_pipeline(): further messages about pipenets will be suppressed")
|
||||
members += item
|
||||
possible_expansions += item
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
pixel_y = (new_layer - PIPING_LAYER_DEFAULT) * PIPING_LAYER_P_Y
|
||||
|
||||
/obj/machinery/meter/process_atmos()
|
||||
if(!target)
|
||||
if(!(target?.flags_1 & INITIALIZED_1))
|
||||
icon_state = "meterX"
|
||||
return 0
|
||||
|
||||
|
||||
@@ -59,9 +59,7 @@
|
||||
return
|
||||
var/area/AS = get_area(src)
|
||||
if(istype(AS, /area/holodeck))
|
||||
log_world("### MAPPING ERROR")
|
||||
log_world("Holodeck computer cannot be in a holodeck.")
|
||||
log_world("This would cause circular power dependency.")
|
||||
log_mapping("Holodeck computer cannot be in a holodeck, This would cause circular power dependency.")
|
||||
qdel(src)
|
||||
return
|
||||
else
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
//initialize things that are normally initialized after map load
|
||||
parsed.initTemplateBounds()
|
||||
smooth_zlevel(world.maxz)
|
||||
log_game("Z-level [name] loaded at at [x],[y],[world.maxz]")
|
||||
log_game("Z-level [name] loaded at [x],[y],[world.maxz]")
|
||||
|
||||
return level
|
||||
|
||||
@@ -84,6 +84,13 @@
|
||||
if(T.y+height > world.maxy)
|
||||
return
|
||||
|
||||
var/list/border = block(locate(max(T.x-1, 1), max(T.y-1, 1), T.z),
|
||||
locate(min(T.x+width+1, world.maxx), min(T.y+height+1, world.maxy), T.z))
|
||||
for(var/L in border)
|
||||
var/turf/turf_to_disable = L
|
||||
SSair.remove_from_active(turf_to_disable) //stop processing turfs along the border to prevent runtimes, we return it in initTemplateBounds()
|
||||
turf_to_disable.atmos_adjacent_turfs?.Cut()
|
||||
|
||||
// Accept cached maps, but don't save them automatically - we don't want
|
||||
// ruins clogging up memory for the whole round.
|
||||
var/datum/parsed_map/parsed = cached_map || new(file(mappath))
|
||||
@@ -100,7 +107,7 @@
|
||||
//initialize things that are normally initialized after map load
|
||||
parsed.initTemplateBounds()
|
||||
|
||||
log_game("[name] loaded at at [T.x],[T.y],[T.z]")
|
||||
log_game("[name] loaded at [T.x],[T.y],[T.z]")
|
||||
return bounds
|
||||
|
||||
/datum/map_template/proc/get_affected_turfs(turf/T, centered = FALSE)
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
/obj/effect/baseturf_helper/LateInitialize()
|
||||
if(!baseturf_to_replace)
|
||||
baseturf_to_replace = typecacheof(/turf/open/space)
|
||||
baseturf_to_replace = typecacheof(list(/turf/open/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
|
||||
@@ -45,7 +45,6 @@
|
||||
thing.PlaceOnBottom(null, baseturf)
|
||||
else if(baseturf_to_replace[thing.baseturfs])
|
||||
thing.assemble_baseturfs(baseturf)
|
||||
return
|
||||
else
|
||||
thing.PlaceOnBottom(null, baseturf)
|
||||
|
||||
@@ -107,16 +106,16 @@
|
||||
/obj/effect/mapping_helpers/airlock/cyclelink_helper/Initialize(mapload)
|
||||
. = ..()
|
||||
if(!mapload)
|
||||
log_world("### MAP WARNING, [src] spawned outside of mapload!")
|
||||
log_mapping("[src] spawned outside of mapload!")
|
||||
return
|
||||
var/obj/machinery/door/airlock/airlock = locate(/obj/machinery/door/airlock) in loc
|
||||
if(airlock)
|
||||
if(airlock.cyclelinkeddir)
|
||||
log_world("### MAP WARNING, [src] at [AREACOORD(src)] tried to set [airlock] cyclelinkeddir, but it's already set!")
|
||||
log_mapping("[src] at [AREACOORD(src)] tried to set [airlock] cyclelinkeddir, but it's already set!")
|
||||
else
|
||||
airlock.cyclelinkeddir = dir
|
||||
else
|
||||
log_world("### MAP WARNING, [src] failed to find an airlock at [AREACOORD(src)]")
|
||||
log_mapping("[src] failed to find an airlock at [AREACOORD(src)]")
|
||||
|
||||
|
||||
/obj/effect/mapping_helpers/airlock/locked
|
||||
@@ -126,16 +125,16 @@
|
||||
/obj/effect/mapping_helpers/airlock/locked/Initialize(mapload)
|
||||
. = ..()
|
||||
if(!mapload)
|
||||
log_world("### MAP WARNING, [src] spawned outside of mapload!")
|
||||
log_mapping("[src] spawned outside of mapload!")
|
||||
return
|
||||
var/obj/machinery/door/airlock/airlock = locate(/obj/machinery/door/airlock) in loc
|
||||
if(airlock)
|
||||
if(airlock.locked)
|
||||
log_world("### MAP WARNING, [src] at [AREACOORD(src)] tried to bolt [airlock] but it's already locked!")
|
||||
log_mapping("[src] at [AREACOORD(src)] tried to bolt [airlock] but it's already locked!")
|
||||
else
|
||||
airlock.locked = TRUE
|
||||
else
|
||||
log_world("### MAP WARNING, [src] failed to find an airlock at [AREACOORD(src)]")
|
||||
log_mapping("[src] failed to find an airlock at [AREACOORD(src)]")
|
||||
|
||||
/obj/effect/mapping_helpers/airlock/unres
|
||||
name = "airlock unresctricted side helper"
|
||||
@@ -144,13 +143,13 @@
|
||||
/obj/effect/mapping_helpers/airlock/unres/Initialize(mapload)
|
||||
. = ..()
|
||||
if(!mapload)
|
||||
log_world("### MAP WARNING, [src] spawned outside of mapload!")
|
||||
log_mapping("[src] spawned outside of mapload!")
|
||||
return
|
||||
var/obj/machinery/door/airlock/airlock = locate(/obj/machinery/door/airlock) in loc
|
||||
if(airlock)
|
||||
airlock.unres_sides ^= dir
|
||||
else
|
||||
log_world("### MAP WARNING, [src] failed to find an airlock at [AREACOORD(src)]")
|
||||
log_mapping("[src] failed to find an airlock at [AREACOORD(src)]")
|
||||
|
||||
|
||||
//needs to do its thing before spawn_rivers() is called
|
||||
@@ -164,17 +163,6 @@ INITIALIZE_IMMEDIATE(/obj/effect/mapping_helpers/no_lava)
|
||||
var/turf/T = get_turf(src)
|
||||
T.flags_1 |= NO_LAVA_GEN_1
|
||||
|
||||
/// Adds the map it is on to the z_is_planet list
|
||||
/obj/effect/mapping_helpers/planet_z
|
||||
name = "planet z helper"
|
||||
layer = POINT_LAYER
|
||||
|
||||
/obj/effect/mapping_helpers/planet_z/Initialize()
|
||||
. = ..()
|
||||
var/datum/space_level/S = SSmapping.get_level(z)
|
||||
S.traits[ZTRAIT_PLANET] = TRUE
|
||||
|
||||
|
||||
//This helper applies components to things on the map directly.
|
||||
/obj/effect/mapping_helpers/component_injector
|
||||
name = "Component Injector"
|
||||
|
||||
@@ -8,18 +8,26 @@ GLOBAL_DATUM_INIT(_preloader, /datum/map_preloader, new)
|
||||
var/list/attributes
|
||||
var/target_path
|
||||
|
||||
/datum/map_preloader/proc/setup(list/the_attributes, path)
|
||||
/world/proc/preloader_setup(list/the_attributes, path)
|
||||
if(the_attributes.len)
|
||||
GLOB.use_preloader = TRUE
|
||||
attributes = the_attributes
|
||||
target_path = path
|
||||
var/datum/map_preloader/preloader_local = GLOB._preloader
|
||||
preloader_local.attributes = the_attributes
|
||||
preloader_local.target_path = path
|
||||
|
||||
/datum/map_preloader/proc/load(atom/what)
|
||||
/world/proc/preloader_load(atom/what)
|
||||
GLOB.use_preloader = FALSE
|
||||
for(var/attribute in attributes)
|
||||
var/value = attributes[attribute]
|
||||
var/datum/map_preloader/preloader_local = GLOB._preloader
|
||||
for(var/attribute in preloader_local.attributes)
|
||||
var/value = preloader_local.attributes[attribute]
|
||||
if(islist(value))
|
||||
value = deepCopyList(value)
|
||||
#ifdef TESTING
|
||||
if(what.vars[attribute] == value)
|
||||
var/message = "<font color=green>[what.type]</font> at [AREACOORD(what)] - <b>VAR:</b> <font color=red>[attribute] = [isnull(value) ? "null" : (isnum(value) ? value : "\"[value]\"")]</font>"
|
||||
log_mapping("DIRTY VAR: [message]")
|
||||
GLOB.dirty_vars += message
|
||||
#endif
|
||||
what.vars[attribute] = value
|
||||
|
||||
/area/template_noop
|
||||
|
||||
@@ -306,8 +306,8 @@
|
||||
//first instance the /area and remove it from the members list
|
||||
index = members.len
|
||||
if(members[index] != /area/template_noop)
|
||||
GLOB._preloader.setup(members_attributes[index])//preloader for assigning set variables on atom creation
|
||||
var/atype = members[index]
|
||||
world.preloader_setup(members_attributes[index], atype)//preloader for assigning set variables on atom creation
|
||||
var/atom/instance = areaCache[atype]
|
||||
if (!instance)
|
||||
instance = GLOB.areas_by_type[atype]
|
||||
@@ -318,7 +318,7 @@
|
||||
instance.contents.Add(crds)
|
||||
|
||||
if(GLOB.use_preloader && instance)
|
||||
GLOB._preloader.load(instance)
|
||||
world.preloader_load(instance)
|
||||
|
||||
//then instance the /turf and, if multiple tiles are presents, simulates the DMM underlays piling effect
|
||||
|
||||
@@ -354,7 +354,7 @@
|
||||
|
||||
//Instance an atom at (x,y,z) and gives it the variables in attributes
|
||||
/datum/parsed_map/proc/instance_atom(path,list/attributes, turf/crds, no_changeturf, placeOnTop)
|
||||
GLOB._preloader.setup(attributes, path)
|
||||
world.preloader_setup(attributes, path)
|
||||
|
||||
if(crds)
|
||||
if(ispath(path, /turf))
|
||||
@@ -368,7 +368,7 @@
|
||||
. = create_atom(path, crds)//first preloader pass
|
||||
|
||||
if(GLOB.use_preloader && .)//second preloader pass, for those atoms that don't ..() in New()
|
||||
GLOB._preloader.load(.)
|
||||
world.preloader_load(.)
|
||||
|
||||
//custom CHECK_TICK here because we don't want things created while we're sleeping to not initialize
|
||||
if(TICK_CHECK)
|
||||
|
||||
@@ -31,7 +31,7 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
|
||||
/obj/machinery/conveyor/inverted/Initialize(mapload)
|
||||
. = ..()
|
||||
if(mapload && !(dir in GLOB.diagonals))
|
||||
log_game("### MAPPING ERROR: [src] at [AREACOORD(src)] spawned without using a diagonal dir. Please replace with a normal version.")
|
||||
log_mapping("[src] at [AREACOORD(src)] spawned without using a diagonal dir. Please replace with a normal version.")
|
||||
|
||||
// Auto conveyour is always on unless unpowered
|
||||
|
||||
|
||||
Reference in New Issue
Block a user