diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index d76a631cc0b..54137f7d081 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -159,30 +159,22 @@ // It will keep doing this until it checks every content possible. This will fix any problems with mobs, that are inside objects, // being unable to hear people due to being in a box within a bag. -/proc/recursive_mob_check(atom/O, list/L = list(), recursion_limit = 3, client_check = 1, sight_check = 1, include_radio = 1) - - //GLOB.debug_mob += O.contents.len +/proc/recursive_mob_check(atom/O, list/L = list(), recursion_limit = 3, client_check = TRUE, sight_check = TRUE) if(!recursion_limit) return L for(var/atom/A in O.contents) - if(ismob(A)) var/mob/M = A if(client_check && !M.client) - L |= recursive_mob_check(A, L, recursion_limit - 1, client_check, sight_check, include_radio) + L |= recursive_mob_check(A, L, recursion_limit - 1, client_check, sight_check) continue if(sight_check && !isInSight(A, O)) continue L |= M //log_world("[recursion_limit] = [M] - [get_turf(M)] - ([M.x], [M.y], [M.z])") - else if(include_radio && isradio(A)) - if(sight_check && !isInSight(A, O)) - continue - L |= A - if(isobj(A) || ismob(A)) - L |= recursive_mob_check(A, L, recursion_limit - 1, client_check, sight_check, include_radio) + L |= recursive_mob_check(A, L, recursion_limit - 1, client_check, sight_check) return L // The old system would loop through lists for a total of 5000 per function call, in an empty server. @@ -197,23 +189,17 @@ if(!T) return hear - var/list/range = hear(R, T) - - for(var/atom/A in range) + for(var/atom/A in hear(R, T)) if(ismob(A)) var/mob/M = A if(M.client || include_clientless) hear += M - //log_world("Start = [M] - [get_turf(M)] - ([M.x], [M.y], [M.z])") - else if(isradio(A)) - hear += A if(isobj(A) || ismob(A)) - hear |= recursive_mob_check(A, hear, 3, 1, 0, 1) + hear |= recursive_mob_check(A, hear, 3, TRUE, FALSE) return hear - /proc/get_mobs_in_radio_ranges(list/obj/item/radio/radios) . = list() // Returns a list of mobs who can hear any of the radios given in @radios @@ -235,7 +221,6 @@ for(var/turf/T in hear(R.canhear_range,speaker)) speaker_coverage[T] = T - // Try to find all the players who can hear the message for(var/A in GLOB.player_list + GLOB.hear_radio_list) var/mob/M = A diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 50a5df5f38d..33db8019b97 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -720,16 +720,19 @@ Returns 1 if the chain up to the area contains the given typepath //Takes: Area type as text string or as typepath OR an instance of the area. //Returns: A list of all turfs in areas of that type of that type in the world. /proc/get_area_turfs(areatype) - if(!areatype) return null - if(istext(areatype)) areatype = text2path(areatype) + if(!areatype) + return + if(istext(areatype)) + areatype = text2path(areatype) if(isarea(areatype)) var/area/areatemp = areatype areatype = areatemp.type var/list/turfs = list() - for(var/area/N in world) + for(var/area/N as anything in GLOB.all_areas) if(istype(N, areatype)) - for(var/turf/T in N) turfs += T + for(var/turf/T in N) + turfs += T return turfs //Takes: Area type as text string or as typepath OR an instance of the area. @@ -754,7 +757,7 @@ Returns 1 if the chain up to the area contains the given typepath var/y_pos var/z_pos -/area/proc/move_contents_to(area/A, turf_to_leave, direction) +/area/proc/move_contents_to(area/A, turf_to_leave, direction) // someone rewrite this function i beg of you //Takes: Area. Optional: turf type to leave behind. //Returns: Nothing. //Notes: Attempts to move the contents of one area to another area. @@ -763,7 +766,7 @@ Returns 1 if the chain up to the area contains the given typepath if(!A || !src) return 0 - var/list/turfs_src = get_area_turfs(src.type) + var/list/turfs_src = get_area_turfs(type) var/list/turfs_trg = get_area_turfs(A.type) var/src_min_x = 0 diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index 85edb417fba..0e789eacb89 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -81,7 +81,6 @@ add_fingerprint(user) - //the equivalent of the standard version of attack() but for object targets. /obj/item/proc/attack_obj(obj/O, mob/living/user, params) if(SEND_SIGNAL(src, COMSIG_ITEM_ATTACK_OBJ, O, user) & COMPONENT_NO_ATTACK_OBJ) diff --git a/code/controllers/subsystem/non_firing/SSmapping.dm b/code/controllers/subsystem/non_firing/SSmapping.dm index 6b33a817f4a..7a90cc3dd87 100644 --- a/code/controllers/subsystem/non_firing/SSmapping.dm +++ b/code/controllers/subsystem/non_firing/SSmapping.dm @@ -83,33 +83,47 @@ SUBSYSTEM_DEF(mapping) log_startup_progress("Skipping lavaland ruins...") // Now we make a list of areas for teleport locs + // Located below is some of the worst code I've ever seen + // Checking all areas to see if they have a turf in them? Nice one ssmapping! + + var/list/all_areas = list() + for(var/area/areas in world) + all_areas += areas + teleportlocs = list() - for(var/area/AR in world) + for(var/area/AR as anything in all_areas) if(AR.no_teleportlocs) continue if(teleportlocs[AR.name]) continue - var/turf/picked = safepick(get_area_turfs(AR.type)) + var/list/pickable_turfs = list() + for(var/turf/turfs in AR) + pickable_turfs += turfs + var/turf/picked = safepick(pickable_turfs) if(picked && is_station_level(picked.z)) teleportlocs[AR.name] = AR teleportlocs = sortAssoc(teleportlocs) - ghostteleportlocs = list() - for(var/area/AR in world) + for(var/area/AR as anything in all_areas) if(ghostteleportlocs[AR.name]) continue - var/list/turfs = get_area_turfs(AR.type) - if(turfs.len) + var/list/pickable_turfs = list() + for(var/turf/turfs in AR) + pickable_turfs += turfs + if(length(pickable_turfs)) ghostteleportlocs[AR.name] = AR ghostteleportlocs = sortAssoc(ghostteleportlocs) // Now we make a list of areas that exist on the station. Good for if you don't want to select areas that exist for one station but not others. Directly references existing_station_areas = list() - for(var/area/AR in world) - var/turf/picked = safepick(get_area_turfs(AR.type)) + for(var/area/AR as anything in all_areas) + var/list/pickable_turfs = list() + for(var/turf/turfs in AR) + pickable_turfs += turfs + var/turf/picked = safepick(pickable_turfs) if(picked && is_station_level(picked.z)) existing_station_areas += AR diff --git a/code/datums/emote.dm b/code/datums/emote.dm index 42304b2f879..23e3ca9850a 100644 --- a/code/datums/emote.dm +++ b/code/datums/emote.dm @@ -280,7 +280,7 @@ runechat_text = "[copytext(text, 1, 101)]..." var/list/can_see = get_mobs_in_view(1, user) //Allows silicon & mmi mobs carried around to see the emotes of the person carrying them around. can_see |= viewers(user, null) - for(var/mob/O in can_see) + for(var/mob/O as anything in can_see) if(O.status_flags & PASSEMOTES) for(var/obj/item/holder/H in O.contents) H.show_message(text, EMOTE_VISIBLE) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index cf70c3d27bb..c76d3d6d7f8 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -1096,7 +1096,7 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons) if(!message) return var/list/speech_bubble_hearers = list() - for(var/mob/M in get_mobs_in_view(7, src)) + for(var/mob/M as anything in get_mobs_in_view(7, src)) M.show_message("[src] [atom_say_verb], \"[message]\"", 2, null, 1) if(M.client) speech_bubble_hearers += M.client diff --git a/code/game/gamemodes/miniantags/pulsedemon/pulsedemon.dm b/code/game/gamemodes/miniantags/pulsedemon/pulsedemon.dm index 993273c39b7..6dbc087e0e5 100644 --- a/code/game/gamemodes/miniantags/pulsedemon/pulsedemon.dm +++ b/code/game/gamemodes/miniantags/pulsedemon/pulsedemon.dm @@ -571,7 +571,7 @@ else if(istype(loc, /obj/machinery/hologram/holopad)) var/obj/machinery/hologram/holopad/H = loc name = "[H]" - for(var/mob/M in get_mobs_in_view(7, H)) + for(var/mob/M as anything in get_mobs_in_view(7, H)) M.hear_say(message_pieces, verb, FALSE, src) name = real_name return TRUE @@ -587,7 +587,7 @@ /mob/living/simple_animal/demon/pulse_demon/visible_message(message, self_message, blind_message) // overriden because pulse demon is quite often in non-turf locs, and /mob/visible_message acts differently there - for(var/mob/M in get_mobs_in_view(7, src)) + for(var/mob/M as anything in get_mobs_in_view(7, src)) if(M.see_invisible < invisibility) continue //can't view the invisible var/msg = message diff --git a/code/game/objects/items/devices/megaphone.dm b/code/game/objects/items/devices/megaphone.dm index 72e5e67d539..3aa54e27af6 100644 --- a/code/game/objects/items/devices/megaphone.dm +++ b/code/game/objects/items/devices/megaphone.dm @@ -83,7 +83,7 @@ for(var/obj/O in view(14, get_turf(src))) O.hear_talk(user, message_to_multilingual("[message]")) - for(var/mob/M in get_mobs_in_view(7, src)) + for(var/mob/M as anything in get_mobs_in_view(7, src)) if((M.client?.prefs.toggles2 & PREFTOGGLE_2_RUNECHAT) && M.can_hear()) M.create_chat_message(user, message, FALSE, "big") diff --git a/code/game/objects/items/devices/radio/beacon.dm b/code/game/objects/items/devices/radio/beacon.dm index 6e66f17366b..1ced9680dc0 100644 --- a/code/game/objects/items/devices/radio/beacon.dm +++ b/code/game/objects/items/devices/radio/beacon.dm @@ -26,10 +26,6 @@ /obj/item/radio/beacon/hear_talk() return - -/obj/item/radio/beacon/send_hear() - return null - /// Probably a better way of doing this, I'm lazy. /obj/item/radio/beacon/bacon diff --git a/code/game/objects/items/devices/radio/radio_objects.dm b/code/game/objects/items/devices/radio/radio_objects.dm index 64a5c5c3bfa..514c33c672c 100644 --- a/code/game/objects/items/devices/radio/radio_objects.dm +++ b/code/game/objects/items/devices/radio/radio_objects.dm @@ -542,11 +542,6 @@ GLOBAL_LIST_EMPTY(deadsay_radio_systems) return -1 return canhear_range -/obj/item/radio/proc/send_hear(freq, level) - var/range = receive_range(freq, level) - if(range > -1) - return get_mobs_in_view(canhear_range, src) - /obj/item/radio/proc/is_listening() var/is_listening = TRUE if(!on) diff --git a/code/modules/antagonists/changeling/powers/shriek.dm b/code/modules/antagonists/changeling/powers/shriek.dm index 90c98ab8e6c..e2e1862f598 100644 --- a/code/modules/antagonists/changeling/powers/shriek.dm +++ b/code/modules/antagonists/changeling/powers/shriek.dm @@ -13,7 +13,7 @@ /datum/action/changeling/resonant_shriek/sting_action(mob/user) if(istype(user.loc, /obj/machinery/atmospherics)) return FALSE - for(var/mob/living/M in get_mobs_in_view(4, user)) + for(var/mob/living/M as anything in get_mobs_in_view(4, user)) if(iscarbon(M)) if(ishuman(M)) var/mob/living/carbon/human/H = M diff --git a/code/modules/mob/living/silicon/ai/ai_mob.dm b/code/modules/mob/living/silicon/ai/ai_mob.dm index 1fcd822f383..dabfb32bafb 100644 --- a/code/modules/mob/living/silicon/ai/ai_mob.dm +++ b/code/modules/mob/living/silicon/ai/ai_mob.dm @@ -135,6 +135,9 @@ GLOBAL_LIST_INIT(ai_verbs_default, list( /mob/living/silicon/proc/subsystem_law_manager, /mob/living/silicon/proc/subsystem_power_monitor) + /// The cached AI annoucement help menu. + var/ai_announcement_string_menu + /mob/living/silicon/ai/proc/add_ai_verbs() add_verb(src, GLOB.ai_verbs_default) add_verb(src, silicon_subsystems) @@ -1545,6 +1548,13 @@ GLOBAL_LIST_INIT(ai_verbs_default, list( var/mob/dead/observer/ghost = . ghost.forceMove(old_turf) +/mob/living/silicon/ai/can_vv_get(var_name) + if(!..()) + return FALSE + if(var_name == "ai_announcement_string_menu") // This single var has over 80 thousand characters in it. Not something you really want when VVing the AI + return FALSE + return TRUE + /mob/living/silicon/ai/proc/blurb_it() addtimer(CALLBACK(src, TYPE_PROC_REF(/mob/living/silicon/ai, show_ai_blurb)), 1 SECONDS) diff --git a/code/modules/mob/living/silicon/ai/ai_say.dm b/code/modules/mob/living/silicon/ai/ai_say.dm index d8b720ad7f2..99f16c1228f 100644 --- a/code/modules/mob/living/silicon/ai/ai_say.dm +++ b/code/modules/mob/living/silicon/ai/ai_say.dm @@ -74,24 +74,25 @@ GLOBAL_VAR_INIT(announcing_vox, 0) // Stores the time of the last announcement set desc = "Display a list of vocal words to announce to the crew." set category = "AI Commands" - var/list/dat = list() + if(!ai_announcement_string_menu) + var/list/dat = list() - dat += "Here is a list of words you can type into the 'Announcement' button to create sentences to vocally announce to everyone on the same level at you.
\ - \ - WARNING:
Misuse of the announcement system will get you job banned.
" + dat += "Here is a list of words you can type into the 'Announcement' button to create sentences to vocally announce to everyone on the same level at you.
\ + \ + WARNING:
Misuse of the announcement system will get you job banned.
" - // Show alert and voice sounds separately - var/vox_words = GLOB.vox_sounds - GLOB.vox_alerts - dat += help_format(GLOB.vox_alerts) - dat += "
" - dat += help_format(vox_words) + // Show alert and voice sounds separately + var/vox_words = GLOB.vox_sounds - GLOB.vox_alerts + dat += help_format(GLOB.vox_alerts) + dat += "
" + dat += help_format(vox_words) - var/string_dat = dat.Join("") + ai_announcement_string_menu = dat.Join("") var/datum/browser/popup = new(src, "announce_help", "Announcement Help", 500, 400) - popup.set_content(string_dat) + popup.set_content(ai_announcement_string_menu) popup.open() /mob/living/silicon/ai/proc/help_format(word_list) @@ -122,8 +123,8 @@ GLOBAL_VAR_INIT(announcing_vox, 0) // Stores the time of the last announcement var/list/words = splittext(trim(message), " ") var/list/incorrect_words = list() - if(words.len > 30) - words.len = 30 + if(length(words) > 30) + words.Cut(31) for(var/word in words) word = lowertext(trim(word)) @@ -133,7 +134,7 @@ GLOBAL_VAR_INIT(announcing_vox, 0) // Stores the time of the last announcement if(!GLOB.vox_sounds[word]) incorrect_words += word - if(incorrect_words.len) + if(length(incorrect_words)) to_chat(src, "These words are not available on the announcement system: [english_list(incorrect_words)].") return @@ -143,11 +144,10 @@ GLOBAL_VAR_INIT(announcing_vox, 0) // Stores the time of the last announcement message_admins("[key_name_admin(src)] made a vocal announcement: [message].") for(var/word in words) - play_vox_word(word, src.z, null) + play_vox_word(word, z, null) ai_voice_announcement_to_text(words) - /mob/living/silicon/ai/proc/ai_voice_announcement_to_text(words) var/words_string = jointext(words, " ") // Don't go through .Announce because we need to filter by clients which have TTS enabled diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index aff6b1e7651..dd7252e82cf 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -139,7 +139,7 @@ /mob/visible_message(message, self_message, blind_message) if(!isturf(loc)) // mobs inside objects (such as lockers) shouldn't have their actions visible to those outside the object - for(var/mob/M in get_mobs_in_view(3, src)) + for(var/mob/M as anything in get_mobs_in_view(3, src)) if(M.see_invisible < invisibility) continue //can't view the invisible var/msg = message @@ -151,7 +151,7 @@ msg = blind_message M.show_message(msg, EMOTE_VISIBLE, blind_message, EMOTE_AUDIBLE) return - for(var/mob/M in get_mobs_in_view(7, src)) + for(var/mob/M as anything in get_mobs_in_view(7, src)) if(M.see_invisible < invisibility) continue //can't view the invisible var/msg = message @@ -164,7 +164,7 @@ // message is output to anyone who can see, e.g. "The [src] does something!" // blind_message (optional) is what blind people will hear e.g. "You hear something!" /atom/proc/visible_message(message, blind_message) - for(var/mob/M in get_mobs_in_view(7, src)) + for(var/mob/M as anything in get_mobs_in_view(7, src)) if(!M.client) continue M.show_message(message, EMOTE_VISIBLE, blind_message, EMOTE_AUDIBLE) @@ -180,7 +180,7 @@ if(hearing_distance) range = hearing_distance var/msg = message - for(var/mob/M in get_mobs_in_view(range, src)) + for(var/mob/M as anything in get_mobs_in_view(range, src)) M.show_message(msg, EMOTE_AUDIBLE, deaf_message, EMOTE_VISIBLE) // based on say code @@ -206,7 +206,7 @@ var/range = 7 if(hearing_distance) range = hearing_distance - for(var/mob/M in get_mobs_in_view(range, src)) + for(var/mob/M as anything in get_mobs_in_view(range, src)) M.show_message(message, EMOTE_AUDIBLE, deaf_message, EMOTE_VISIBLE) /mob/proc/findname(msg) diff --git a/code/modules/power/engines/tesla/energy_ball.dm b/code/modules/power/engines/tesla/energy_ball.dm index c27b1e31893..2277dfd36e0 100644 --- a/code/modules/power/engines/tesla/energy_ball.dm +++ b/code/modules/power/engines/tesla/energy_ball.dm @@ -138,8 +138,6 @@ var/area/where_to_move = pick(all_possible_areas) // Grabs a random area that isn't restricted var/turf/target_area_turfs = get_area_turfs(where_to_move) // Grabs the turfs from said area target_turf = pick(target_area_turfs) // Grabs a single turf from the entire list - return - /obj/singularity/energy_ball/proc/handle_energy() if(energy >= energy_to_raise) diff --git a/code/modules/surgery/organs/vocal_cords.dm b/code/modules/surgery/organs/vocal_cords.dm index af6950b9911..8bd59f17ec9 100644 --- a/code/modules/surgery/organs/vocal_cords.dm +++ b/code/modules/surgery/organs/vocal_cords.dm @@ -157,10 +157,10 @@ GLOBAL_DATUM_INIT(multispin_words, /regex, regex("like a record baby")) /obj/item/organ/internal/vocal_cords/colossus/speak_with(message) var/log_message = uppertext(message) message = lowertext(message) - playsound(get_turf(owner), 'sound/magic/invoke_general.ogg', 300, 1, 5) + playsound(get_turf(owner), 'sound/magic/invoke_general.ogg', 300, TRUE, 5) var/list/mob/living/listeners = list() - for(var/mob/living/L in get_mobs_in_view(8, owner, TRUE)) + for(var/mob/living/L as anything in get_mobs_in_view(8, owner, TRUE)) if(L.can_hear() && !L.null_rod_check() && L != owner && L.stat != DEAD) if(ishuman(L)) var/mob/living/carbon/human/H = L