mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-28 02:52:01 +00:00
Optimize playsound, starlight, and visualnet generation (#13540)
This commit is contained in:
@@ -245,7 +245,7 @@
|
||||
|
||||
#define ECONOMIC_POSITIONS list(ECONOMICALLY_WEALTHY, ECONOMICALLY_WELLOFF, ECONOMICALLY_AVERAGE, ECONOMICALLY_UNDERPAID, ECONOMICALLY_POOR)
|
||||
|
||||
// Defines the argument used for get_mobs_and_objs_in_view_fast
|
||||
// Defines the argument used for get_mobs_or_objs_in_view
|
||||
#define GHOSTS_ALL_HEAR 1
|
||||
#define ONLY_GHOSTS_IN_VIEW 0
|
||||
|
||||
|
||||
@@ -156,31 +156,6 @@
|
||||
|
||||
// Returns a list of mobs and/or objects in range of R from source. Used in radio and say code.
|
||||
|
||||
/proc/get_mobs_or_objects_in_view(var/R, var/atom/source, var/include_mobs = 1, var/include_objects = 1)
|
||||
|
||||
var/turf/T = get_turf(source)
|
||||
var/list/hear = list()
|
||||
|
||||
if(!T)
|
||||
return hear
|
||||
|
||||
var/list/range = hear(R, T)
|
||||
|
||||
for(var/I in range)
|
||||
if(ismob(I))
|
||||
recursive_content_check(I, hear, 3, 1, 0, include_mobs, include_objects)
|
||||
if(include_mobs)
|
||||
var/mob/M = I
|
||||
if(M.client)
|
||||
hear += M
|
||||
else if(istype(I, /obj/))
|
||||
recursive_content_check(I, hear, 3, 1, 0, include_mobs, include_objects)
|
||||
if(include_objects)
|
||||
hear += I
|
||||
|
||||
return hear
|
||||
|
||||
|
||||
/proc/get_mobs_in_radio_ranges(var/list/obj/item/device/radio/radios)
|
||||
|
||||
set background = 1
|
||||
@@ -215,7 +190,7 @@
|
||||
if(M.can_hear_radio(speaker_coverage))
|
||||
. += M
|
||||
|
||||
/proc/get_mobs_and_objs_in_view_fast(turf/T, range, list/mobs, list/objs, checkghosts = GHOSTS_ALL_HEAR)
|
||||
/proc/get_mobs_or_objs_in_view(turf/T, range, list/mobs, list/objs, checkghosts = GHOSTS_ALL_HEAR)
|
||||
var/list/hear = list()
|
||||
DVIEW(hear, range, T, INVISIBILITY_MAXIMUM)
|
||||
var/list/hearturfs = list()
|
||||
@@ -554,4 +529,4 @@ datum/projectile_data
|
||||
C = M.client
|
||||
if(!C)
|
||||
return
|
||||
winset(C, "mainwindow", "flash=5")
|
||||
winset(C, "mainwindow", "flash=5")
|
||||
|
||||
@@ -547,7 +547,7 @@
|
||||
var/turf/T = get_turf(src)
|
||||
var/list/mobs = list()
|
||||
var/list/objs = list()
|
||||
get_mobs_and_objs_in_view_fast(T,range, mobs, objs, ONLY_GHOSTS_IN_VIEW)
|
||||
get_mobs_or_objs_in_view(T,range, mobs, objs, ONLY_GHOSTS_IN_VIEW)
|
||||
|
||||
for(var/o in objs)
|
||||
var/obj/O = o
|
||||
@@ -576,7 +576,7 @@
|
||||
var/turf/T = get_turf(src)
|
||||
var/list/mobs = list()
|
||||
var/list/objs = list()
|
||||
get_mobs_and_objs_in_view_fast(T,range, mobs, objs, ONLY_GHOSTS_IN_VIEW)
|
||||
get_mobs_or_objs_in_view(T,range, mobs, objs, ONLY_GHOSTS_IN_VIEW)
|
||||
|
||||
for(var/m in mobs)
|
||||
var/mob/M = m
|
||||
@@ -590,7 +590,10 @@
|
||||
|
||||
/atom/proc/intent_message(var/message, var/range = 7)
|
||||
if(air_sound(src))
|
||||
var/list/mobs = get_mobs_or_objects_in_view(range, src, include_objects = FALSE)
|
||||
var/turf/T = get_turf(src)
|
||||
var/list/mobs = list()
|
||||
var/list/objs = list()
|
||||
get_mobs_or_objs_in_view(T, range, mobs, objs, ONLY_GHOSTS_IN_VIEW)
|
||||
for(var/mob/living/carbon/human/H as anything in intent_listener)
|
||||
if(!(H in mobs))
|
||||
if(src.z == H.z && get_dist(src, H) <= range)
|
||||
|
||||
@@ -578,7 +578,10 @@ var/global/list/default_medbay_channels = list(
|
||||
|
||||
var/range = receive_range(freq, level)
|
||||
if(range > -1)
|
||||
return get_mobs_or_objects_in_view(canhear_range, src)
|
||||
var/list/mobs = list()
|
||||
var/list/objs = list()
|
||||
get_mobs_or_objs_in_view(get_turf(src), canhear_range, mobs, objs)
|
||||
return mobs
|
||||
|
||||
|
||||
/obj/item/device/radio/examine(mob/user)
|
||||
@@ -823,4 +826,4 @@ var/global/list/default_medbay_channels = list(
|
||||
|
||||
/obj/item/device/radio/all_channels/Initialize()
|
||||
channels = ALL_RADIO_CHANNELS.Copy()
|
||||
. = ..()
|
||||
. = ..()
|
||||
|
||||
@@ -120,9 +120,10 @@
|
||||
M.playsound_to(source_turf, S, use_random_freq = use_random_freq, use_pressure = use_pressure, modify_environment = modify_environment)
|
||||
|
||||
/proc/playsound_lineofsight(atom/source, sound/S, use_random_freq = FALSE, use_pressure = TRUE, modify_environment = TRUE, required_preferences = 0, required_asfx_toggles = 0)
|
||||
var/list/mobs = get_mobs_or_objects_in_view(world.view, source, include_objects = FALSE)
|
||||
|
||||
var/turf/source_turf = get_turf(source)
|
||||
var/list/mobs = list()
|
||||
var/list/objs = list()
|
||||
get_mobs_or_objs_in_view(source_turf, world.view, mobs, objs, ONLY_GHOSTS_IN_VIEW)
|
||||
|
||||
for (var/MM in mobs)
|
||||
var/mob/M = MM
|
||||
|
||||
@@ -62,17 +62,15 @@
|
||||
|
||||
return 0
|
||||
|
||||
/turf/space/proc/update_starlight()
|
||||
if(config.starlight)
|
||||
for (var/T in RANGE_TURFS(1, src))
|
||||
if (istype(T, /turf/space))
|
||||
continue
|
||||
|
||||
set_light(config.starlight)
|
||||
return
|
||||
|
||||
if (light_range)
|
||||
set_light(0)
|
||||
/turf/space/proc/update_starlight(var/validate = TRUE)
|
||||
if(!config.starlight)
|
||||
return
|
||||
if(!validate) // basically a hack for places where the check was already done for us
|
||||
set_light(1, config.starlight)
|
||||
else if(locate(/turf/simulated) in RANGE_TURFS(1, src))
|
||||
set_light(1, config.starlight)
|
||||
else
|
||||
set_light(0)
|
||||
|
||||
/turf/space/attackby(obj/item/C as obj, mob/user as mob)
|
||||
|
||||
@@ -210,4 +208,4 @@
|
||||
return ..(N, tell_universe, TRUE, keep_air)
|
||||
|
||||
/turf/space/is_open()
|
||||
return TRUE
|
||||
return TRUE
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
|
||||
if (config.starlight)
|
||||
for (var/turf/space/S in RANGE_TURFS(1, src))
|
||||
S.update_starlight()
|
||||
S.update_starlight(FALSE)
|
||||
|
||||
W.above = old_above
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
var/list/hearers = list()
|
||||
var/list/objs = list()
|
||||
get_mobs_and_objs_in_view_fast(get_turf(src), vision_distance, hearers, objs, ONLY_GHOSTS_IN_VIEW)
|
||||
get_mobs_or_objs_in_view(get_turf(src), vision_distance, hearers, objs, ONLY_GHOSTS_IN_VIEW)
|
||||
hearers -= ignored_mobs
|
||||
|
||||
for(var/mob/hearer as anything in hearers - src)
|
||||
@@ -75,4 +75,4 @@
|
||||
#undef BALLOON_TEXT_FULLY_VISIBLE_TIME
|
||||
#undef BALLOON_TEXT_SPAWN_TIME
|
||||
#undef BALLOON_TEXT_TOTAL_LIFETIME
|
||||
#undef BALLOON_TEXT_WIDTH
|
||||
#undef BALLOON_TEXT_WIDTH
|
||||
|
||||
@@ -234,7 +234,7 @@ when portals are shortly lived, or when portals are made to be obvious with spec
|
||||
var/turf/T = counterpart.get_focused_turf()
|
||||
var/list/mobs_to_relay = list()
|
||||
var/list/objs = list()
|
||||
get_mobs_and_objs_in_view_fast(T, world.view, mobs_to_relay, objs)
|
||||
get_mobs_or_objs_in_view(T, world.view, mobs_to_relay, objs)
|
||||
|
||||
for(var/thing in mobs_to_relay)
|
||||
var/mob/mob = thing
|
||||
@@ -251,7 +251,7 @@ when portals are shortly lived, or when portals are made to be obvious with spec
|
||||
var/turf/T = counterpart.get_focused_turf()
|
||||
var/list/mobs_to_relay = list()
|
||||
var/list/objs = list()
|
||||
get_mobs_and_objs_in_view_fast(T, world.view, mobs_to_relay, objs)
|
||||
get_mobs_or_objs_in_view(T, world.view, mobs_to_relay, objs)
|
||||
|
||||
for(var/thing in mobs_to_relay)
|
||||
var/mob/mob = thing
|
||||
@@ -266,7 +266,7 @@ when portals are shortly lived, or when portals are made to be obvious with spec
|
||||
var/turf/T = counterpart.get_focused_turf()
|
||||
var/list/mobs_to_relay = list()
|
||||
var/list/objs = list()
|
||||
get_mobs_and_objs_in_view_fast(T, world.view, mobs_to_relay, objs)
|
||||
get_mobs_or_objs_in_view(T, world.view, mobs_to_relay, objs)
|
||||
|
||||
for(var/thing in mobs_to_relay)
|
||||
var/mob/mob = thing
|
||||
@@ -342,4 +342,4 @@ when portals are shortly lived, or when portals are made to be obvious with spec
|
||||
|
||||
/obj/effect/map_effect/portal/line/side_b
|
||||
name = "portal line B"
|
||||
icon_state = "portal_line_side_b"
|
||||
icon_state = "portal_line_side_b"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//UPDATE TRIGGERS, when the chunk (and the surrounding chunks) should update.
|
||||
|
||||
/proc/updateVisibility(atom/A, var/opacity_check = TRUE)
|
||||
if(SSticker)
|
||||
if(SSticker.current_state >= GAME_STATE_PLAYING)
|
||||
for(var/datum/visualnet/VN in visual_nets)
|
||||
VN.update_visibility(A, opacity_check)
|
||||
|
||||
|
||||
@@ -293,7 +293,7 @@ proc/get_radio_key_from_channel(var/channel)
|
||||
italics = 1
|
||||
sound_vol *= 0.5 //muffle the sound a bit, so it's like we're actually talking through contact
|
||||
|
||||
get_mobs_and_objs_in_view_fast(T, message_range, listening, listening_obj, ghost_hearing)
|
||||
get_mobs_or_objs_in_view(T, message_range, listening, listening_obj, ghost_hearing)
|
||||
|
||||
var/list/hear_clients = list()
|
||||
for(var/m in listening)
|
||||
|
||||
@@ -199,7 +199,7 @@
|
||||
|
||||
var/list/mobs = list()
|
||||
var/list/objs = list()
|
||||
get_mobs_and_objs_in_view_fast(T, range, mobs, objs, ghost_hearing)
|
||||
get_mobs_or_objs_in_view(T, range, mobs, objs, ghost_hearing)
|
||||
|
||||
|
||||
for(var/m in mobs)
|
||||
|
||||
Reference in New Issue
Block a user