Renames 'visible_atoms' and 'get_actual_viewers' procs to 'fov_view' and 'fov_viewers' (#12282)

* Renames 'visible_atoms' and 'get_actual_viewers' procs to 'fov_view' and 'fov_viewers'

* Ok, signals.
This commit is contained in:
Ghom
2020-05-18 02:04:15 +02:00
committed by GitHub
parent 335f5a37b9
commit 08280a853e
33 changed files with 49 additions and 49 deletions

View File

@@ -149,7 +149,7 @@
// /mob signals
#define COMSIG_MOB_CLICKED_SHIFT_ON "mob_shift_click_on" //from base of /atom/ShiftClick(): (atom/A), for return values, see COMSIG_CLICK_SHIFT
#define COMSIG_MOB_VISIBLE_ATOMS "mob_visible_atoms" //from base of mob/visible_atoms(): (list/visible_atoms)
#define COMSIG_MOB_FOV_VIEW "mob_visible_atoms" //from base of mob/fov_view(): (list/visible_atoms)
#define COMSIG_MOB_EXAMINATE "mob_examinate" //from base of /mob/verb/examinate(): (atom/A), for return values, see COMSIG_CLICK_SHIFT
#define COMPONENT_EXAMINATE_BLIND 3 //outputs the "something is there but you can't see it" message.
#define COMSIG_MOB_DEATH "mob_death" //from base of mob/death(): (gibbed)
@@ -185,7 +185,7 @@
#define SPEECH_LANGUAGE 5
// #define SPEECH_IGNORE_SPAM 6
// #define SPEECH_FORCED 7
#define COMSIG_MOB_IS_VIEWER "mob_is_viewer" //from base of /get_actual_viewers(): (atom/center, depth, viewers_list)
#define COMSIG_MOB_FOV_VIEWER "mob_is_viewer" //from base of /fov_viewers(): (atom/center, depth, viewers_list)
#define COMSIG_MOB_GET_VISIBLE_MESSAGE "mob_get_visible_message" //from base of atom/visible_message(): (atom/A, msg, range, ignored_mobs)
#define COMPONENT_NO_VISIBLE_MESSAGE 1 //exactly what's said on the tin.
#define COMSIG_MOB_ANTAG_ON_GAIN "mob_antag_on_gain" //from base of /datum/antagonist/on_gain(): (antag_datum)

View File

@@ -250,13 +250,13 @@
processing += A.contents
//viewers() but with a signal, for blacklisting.
/proc/get_actual_viewers(depth = world.view, atom/center)
/proc/fov_viewers(depth = world.view, atom/center)
if(!center)
return
. = viewers(depth, center)
for(var/k in .)
var/mob/M = k
SEND_SIGNAL(M, COMSIG_MOB_IS_VIEWER, center, depth, .)
SEND_SIGNAL(M, COMSIG_MOB_FOV_VIEWER, center, depth, .)
/proc/get_mobs_in_radio_ranges(list/obj/item/radio/radios)
. = list()

View File

@@ -44,7 +44,7 @@
return
if(world.time > next_check && world.time > next_scare)
next_check = world.time + 50
var/list/seen_atoms = owner.visible_atoms(7)
var/list/seen_atoms = owner.fov_view(7)
if(LAZYLEN(trigger_objs))
for(var/obj/O in seen_atoms)

View File

@@ -86,10 +86,10 @@
RegisterSignal(M, COMSIG_MOB_CLIENT_LOGOUT, .proc/on_mob_logout)
RegisterSignal(M, COMSIG_MOB_GET_VISIBLE_MESSAGE, .proc/on_visible_message)
RegisterSignal(M, COMSIG_MOB_EXAMINATE, .proc/on_examinate)
RegisterSignal(M, COMSIG_MOB_VISIBLE_ATOMS, .proc/on_visible_atoms)
RegisterSignal(M, COMSIG_MOB_FOV_VIEW, .proc/on_fov_view)
RegisterSignal(M, COMSIG_MOB_CLIENT_CHANGE_VIEW, .proc/on_change_view)
RegisterSignal(M, COMSIG_MOB_RESET_PERSPECTIVE, .proc/on_reset_perspective)
RegisterSignal(M, COMSIG_MOB_IS_VIEWER, .proc/is_viewer)
RegisterSignal(M, COMSIG_MOB_FOV_VIEWER, .proc/is_viewer)
/datum/component/field_of_vision/UnregisterFromParent()
. = ..()
@@ -109,8 +109,8 @@
UNREGISTER_NESTED_LOCS(nested_locs, COMSIG_MOVABLE_MOVED, 1)
UnregisterSignal(M, list(COMSIG_MOB_CLIENT_LOGIN, COMSIG_MOB_CLIENT_LOGOUT,
COMSIG_MOB_GET_VISIBLE_MESSAGE, COMSIG_MOB_EXAMINATE,
COMSIG_MOB_VISIBLE_ATOMS, COMSIG_MOB_RESET_PERSPECTIVE,
COMSIG_MOB_CLIENT_CHANGE_VIEW, COMSIG_MOB_IS_VIEWER))
COMSIG_MOB_FOV_VIEW, COMSIG_MOB_RESET_PERSPECTIVE,
COMSIG_MOB_CLIENT_CHANGE_VIEW, COMSIG_MOB_FOV_VIEWER))
/**
* Generates the holder and images (if not generated yet) and adds them to client.images.
@@ -296,7 +296,7 @@
if(fov.alpha)
FOV_ANGLE_CHECK(source, target, return, return COMPONENT_NO_VISIBLE_MESSAGE)
/datum/component/field_of_vision/proc/on_visible_atoms(mob/source, list/atoms)
/datum/component/field_of_vision/proc/on_fov_view(mob/source, list/atoms)
if(!fov.alpha)
return
for(var/k in atoms)

View File

@@ -572,7 +572,7 @@
if(rustle_sound)
playsound(parent, "rustle", 50, 1, -5)
to_chat(user, "<span class='notice'>You put [I] [insert_preposition]to [parent].</span>")
for(var/mob/viewing in get_actual_viewers(world.view, user)-M)
for(var/mob/viewing in fov_viewers(world.view, user)-M)
if(in_range(M, viewing)) //If someone is standing close enough, they can tell what it is...
viewing.show_message("<span class='notice'>[M] puts [I] [insert_preposition]to [parent].</span>", MSG_VISUAL)
else if(I && I.w_class >= 3) //Otherwise they can only see large or normal items from a distance...

View File

@@ -143,7 +143,7 @@ RLD
//if user can't be seen from A (only checks surroundings' opaqueness) and can't see A.
//jarring, but it should stop people from targetting atoms they can't see...
//excluding darkness, to allow RLD to be used to light pitch black dark areas.
if(!((user in view(view_range, A)) || (user in get_actual_viewers(view_range, A))))
if(!((user in view(view_range, A)) || (user in fov_viewers(view_range, A))))
to_chat(user, "<span class='warning'>You focus, pointing \the [src] at whatever outside your field of vision in that direction... to no avail.</span>")
return FALSE
return TRUE

View File

@@ -135,7 +135,7 @@
outmsg = "<span class='warning'>You miss the lens of [C] with [src]!</span>"
//catpeople
var/list/viewers = get_actual_viewers(1,targloc)
var/list/viewers = fov_viewers(1,targloc)
for(var/mob/living/carbon/human/H in viewers)
if(!iscatperson(H) || H.incapacitated() || H.eye_blind )
continue

View File

@@ -66,7 +66,7 @@
if(ismob(loc))
attack_self(loc)
else
for(var/mob/M in get_actual_viewers(1, src))
for(var/mob/M in fov_viewers(1, src))
if(M.client)
attack_self(M)
add_fingerprint(usr)

View File

@@ -104,7 +104,7 @@
if (ismob(src.loc))
attack_self(src.loc)
else
for(var/mob/M in get_actual_viewers(1, src))
for(var/mob/M in fov_viewers(1, src))
if (M.client)
src.attack_self(M)
return

View File

@@ -123,7 +123,7 @@
/obj/proc/updateUsrDialog()
if((obj_flags & IN_USE) && !(obj_flags & USES_TGUI))
var/is_in_use = FALSE
var/list/nearby = get_actual_viewers(1, src)
var/list/nearby = fov_viewers(1, src)
for(var/mob/M in nearby)
if ((M.client && M.machine == src))
is_in_use = TRUE
@@ -152,7 +152,7 @@
if(obj_flags & IN_USE)
var/is_in_use = FALSE
if(update_viewers)
for(var/mob/M in get_actual_viewers(1, src))
for(var/mob/M in fov_viewers(1, src))
if ((M.client && M.machine == src))
is_in_use = TRUE
src.interact(M)

View File

@@ -43,7 +43,7 @@
Snake = L
break
if(Snake)
alerted = get_actual_viewers(world.view,src)
alerted = fov_viewers(world.view,src)
..()
if(LAZYLEN(alerted))
egged = world.time + SNAKE_SPAM_TICKS

View File

@@ -130,7 +130,7 @@
// The crowd is pleased
// The delay is to making large crowds have a longer laster applause
var/delay_offset = 0
for(var/mob/M in get_actual_viewers(world.view, src))
for(var/mob/M in fov_viewers(world.view, src))
var/mob/living/carbon/human/C = M
if (ishuman(M))
addtimer(CALLBACK(C, /mob/.proc/emote, "clap"), delay_offset * 0.3)

View File

@@ -492,7 +492,7 @@
/obj/structure/bloodsucker/candelabrum/process()
if(!lit)
return
for(var/mob/living/carbon/human/H in get_actual_viewers(7, src))
for(var/mob/living/carbon/human/H in fov_viewers(7, src))
var/datum/antagonist/vassal/T = H.mind.has_antag_datum(ANTAG_DATUM_VASSAL)
if(AmBloodsucker(H) || T) //We dont want vassals or vampires affected by this
return

View File

@@ -19,7 +19,7 @@
if(!.)
return
// must have nobody around to see the cloak
for(var/mob/living/M in get_actual_viewers(9, owner) - owner)
for(var/mob/living/M in fov_viewers(9, owner) - owner)
to_chat(owner, "<span class='warning'>You may only vanish into the shadows unseen.</span>")
return FALSE
return TRUE

View File

@@ -169,7 +169,7 @@
vision_distance = notice_range, ignored_mobs = target) // Only people who AREN'T the target will notice this action.
// Warn Feeder about Witnesses...
var/was_unnoticed = TRUE
for(var/mob/living/M in get_actual_viewers(notice_range, owner) - owner - target)
for(var/mob/living/M in fov_viewers(notice_range, owner) - owner - target)
if(M.client && !M.silicon_privileges && !M.eye_blind && !M.mind.has_antag_datum(ANTAG_DATUM_BLOODSUCKER))
was_unnoticed = FALSE
break

View File

@@ -64,7 +64,7 @@
var/turf/T = get_turf(user)
if(T && T.lighting_object && T.get_lumcount()>= 0.1)
// B) Check for Viewers
for(var/mob/living/M in get_actual_viewers(world.view, get_turf(owner)) - owner)
for(var/mob/living/M in fov_viewers(world.view, get_turf(owner)) - owner)
if(M.client && !M.silicon_privileges && !M.eye_blind)
am_seen = TRUE
if (!M.mind.has_antag_datum(ANTAG_DATUM_BLOODSUCKER))

View File

@@ -64,7 +64,7 @@
to_chat(owner, "<span class='warning'>Your victim's eyes are glazed over. They cannot perceive you.</span>")
return FALSE
// Check: Target See Me? (behind wall)
if(!(owner in target.visible_atoms()))
if(!(owner in target.fov_view()))
// Sub-Check: GET CLOSER
//if (!(owner in range(target_range, get_turf(target)))
// if (display_error)
@@ -137,7 +137,7 @@
if(istype(target) && success)
target.notransform = FALSE
REMOVE_TRAIT(target, TRAIT_COMBAT_MODE_LOCKED, src)
if(istype(L) && target.stat == CONSCIOUS && (target in L.visible_atoms(10))) // They Woke Up! (Notice if within view)
if(istype(L) && target.stat == CONSCIOUS && (target in L.fov_view(10))) // They Woke Up! (Notice if within view)
to_chat(L, "<span class='warning'>[target] has snapped out of their trance.</span>")

View File

@@ -1258,7 +1258,7 @@ GLOBAL_LIST_INIT(hallucination_list, list(
..()
if(!target.halbody)
var/list/possible_points = list()
for(var/turf/open/floor/F in target.visible_atoms(world.view))
for(var/turf/open/floor/F in target.fov_view(world.view))
possible_points += F
if(possible_points.len)
var/turf/open/floor/husk_point = pick(possible_points)
@@ -1289,7 +1289,7 @@ GLOBAL_LIST_INIT(hallucination_list, list(
set waitfor = FALSE
..()
var/list/turf/startlocs = list()
for(var/turf/open/T in target.visible_atoms(world.view+1)-view(world.view,target))
for(var/turf/open/T in target.fov_view(world.view+1)-view(world.view,target))
startlocs += T
if(!startlocs.len)
qdel(src)

View File

@@ -707,7 +707,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
//this is a mob verb instead of atom for performance reasons
//see /mob/verb/examinate() in mob.dm for more info
//overridden here and in /mob/living for different point span classes and sanity checks
/mob/dead/observer/pointed(atom/A as mob|obj|turf in visible_atoms())
/mob/dead/observer/pointed(atom/A as mob|obj|turf in fov_view())
if(!..())
return 0
usr.visible_message("<span class='deadsay'><b>[src]</b> points to [A].</span>")

View File

@@ -121,7 +121,7 @@ GLOBAL_LIST_INIT(dwarf_last, world.file2list("strings/names/dwarf_last.txt")) //
return
//Filth Reactions - Since miasma now exists
var/filth_counter = 0 //Holder for the filth check cycle, basically contains how much filth dwarf sees numerically.
for(var/fuck in owner.visible_atoms(7)) //hello byond for view loop.
for(var/fuck in owner.fov_view(7)) //hello byond for view loop.
if(istype(fuck, /mob/living/carbon/human))
var/mob/living/carbon/human/H = fuck
if(H.stat == DEAD || (HAS_TRAIT(H, TRAIT_FAKEDEATH)))

View File

@@ -379,7 +379,7 @@
stop_pulling()
//same as above
/mob/living/pointed(atom/A as mob|obj|turf in visible_atoms())
/mob/living/pointed(atom/A as mob|obj|turf in fov_view())
if(incapacitated())
return FALSE
if(HAS_TRAIT(src, TRAIT_DEATHCOMA))

View File

@@ -418,7 +418,7 @@
else
..()
/mob/living/simple_animal/bot/medbot/examinate(atom/A as mob|obj|turf in visible_atoms())
/mob/living/simple_animal/bot/medbot/examinate(atom/A as mob|obj|turf in fov_view())
..()
if(!is_blind(src))
chemscan(src, A)

View File

@@ -125,7 +125,7 @@
// This loop will, at most, loop twice.
for(var/atom/check in check_list)
for(var/mob/living/M in get_actual_viewers(world.view + 1, check) - src)
for(var/mob/living/M in fov_viewers(world.view + 1, check) - src)
if(M.client && CanAttack(M) && !M.silicon_privileges)
if(!M.eye_blind)
return M

View File

@@ -28,7 +28,7 @@
return 0
var/list/choices = list()
for(var/mob/living/C in visible_atoms(1,src))
for(var/mob/living/C in fov_view(1,src))
if(C!=src && Adjacent(C))
choices += C

View File

@@ -319,12 +319,12 @@ mob/visible_message(message, self_message, blind_message, vision_distance = DEFA
return
//view() but with a signal, to allow blacklisting some of the otherwise visible atoms.
/mob/proc/visible_atoms(dist = world.view)
/mob/proc/fov_view(dist = world.view)
. = view(dist, src)
SEND_SIGNAL(src, COMSIG_MOB_VISIBLE_ATOMS, .)
SEND_SIGNAL(src, COMSIG_MOB_FOV_VIEW, .)
//mob verbs are faster than object verbs. See https://secure.byond.com/forum/?post=1326139&page=2#comment8198716 for why this isn't atom/verb/examine()
/mob/verb/examinate(atom/A as mob|obj|turf in visible_atoms()) //It used to be oview(12), but I can't really say why
/mob/verb/examinate(atom/A as mob|obj|turf in fov_view()) //It used to be oview(12), but I can't really say why
set name = "Examine"
set category = "IC"
@@ -349,7 +349,7 @@ mob/visible_message(message, self_message, blind_message, vision_distance = DEFA
//note: ghosts can point, this is intended
//visible_message will handle invisibility properly
//overridden here and in /mob/dead/observer for different point span classes and sanity checks
/mob/verb/pointed(atom/A as mob|obj|turf in visible_atoms())
/mob/verb/pointed(atom/A as mob|obj|turf in fov_view())
set name = "Point To"
set category = "Object"

View File

@@ -127,7 +127,7 @@
/obj/singularity/narsie/mezzer()
for(var/mob/living/carbon/M in get_actual_viewers(consume_range, src))
for(var/mob/living/carbon/M in fov_viewers(consume_range, src))
if(M.stat == CONSCIOUS)
if(!iscultist(M))
to_chat(M, "<span class='cultsmall'>You feel conscious thought crumble away in an instant as you gaze upon [src.name]...</span>")

View File

@@ -433,7 +433,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
env.merge(removed)
air_update_turf()
for(var/mob/living/carbon/human/l in get_actual_viewers(HALLUCINATION_RANGE(power), src)) // If they can see it without mesons on. Bad on them.
for(var/mob/living/carbon/human/l in fov_viewers(HALLUCINATION_RANGE(power), src)) // If they can see it without mesons on. Bad on them.
if(!istype(l.glasses, /obj/item/clothing/glasses/meson))
var/D = sqrt(1 / max(1, get_dist(l, src)))
l.hallucination += power * config_hallucination_power * D
@@ -666,7 +666,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
//Some poor sod got eaten, go ahead and irradiate people nearby.
radiation_pulse(src, 3000, 2, TRUE)
var/list/viewers = get_actual_viewers(world.view, src)
var/list/viewers = fov_viewers(world.view, src)
for(var/mob/living/L in range(10))
investigate_log("has irradiated [key_name(L)] after consuming [AM].", INVESTIGATE_SUPERMATTER)
if(L in viewers)

View File

@@ -50,7 +50,7 @@
if(M == hal_target)
to_chat(hal_target, "<span class='userdanger'>[M] is hit by \a [src] in the chest!</span>")
hal_apply_effect()
else if(M in hal_target.visible_atoms())
else if(M in hal_target.fov_view())
to_chat(hal_target, "<span class='danger'>[M] is hit by \a [src] in the chest!!</span>")
if(damage_type == BRUTE)
var/splatter_dir = dir

View File

@@ -535,7 +535,7 @@
add_reagent(P, cached_results[P]*multiplier, null, chem_temp)
var/list/seen = get_actual_viewers(4, get_turf(my_atom))//Sound and sight checkers
var/list/seen = fov_viewers(4, get_turf(my_atom))//Sound and sight checkers
var/iconhtml = icon2html(cached_my_atom, seen)
if(cached_my_atom)
if(!ismob(cached_my_atom)) // No bubbling mobs

View File

@@ -99,7 +99,7 @@
* return UI_state The state of the UI.
**/
/mob/living/proc/shared_living_ui_distance(atom/movable/src_object)
if(!(src_object in visible_atoms())) // If the object is obscured, close it.
if(!(src_object in fov_view())) // If the object is obscured, close it.
return UI_CLOSE
var/dist = get_dist(src_object, src)

