mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-22 03:27:46 +01:00
Improve two image cleanups
This commit is contained in:
@@ -171,7 +171,17 @@ note dizziness decrements automatically in the mob's Life() proc.
|
||||
|
||||
/mob/living/do_attack_animation(atom/A)
|
||||
..()
|
||||
is_floating = 0 // If we were without gravity, the bouncing animation got stopped, so we make sure we restart the bouncing after the next movement.
|
||||
//Check for clients with pref enabled
|
||||
var/list/viewing = list()
|
||||
for(var/m in viewers(A))
|
||||
var/mob/M = m
|
||||
var/client/C = M.client
|
||||
if(C && C.is_preference_enabled(/datum/client_preference/attack_icons))
|
||||
viewing += M.client
|
||||
|
||||
//Animals attacking each other in the distance, probably. Forgeddaboutit.
|
||||
if(!viewing.len)
|
||||
return FALSE
|
||||
|
||||
// What icon do we use for the attack?
|
||||
var/obj/used_item
|
||||
@@ -184,6 +194,9 @@ note dizziness decrements automatically in the mob's Life() proc.
|
||||
if(!used_item && !(attack_icon && attack_icon_state))
|
||||
return FALSE //Didn't find an item, not doing animation.
|
||||
|
||||
// If we were without gravity, the bouncing animation got stopped, so we make sure we restart the bouncing after the next movement.
|
||||
is_floating = 0
|
||||
|
||||
var/image/I
|
||||
|
||||
if(used_item) //Found an in-hand item to animate
|
||||
@@ -196,13 +209,7 @@ note dizziness decrements automatically in the mob's Life() proc.
|
||||
I = image(attack_icon, A, attack_icon_state, A.layer + 1)
|
||||
I.dir = dir
|
||||
|
||||
//Check for clients with pref enabled
|
||||
var/list/viewing = list()
|
||||
for(var/m in viewers(A))
|
||||
var/mob/M = m
|
||||
var/client/C = M.client
|
||||
if(C && C.is_preference_enabled(/datum/client_preference/attack_icons))
|
||||
viewing += M.client
|
||||
// Show the overlay to the clients
|
||||
flick_overlay(I, viewing, 5, TRUE) // 5 ticks/half a second
|
||||
|
||||
// Set the direction of the icon animation.
|
||||
|
||||
@@ -298,12 +298,16 @@ proc/get_radio_key_from_channel(var/channel)
|
||||
else
|
||||
return 1 //If we're in nullspace, then forget it.
|
||||
|
||||
//Remember the speech images so we can remove them later and they can get GC'd
|
||||
var/list/images_to_clients = list()
|
||||
|
||||
//The 'post-say' static speech bubble
|
||||
var/speech_bubble_test = say_test(message)
|
||||
//var/image/speech_bubble = image('icons/mob/talk_vr.dmi',src,"h[speech_bubble_test]") //VOREStation Edit. Commented this out in case we need to reenable.
|
||||
var/speech_type = speech_bubble_appearance()
|
||||
var/image/speech_bubble = image('icons/mob/talk_vr.dmi',src,"[speech_type][speech_bubble_test]") //VOREStation Edit - talk_vr.dmi instead of talk.dmi for right-side icons
|
||||
spawn(30) qdel(speech_bubble)
|
||||
images_to_clients[speech_bubble] = list()
|
||||
|
||||
|
||||
// Attempt Multi-Z Talking
|
||||
var/mob/above = src.shadow
|
||||
@@ -312,7 +316,7 @@ proc/get_radio_key_from_channel(var/channel)
|
||||
if(ST)
|
||||
var/list/results = get_mobs_and_objs_in_view_fast(ST, world.view)
|
||||
var/image/z_speech_bubble = image('icons/mob/talk_vr.dmi', above, "h[speech_bubble_test]") //VOREStation Edit - talk_vr.dmi instead of talk.dmi for right-side icons
|
||||
spawn(30) qdel(z_speech_bubble)
|
||||
images_to_clients[z_speech_bubble] = list()
|
||||
for(var/item in results["mobs"])
|
||||
if(item != above && !(item in listening))
|
||||
listening[item] = z_speech_bubble
|
||||
@@ -327,12 +331,17 @@ proc/get_radio_key_from_channel(var/channel)
|
||||
var/dst = get_dist(get_turf(M),get_turf(src))
|
||||
|
||||
if(dst <= message_range || (M.stat == DEAD && !forbid_seeing_deadchat)) //Inside normal message range, or dead with ears (handled in the view proc)
|
||||
M << (listening[M] || speech_bubble) // Send the image attached to shadow mob if available
|
||||
if(M.client)
|
||||
var/image/I1 = listening[M] || speech_bubble
|
||||
images_to_clients[I1] |= M.client
|
||||
M << I1
|
||||
M.hear_say(message, verb, speaking, alt_name, italics, src, speech_sound, sound_vol)
|
||||
|
||||
if(whispering) //Don't even bother with these unless whispering
|
||||
if(dst > message_range && dst <= w_scramble_range) //Inside whisper scramble range
|
||||
M << (listening[M] || speech_bubble) // Send the image attached to shadow mob if available
|
||||
if(M.client)
|
||||
var/image/I2 = listening[M] || speech_bubble
|
||||
images_to_clients[I2] |= M.client
|
||||
M << I2
|
||||
M.hear_say(stars(message), verb, speaking, alt_name, italics, src, speech_sound, sound_vol*0.2)
|
||||
if(dst > w_scramble_range && dst <= world.view) //Inside whisper 'visible' range
|
||||
M.show_message("<span class='game say'><span class='name'>[src.name]</span> [w_not_heard].</span>", 2)
|
||||
@@ -345,6 +354,16 @@ proc/get_radio_key_from_channel(var/channel)
|
||||
if(dst <= message_range)
|
||||
O.hear_talk(src, message, verb, speaking)
|
||||
|
||||
//Remove all those images. At least it's just ONE spawn this time.
|
||||
spawn(30)
|
||||
for(var/img in images_to_clients)
|
||||
var/image/I = img
|
||||
var/list/clients_from_image = images_to_clients[I]
|
||||
for(var/client in clients_from_image)
|
||||
var/client/C = client
|
||||
C.images -= I
|
||||
qdel(I)
|
||||
|
||||
//Log the message to file
|
||||
log_say("[name]/[key][whispering ? " (W)" : ""]: [message]")
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user