diff --git a/code/_helpers/global_lists_vr.dm b/code/_helpers/global_lists_vr.dm index 22095d0a25f..c6c1e77331a 100644 --- a/code/_helpers/global_lists_vr.dm +++ b/code/_helpers/global_lists_vr.dm @@ -16,7 +16,6 @@ var/global/list/active_ghost_pods = list() //Global vars for making the overmap_renamer subsystem. //Collects all instances by reference of visitable overmap objects of /obj/effect/overmap/visitable like the debris field. var/global/list/visitable_overmap_object_instances = list() -var/global/list/visitable_Z_levels_name_list = list() //Collects map_tempate.name of deffo_load and also_load lateloaded maps from mapping subsystem var/global/list/sensorpreflist = list("Off", "Binary", "Vitals", "Tracking", "No Preference") diff --git a/code/controllers/subsystems/mapping.dm b/code/controllers/subsystems/mapping.dm index 118ad1001b6..76815237221 100644 --- a/code/controllers/subsystems/mapping.dm +++ b/code/controllers/subsystems/mapping.dm @@ -90,7 +90,6 @@ SUBSYSTEM_DEF(mapping) error("Lateload Z level \"[mapname]\" is not a valid map!") continue MT.load_new_z(centered = FALSE) - visitable_Z_levels_name_list |= MT.name //Exists here purely for sake of Debris field at the moment. CHECK_TICK if(LAZYLEN(maybe_load)) @@ -134,7 +133,6 @@ SUBSYSTEM_DEF(mapping) error("Randompick Z level \"[map]\" is not a valid map!") else MT.load_new_z(centered = FALSE) - visitable_Z_levels_name_list |= MT.name /datum/controller/subsystem/mapping/proc/preloadShelterTemplates() diff --git a/code/controllers/subsystems/overmap_renamer_vr.dm b/code/controllers/subsystems/overmap_renamer_vr.dm index 6dec2a5b2cd..28943a83508 100644 --- a/code/controllers/subsystems/overmap_renamer_vr.dm +++ b/code/controllers/subsystems/overmap_renamer_vr.dm @@ -11,8 +11,6 @@ SUBSYSTEM_DEF(overmap_renamer) /datum/controller/subsystem/overmap_renamer/Initialize(timeofday) - if(!visitable_Z_levels_name_list) - return update_names() ..() @@ -20,16 +18,15 @@ SUBSYSTEM_DEF(overmap_renamer) /*Shouldn't be a switch statement. We want ALL of the if(map_template.name in visitable_z_leves_name_list) to fire if we end up with multiple renamable lateload overmap objects.*/ /datum/controller/subsystem/overmap_renamer/proc/update_names() - if(!visitable_Z_levels_name_list || !islist(visitable_Z_levels_name_list) || !length(visitable_Z_levels_name_list)) + if(!visitable_overmap_object_instances || !islist(visitable_overmap_object_instances) || !length(visitable_overmap_object_instances)) return - if("Debris Field - Z1 Space" in visitable_Z_levels_name_list) - for(var/obj/effect/overmap/visitable/D in visitable_overmap_object_instances) - if(D.unique_identifier == "Debris Field") - D.modify_descriptors() - if(D.visitable_renamed) //could just if(D.modify_descriptors()), but having a var recording renaming is useful for debugging and stuff! - if(D.known) - to_world_log("Renamed Debris Field as: [D.name]") - admin_notice("Debris Field name chosen as [D.name]", R_DEBUG) - else - to_world_log("Renamed Debris Field as: [D.real_name]") - admin_notice("Debris Field name chosen as [D.real_name]", R_DEBUG) + for(var/obj/effect/overmap/visitable/V in visitable_overmap_object_instances) + if(V.unique_identifier == "Debris Field") + V.modify_descriptors() + if(V.visitable_renamed) //could just if(D.modify_descriptors()), but having a var recording renaming is useful for debugging and stuff! + if(V.known) + to_world_log("##Overmap Renamer: Renamed Debris Field as: [V.name]") + admin_notice("Debris Field name chosen as [V.name]", R_DEBUG) + else + to_world_log("##Overmap Renamer: Renamed Debris Field as: [V.real_name]") + admin_notice("Debris Field name chosen as [V.real_name]", R_DEBUG) diff --git a/code/modules/awaymissions/overmap_renamer/debrisfield_renamer.dm b/code/modules/awaymissions/overmap_renamer/debrisfield_renamer.dm index 100efec22ff..93d64255322 100644 --- a/code/modules/awaymissions/overmap_renamer/debrisfield_renamer.dm +++ b/code/modules/awaymissions/overmap_renamer/debrisfield_renamer.dm @@ -3,11 +3,19 @@ //Makes it easier to change if found problematic or to simply review /obj/effect/landmark/overmap_renamer/debris_field name = "Debries Field Landmarks" //Please change name to be indicative of which POI for better debugging + var/static/reference //Saves us from having to iterate over all visitable overmap obj instances more than once for the debris field. - +//Uncomment the testing lines when adding a new landmark and wanting to see if it loaded properly during server init. re-comment after done /obj/effect/landmark/overmap_renamer/debris_field/Initialize() ..() - for(var/obj/effect/overmap/visitable/D in visitable_overmap_object_instances) - if(D.unique_identifier == "Debris Field") - if(D.possible_descriptors && islist(D.possible_descriptors)) - D.possible_descriptors |= list(descriptors) + if(!reference) +// testing("First overmap descriptor, name: [name]") + for(var/obj/effect/overmap/visitable/D in visitable_overmap_object_instances) + if(D.unique_identifier == "Debris Field") + if(D.possible_descriptors && islist(D.possible_descriptors)) + D.possible_descriptors |= list(descriptors) + reference = D + else if (reference && istype(reference, /obj/effect/overmap/visitable/)) + var/obj/effect/overmap/visitable/D = reference +// testing("[D] already found, skipping iterating over list. Adding [name] to possible descriptors") + D.possible_descriptors |= list(descriptors) diff --git a/code/modules/awaymissions/overmap_renamer/overmap_renamer.dm b/code/modules/awaymissions/overmap_renamer/overmap_renamer.dm index 5c87da79e14..a92e29a2976 100644 --- a/code/modules/awaymissions/overmap_renamer/overmap_renamer.dm +++ b/code/modules/awaymissions/overmap_renamer/overmap_renamer.dm @@ -12,12 +12,14 @@ possible_descriptors are populated by subtypes of /obj/effect/landmark/overmap_r var/list/chosen_descriptor = pick(possible_descriptors) if(chosen_descriptor == "default") + testing("Defaulting to default!") return //Not an error, won't generate an error message var/breakWhile = 0 while(LAZYLEN(chosen_descriptor) != 3) LAZYREMOVE(chosen_descriptor, possible_descriptors) chosen_descriptor = pick(possible_descriptors) if(chosen_descriptor == "default") +// testing("Defaulting to default!") //Uncomment when adding a new landmark to confirm it works OK, but recomment before commiting return if(breakWhile > 10 || length(possible_descriptors) < 1) error("No valid descriptors could be found for [name]!") //Checking default separately for sake of error messages @@ -41,6 +43,7 @@ possible_descriptors are populated by subtypes of /obj/effect/landmark/overmap_r icon = 'icons/effects/effects.dmi' icon_state = "energynet" var/list/descriptors = list() //Elements: A = name, B = desc C = scanner desc. Each element must be a string +// var/static/reference //exists to avoid having to iterate over the overmap objs list more than once. Commented out here. Add this to subtype /obj/effect/landmark/overmap_renamer/Initialize() // testing("Loading renamer landmark: [name]") //Uncomment when adding a new POI/Landmark for testing aid. diff --git a/code/modules/awaymissions/overmap_renamer/readme.md b/code/modules/awaymissions/overmap_renamer/readme.md index 39536438e23..6927ef394b0 100644 --- a/code/modules/awaymissions/overmap_renamer/readme.md +++ b/code/modules/awaymissions/overmap_renamer/readme.md @@ -7,11 +7,11 @@ How to use - for mappers: There, create a new object as given in the following example: /obj/effect/landmark/overmap_renamer/debris_field/examplelandmark - name = "Debris field example landmark!" + name = "Debris field example landmark that hints at which POI it came from!!!" descriptors = list("This element appears when you hover over the obj in the nav console", "if someone manages to examine it", "This is what the printed paper says") Make sure you use exactly 3 elements, no more and no less and make sure each element is enclosed in a "". - If you want to only change one element, fill in the other ones with the appropriate /obj/effect/overmap/visitable/ subtype your Z level corresponds to (you can find its path in the Initialize() proc for easier finding) + If you want to only change one element, fill in the other ones with the appropriate /obj/effect/overmap/visitable/ subtype's name, desc or scanner_desc your Z level corresponds to. Once done, just load up strongDMM and place your landmark within the map. Please use the _renamer.dm files to define landmarks, don't do it within the game. @@ -30,6 +30,9 @@ How to use - for mappers: Your task will become a bit more difficult now. Create a new .dm file following convention already estabilished with debrisfield_renamer.dm Within this file, define your /obj/effect/landmark/overmap_renamer/newname here + add the following line: + var/static/reference //leave thus null. The initialization will change this to contain reference to your overmap object instance. Saves us from excess looping + name = "obvious reference to the lateloaded Z in question here" Within this file, create a new /obj/effect/landmark/overmap_renamer/newname/Initialize() Within this proc, copy what's done in code\modules\awaymissions\overmap_renamer\debrisfield_renamer.dm except, replace if(D == "Debris Field") with whatever your unique identifier was defined for your specific overmap object @@ -47,32 +50,29 @@ How to use - for mappers: Important procs, vars etc. contained within the following files: -code\_helpers\global_lists_vr.dm - var/list/visitable_overmap_object_instances - Collects instances with reference for things like the Debris Field, Space Whale, Talon etc. We need it to call the proc on the instance - var/list/visitable_Z_levels_name_list - Collects names as defined under the appropriate map_template of the lateloaded Z level. We need this to check if the Z level loaded in within the subsystem + code\_helpers\global_lists_vr.dm + var/list/visitable_overmap_object_instances - Collects instances with reference for things like the Debris Field, Space Whale, Talon etc. We need it to call the proc on the instance -code\modules\overmap\sectors.dm - var/list/possible_descriptors - contains a list of list("name","desc","scanner_desc") - var/unique_identifier - A way to check if the object in question loaded without causing a compiler error. Name them sth easy to recognize, like "Debris field" for... debris field. - var/real_name - Used to handle known = FALSE overmap objects properly - var/real_desc - same as real_name - /obj/effect/overmap/visitable/Initialize() - adds the object's instance with reference to visitable_overmap_object_instances + code\modules\overmap\sectors.dm + var/list/possible_descriptors - contains a list of list("name","desc","scanner_desc") + var/unique_identifier - A way to check if the object in question loaded without causing a compiler error. Name them sth easy to recognize, like "Debris field" for... debris field. + var/real_name - Used to handle known = FALSE overmap objects properly + var/real_desc - same as real_name + /obj/effect/overmap/visitable/Initialize() - adds the object's instance with reference to visitable_overmap_object_instances -code\controllers\subsystems\mapping.dm - /datum/controller/subsystem/mapping/proc/loadLateMaps() - Adds the name of the loaded map_template to visitable_Z_levels_name_list + code\modules\awaymissions\overmap_renamer\overmap_renamer.dm + /obj/effect/overmap/visitable/proc/modify_descriptors() - Takes possible_descriptors from src, picks a valid one after sanitization. Gives warnings if input is invalid. + /obj/effect/landmark/overmap_renamer - generic landmark, don't touch. -code\modules\awaymissions\overmap_renamer\overmap_renamer.dm - /obj/effect/overmap/visitable/proc/modify_descriptors() - Takes possible_descriptors from src, picks a valid one after sanitization. Gives warnings if input is invalid. - /obj/effect/landmark/overmap_renamer - generic landmark, don't touch. + code\modules\awaymissions\overmap_renamer\debrisfield_renamer.dm - Mappers, copy contents, changing the /overmap_renamer/debris_field to /overmap_renamer/yourthingy + var/static/reference - I couldn't find a way to declare this higher up in the path. Make sure to delcare it when making landmarks for a new area. Static so all landmarks have it. This gets defined on runtime after the first landmark subtype initializes. + /obj/effect/landmark/overmap_renamer/debris_field/Initialize() - Copy the entire thing, and change the "Debris Field" to your obj's var/unique_identifier -code\modules\awaymissions\overmap_renamer\debrisfield_renamer.dm - Mappers, copy contents, changing the debris_field to your Z level's name wherever applicable - /obj/effect/landmark/overmap_renamer/debris_field/Initialize() - Change var/obj/effect/overmap/visitable/sector/debrisfield/D to whatever your location's visitable object is when copying. - -code\controllers\subsystems\overmap_renamer_vr.dm - /datum/controller/subsystem/overmap_renamer/proc/update_names() - Checks which Z levels are loaded, modifies them - To add new Z levels to the renamer, simply copy the if statement and its contents for debris field, - taking care to change the "Debris Field - Z1 Space" to the name var defined in your lateloaded Z level's map_template datum - example: maps\offmap_vr\common_offmaps.dm and then the /datum/map_template/common_lateload/away_debrisfield + code\controllers\subsystems\overmap_renamer_vr.dm + /datum/controller/subsystem/overmap_renamer/proc/update_names() - Checks which Z levels are loaded, modifies them + To add new Z levels to the renamer, simply copy the if statement and its contents for debris field, + taking care to change the "Debris Field - Z1 Space" to the name var defined in your lateloaded Z level's map_template datum + example: maps\offmap_vr\common_offmaps.dm and then the /datum/map_template/common_lateload/away_debrisfield */