Skip to content

Commit

Permalink
Experimental perfomance fix for messages (#6239) [testmerge][da9559e]
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Dec 9, 2024
1 parent b816d1d commit 96e3dcc
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions code/modules/mob/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
// blind_message (optional) is what blind people will hear e.g. "You hear something!"
/mob/visible_message(message, self_message, blind_message, list/ignored_mobs, chat_message_type)
if(!isturf(loc)) // mobs inside objects (such as lockers) shouldn't have their actions visible to those outside the object
for(var/mob/mob as anything in (get_mobs_in_view(3, src, include_radio = FALSE) - ignored_mobs))
for(var/mob/mob as anything in viewers(3, src) - ignored_mobs)
if(mob.see_invisible < invisibility)
continue //can't view the invisible
var/msg = message
Expand All @@ -155,7 +155,7 @@
mob.show_message(msg, EMOTE_VISIBLE, blind_message, EMOTE_AUDIBLE, chat_message_type)
return

for(var/mob/mob as anything in (get_mobs_in_view(7, src, include_radio = FALSE) - ignored_mobs))
for(var/mob/mob as anything in viewers(7, src) - ignored_mobs)
if(mob.see_invisible < invisibility)
continue //can't view the invisible
var/msg = message
Expand All @@ -169,7 +169,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, self_message, blind_message, list/ignored_mobs)
for(var/mob/mob as anything in (get_mobs_in_view(7, src, include_radio = FALSE) - ignored_mobs))
for(var/mob/mob as anything in viewers(7, src) - ignored_mobs)
mob.show_message(message, EMOTE_VISIBLE, blind_message, EMOTE_AUDIBLE)


Expand All @@ -184,7 +184,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 viewers(range, src))
M.show_message(msg, EMOTE_AUDIBLE, deaf_message, EMOTE_VISIBLE)

// based on say code
Expand All @@ -211,7 +211,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 viewers(range, src))
M.show_message(message, EMOTE_AUDIBLE, deaf_message, EMOTE_VISIBLE)


Expand Down Expand Up @@ -638,7 +638,7 @@
return FALSE

/mob/proc/can_use_machinery(obj/machinery/mach)
return IsAdvancedToolUser()
return IsAdvancedToolUser()

/mob/proc/swap_hand()
return
Expand Down Expand Up @@ -673,7 +673,7 @@
var/mob/living/picked = tgui_input_list(usr, "Please select an NPC to respawn as", "Respawn as NPC", allowed_creatures)
if(!picked)
return

if(picked == "Mouse")
become_mouse()
return
Expand All @@ -684,7 +684,7 @@
if(QDELETED(picked_mob) || picked_mob.key || picked_mob.stat == DEAD)
to_chat(usr, span_warning("[capitalize(picked_mob)] is no longer available to respawn!"))
return

if(istype(picked_mob, /mob/living/simple_animal/borer))
var/mob/living/simple_animal/borer/borer = picked_mob
borer.transfer_personality(usr.client)
Expand All @@ -693,7 +693,7 @@
to_chat(usr, span_notify(message))
GLOB.respawnable_list -= usr
picked_mob.key = key


/mob/proc/become_mouse()
var/timedifference = world.time - client.time_joined_as_mouse
Expand Down

0 comments on commit 96e3dcc

Please sign in to comment.