diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index 561ab7ca198..f36b2e7878c 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -479,49 +479,32 @@ * Will not include parent-less vents to the returned list. * Arguments: * * unwelded_only - Whether the list should only include vents that are unwelded - * * exclude_mobs_nearby - Whether to exclude vents that are near living mobs regardless of visibility - * * nearby_mobs_range - The range at which to look for living mobs around the vent for the above argument - * * exclude_visible_by_mobs - Whether to exclude vents that are visible to any living mob + * * exclude_mobs_nearby - Whether to exclude vents that are near living mobs * * min_network_size - The minimum length (non-inclusive) of the vent's parent network. A smaller number means vents in small networks (Security, Virology) will appear in the list - * * station_levels_only - Whether to only consider vents that are in a Z-level with a STATION_LEVEL trait - * * z_level - The Z-level number to look for vents in. Defaults to all */ -/proc/get_valid_vent_spawns(unwelded_only = TRUE, exclude_mobs_nearby = FALSE, nearby_mobs_range = world.view, exclude_visible_by_mobs = FALSE, min_network_size = 50, station_levels_only = TRUE, z_level = 0) +/proc/get_valid_vent_spawns(unwelded_only = TRUE, exclude_mobs_nearby = FALSE, min_network_size = 50) ASSERT(min_network_size >= 0) - ASSERT(z_level >= 0) - - var/num_z_levels = length(GLOB.space_manager.z_list) - var/list/non_station_levels[num_z_levels] // Cache so we don't do is_station_level for every vent! . = list() for(var/object in GLOB.all_vent_pumps) // This only contains vent_pumps so don't bother with type checking var/obj/machinery/atmospherics/unary/vent_pump/vent = object var/vent_z = vent.z - if(z_level && vent_z != z_level) - continue - if(station_levels_only && (non_station_levels[vent_z] || !is_station_level(vent_z))) - non_station_levels[vent_z] = TRUE + if(!is_station_level(vent_z)) continue if(unwelded_only && vent.welded) continue if(exclude_mobs_nearby) var/turf/T = get_turf(vent) var/mobs_nearby = FALSE - for(var/mob/living/M in orange(nearby_mobs_range, T)) - if(!M.is_dead()) - mobs_nearby = TRUE - break + for(var/mob/living/M in orange(7, T)) + if(M.is_dead()) //we don't care about dead mobs + continue + if(!M.client && !istype(get_area(T), /area/toxins/xenobiology)) //we add an exception here for clientless mobs (apart from ones near xenobiology vents because it's usually filled with gold slime mobs who attack hostile mobs) + continue + mobs_nearby = TRUE + break if(mobs_nearby) continue - if(exclude_visible_by_mobs) - var/turf/T = get_turf(vent) - var/visible_by_mobs = FALSE - for(var/mob/living/M in viewers(world.view, T)) - if(!M.is_dead()) - visible_by_mobs = TRUE - break - if(visible_by_mobs) - continue if(!vent.parent) // This seems to have been an issue in the past, so this is here until it's definitely fixed // Can cause heavy message spam in some situations (e.g. pipenets breaking) // log_debug("get_valid_vent_spawns(), vent has no parent: [vent], qdeled: [QDELETED(vent)], loc: [vent.loc]") diff --git a/code/game/gamemodes/miniantags/borer/borer_event.dm b/code/game/gamemodes/miniantags/borer/borer_event.dm index d5bd7d65776..29132c3a0f8 100644 --- a/code/game/gamemodes/miniantags/borer/borer_event.dm +++ b/code/game/gamemodes/miniantags/borer/borer_event.dm @@ -17,7 +17,10 @@ log_and_message_admins("Warning: Could not spawn any mobs for event Borer Infestation") /datum/event/borer_infestation/start() - var/list/vents = get_valid_vent_spawns(exclude_mobs_nearby = TRUE, exclude_visible_by_mobs = TRUE) + var/list/vents = get_valid_vent_spawns(exclude_mobs_nearby = TRUE) + if(!length(vents)) + message_admins("Warning: No suitable vents detected for spawning borers. Force picking from station vents regardless of state!") + vents = get_valid_vent_spawns(unwelded_only = FALSE, min_network_size = 0) while(spawncount && length(vents)) var/obj/vent = pick_n_take(vents) new /mob/living/simple_animal/borer(vent.loc) diff --git a/code/modules/events/alien_infestation.dm b/code/modules/events/alien_infestation.dm index cc731783d03..49fc5a97d86 100644 --- a/code/modules/events/alien_infestation.dm +++ b/code/modules/events/alien_infestation.dm @@ -22,7 +22,10 @@ /datum/event/alien_infestation/proc/spawn_xenos() var/list/candidates = SSghost_spawns.poll_candidates("Do you want to play as an alien?", ROLE_ALIEN, TRUE, source = /mob/living/carbon/alien/larva) - var/list/vents = get_valid_vent_spawns(exclude_mobs_nearby = TRUE, exclude_visible_by_mobs = TRUE) + var/list/vents = get_valid_vent_spawns(exclude_mobs_nearby = TRUE) + if(!length(vents)) + message_admins("Warning: No suitable vents detected for spawning xenomorphs. Force picking from station vents regardless of state!") + vents = get_valid_vent_spawns(unwelded_only = FALSE, min_network_size = 0) while(spawncount && length(vents) && length(candidates)) var/obj/vent = pick_n_take(vents) var/mob/C = pick_n_take(candidates) diff --git a/code/modules/events/blob.dm b/code/modules/events/blob.dm index 1e37319f4e5..53cea98bfd5 100644 --- a/code/modules/events/blob.dm +++ b/code/modules/events/blob.dm @@ -20,9 +20,10 @@ if(!length(candidates)) return kill() - var/list/vents = get_valid_vent_spawns(exclude_mobs_nearby = TRUE, exclude_visible_by_mobs = TRUE) + var/list/vents = get_valid_vent_spawns(exclude_mobs_nearby = TRUE) if(!length(vents)) - return + message_admins("Warning: No suitable vents detected for spawning blob mouse. Force picking from station vents regardless of state!") + vents = get_valid_vent_spawns(unwelded_only = FALSE, min_network_size = 0) var/obj/vent = pick(vents) var/mob/living/simple_animal/mouse/blobinfected/B = new(vent.loc) var/mob/M = pick(candidates) diff --git a/code/modules/events/spider_infestation.dm b/code/modules/events/spider_infestation.dm index 39f16c183f7..72f7fa75a18 100644 --- a/code/modules/events/spider_infestation.dm +++ b/code/modules/events/spider_infestation.dm @@ -17,7 +17,7 @@ GLOBAL_VAR_INIT(sent_spiders_to_station, 0) log_and_message_admins("Warning: Could not spawn any mobs for event Spider Infestation") /datum/event/spider_infestation/start() - var/list/vents = get_valid_vent_spawns(exclude_mobs_nearby = TRUE, exclude_visible_by_mobs = TRUE) + var/list/vents = get_valid_vent_spawns(exclude_mobs_nearby = TRUE) while(spawncount && length(vents)) var/obj/vent = pick_n_take(vents) var/obj/structure/spider/spiderling/S = new(vent.loc) diff --git a/code/modules/events/spider_terror.dm b/code/modules/events/spider_terror.dm index 6bcd369884e..d9a85524150 100644 --- a/code/modules/events/spider_terror.dm +++ b/code/modules/events/spider_terror.dm @@ -50,7 +50,10 @@ var/list/candidates = SSghost_spawns.poll_candidates("Do you want to play as a terror spider?", null, TRUE, source = spider_type) if(length(candidates) < spawncount) message_admins("Warning: not enough players volunteered to be terrors. Could only spawn [length(candidates)] out of [spawncount]!") - var/list/vents = get_valid_vent_spawns(exclude_mobs_nearby = TRUE, exclude_visible_by_mobs = TRUE) + var/list/vents = get_valid_vent_spawns(exclude_mobs_nearby = TRUE) + if(!length(vents)) + message_admins("Warning: No suitable vents detected for spawning terrors. Force picking from station vents regardless of state!") + vents = get_valid_vent_spawns(unwelded_only = FALSE, min_network_size = 0) while(spawncount && length(vents) && length(candidates)) var/obj/vent = pick_n_take(vents) var/mob/living/simple_animal/hostile/poison/terror_spider/S = new spider_type(vent.loc) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index c30604dbb36..a511a16efbb 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -732,7 +732,7 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \ if(stat) to_chat(usr, "You have to be conscious to change your flavor text") return - + var/msg = input(usr,"Set the flavor text in your 'examine' verb. The flavor text should be a physical descriptor of your character at a glance.","Flavor Text",html_decode(flavor_text)) as message|null if(msg != null) @@ -1156,7 +1156,7 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \ return //find a viable mouse candidate - var/list/found_vents = get_valid_vent_spawns(min_network_size = 0, station_levels_only = FALSE, z_level = z) + var/list/found_vents = get_valid_vent_spawns(min_network_size = 0) if(length(found_vents)) var/obj/vent_found = pick(found_vents) var/mob/living/simple_animal/mouse/host = new(vent_found.loc)