mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-07 23:42:44 +00:00
* split area.contained_turfs up by zlevel, make init 10 seconds faster (#80941) ## About The Pull Request Situation: areas have a list of all turfs in their area. Problem: `/area/space` is an area and has a 6 to 7 digit count of turfs that has to be traversed for every turf we need to remove from it. This can take multiple byond ticks just to preform this action for a single space rune Solution: split the list by zlevel, and only search the right zlevel list when removing turfs from areas. replaces `area.get_contained_turfs()` with a few new procs: * `get_highest_zlevel()` - returns the highest zlevel the area contains turfs in. useful for use with `get_turfs_by_zlevel` * `get_turfs_by_zlevel(zlevel)` - returns a list of turfs in the area in a given zlevel. Useful for code that only cares about a specific zlevel or changes behavior based on zlevel like lighting init. * `get_turfs_from_all_zlevels()` - the replacement for `get_contained_turfs()`, renamed as such so anybody copying/cargo culting code gets a hint that a zlevel specific version might exist. Still used in for loops that type checked so byond would do that all at once * `get_zlevel_turf_lists()` - returns the area's zlevel lists of lists but only for non-empty zlevels. very useful for for loops. The area contents unit test has been rewritten to ensure any improper data triggers failures or runtimes by not having it use the helpers above (some of which ensure a list is always returned) and access the lists directly. * split area.contained_turfs up by zlevel, make init 10 seconds faster * eeyes * Update area_spawn_subsystem.dm * Unshits turf contain code slightly (#81023) Literally just implements my reviews from #80941 I am frankly a smidge pissed that the pr was merged without them being handled. No code is worth merging past known issues, and if the author is just gonna dip then that's life. I don't like privileging mso on stuff like this, especially because frankly I'm kinda mad at him rn but also because when a pr is made the onus on finishing it falls to the person who made it. Should not need to clean up after someone as a maintainer, and shouldn't normalize doing it. I'm not like mad at zypher directly mind he offered to do this too, just the idea he was espousing here. --------- Co-authored-by: Kyle Spier-Swenson <kyleshome@gmail.com> Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com> Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
75 lines
2.5 KiB
Plaintext
75 lines
2.5 KiB
Plaintext
/obj/effect/landmark/bitrunning
|
|
name = "Generic bitrunning effect"
|
|
icon = 'icons/effects/bitrunning.dmi'
|
|
icon_state = "crate"
|
|
|
|
/// In case you want to gate the crate behind a special condition.
|
|
/obj/effect/landmark/bitrunning/loot_signal
|
|
name = "Mysterious aura"
|
|
|
|
/// Where the exit hololadder spawns
|
|
/obj/effect/landmark/bitrunning/hololadder_spawn
|
|
name = "Bitrunning hololadder spawn"
|
|
icon_state = "hololadder"
|
|
|
|
/// Where the crates need to be taken
|
|
/obj/effect/landmark/bitrunning/cache_goal_turf
|
|
name = "Bitrunning goal turf"
|
|
icon_state = "goal"
|
|
|
|
/// Where you want the crate to spawn
|
|
/obj/effect/landmark/bitrunning/cache_spawn
|
|
name = "Bitrunning crate spawn"
|
|
icon_state = "crate"
|
|
|
|
///Swaps the locations of an encrypted crate in the area with another randomly selected crate.
|
|
///Randomizes names, so you have to inspect crates manually.
|
|
/obj/effect/landmark/bitrunning/crate_replacer
|
|
name = "Bitrunning Goal Crate Randomizer"
|
|
icon_state = "crate"
|
|
|
|
/obj/effect/landmark/bitrunning/crate_replacer/Initialize(mapload)
|
|
. = ..()
|
|
|
|
#ifdef UNIT_TESTS
|
|
return
|
|
#endif
|
|
|
|
var/list/crate_list = list()
|
|
var/obj/structure/closet/crate/secure/bitrunning/encrypted/encrypted_crate
|
|
var/area/my_area = get_area(src)
|
|
|
|
for (var/list/zlevel_turfs as anything in my_area.get_zlevel_turf_lists())
|
|
for (var/turf/area_turf as anything in zlevel_turfs)
|
|
for(var/obj/structure/closet/crate/crate_to_check in area_turf)
|
|
if(istype(crate_to_check, /obj/structure/closet/crate/secure/bitrunning/encrypted))
|
|
encrypted_crate = crate_to_check
|
|
crate_to_check.desc += span_hypnophrase(" This feels like the crate we're looking for!")
|
|
else
|
|
crate_list += crate_to_check
|
|
crate_to_check.name = "Unidentified Crate"
|
|
|
|
if(!encrypted_crate)
|
|
stack_trace("Bitrunning Goal Crate Randomizer failed to find an encrypted crate to swap positions for.")
|
|
return
|
|
if(!length(crate_list))
|
|
stack_trace("Bitrunning Goal Crate Randomizer failed to find any NORMAL crates to swap positions for.")
|
|
return
|
|
|
|
var/original_location = encrypted_crate.loc
|
|
var/obj/structure/closet/crate/selected_crate = pick(crate_list)
|
|
|
|
encrypted_crate.abstract_move(selected_crate.loc)
|
|
selected_crate.abstract_move(original_location)
|
|
|
|
/// A location for mobs to spawn.
|
|
/obj/effect/landmark/bitrunning/mob_segment
|
|
name = "Bitrunning modular mob segment"
|
|
icon_state = "mob_segment"
|
|
|
|
/// Bitrunning safehouses. Typically 7x6 rooms with a single entrance.
|
|
/obj/modular_map_root/safehouse
|
|
config_file = "strings/modular_maps/safehouse.toml"
|
|
icon = 'icons/effects/bitrunning.dmi'
|
|
icon_state = "safehouse"
|