View File

@@ -12,7 +12,7 @@
if(isturf(A) || incapacitated()) // pretty annoying to wave your fist at floors and walls. And useless.
return TRUE
changeNext_move(CLICK_CD_RANGE)
var/list/target_viewers = get_actual_viewers(11, A) //doesn't check for blindness.
var/list/target_viewers = fov_viewers(11, A) //doesn't check for blindness.
if(!(src in target_viewers)) //click catcher issuing calls for out of view objects.
return TRUE
if(!has_active_hand())

View File

@@ -194,7 +194,7 @@ Creating a chem with a low purity will make you permanently fall in love with so
if (M.ckey == creatorID && creatorName == M.real_name)//If the creator drinks it, they fall in love randomly. If someone else drinks it, the creator falls in love with them.
if(M.has_status_effect(STATUS_EFFECT_INLOVE))//Can't be enthralled when enthralled, so to speak.
return
var/list/seen = (M.visible_atoms(M.client?.view || world.view) - M) | viewers(M.client?.view || world.view, M)
var/list/seen = (M.fov_view(M.client?.view || world.view) - M) | viewers(M.client?.view || world.view, M)
for(var/victim in seen)
if(ishuman(victim))
var/mob/living/carbon/V = victim
@@ -213,7 +213,7 @@ Creating a chem with a low purity will make you permanently fall in love with so
var/mob/living/carbon/C = get_mob_by_key(creatorID)
if(M.has_status_effect(STATUS_EFFECT_INLOVE))
return
if(C.client && (M in C.visible_atoms(C.client.view)))
if(C.client && (M in C.fov_view(C.client.view)))
M.reagents.del_reagent(type)
FallInLove(C, M)
return
@@ -279,7 +279,7 @@ Creating a chem with a low purity will make you permanently fall in love with so
if(HAS_TRAIT(M, TRAIT_MINDSHIELD))
return ..()
if(!M.has_status_effect(STATUS_EFFECT_INLOVE))
var/list/seen = (M.visible_atoms(M.client?.view || world.view) - M) | viewers(M.client?.view || world.view, M)
var/list/seen = (M.fov_view(M.client?.view || world.view) - M) | viewers(M.client?.view || world.view, M)
for(var/victim in seen)
if((isanimal(victim)) || (!isliving(victim)))
seen -= victim

View File

@@ -118,7 +118,7 @@
to_chat(M, "You find yourself unable to supress the desire to howl!")
M.emote("awoo")
if(prob(20))
var/list/seen = M.visible_atoms() - M //Sound and sight checkers
var/list/seen = M.fov_view() - M //Sound and sight checkers
for(var/victim in seen)
if(isanimal(victim) || !isliving(victim))
seen -= victim
@@ -139,7 +139,7 @@
to_chat(M, "You find yourself unable to supress the desire to howl!")
M.emote("awoo")
if(prob(5))
var/list/seen = M.visible_atoms() - M //Sound and sight checkers
var/list/seen = M.fov_view() - M //Sound and sight checkers
for(var/victim in seen)
if(isanimal(victim) || !isliving(victim))
seen -= victim