Runechat - stop bugging me for gods sake (#14141)

* Runechat - stop bugging me for gods sake

* Hotfix

* V2

* Patch 1

* Removes Radio

* Colour Sanity

* Fixes loc issues

* 2020-08-28

* LF --> CRLF

* Forgot this

* Fixes holopad stuffs

* Preference toggle existing!

* Drask + Kidan
This commit is contained in:
AffectedArc07
2020-10-26 14:10:09 +00:00
committed by GitHub
parent 4b1bf3d32a
commit ca29f5340e
22 changed files with 673 additions and 21 deletions
+3
View File
@@ -89,5 +89,8 @@
var/next_keysend_trip_reset = 0
var/keysend_tripped = FALSE
/// Messages currently seen by this client
var/list/seen_messages
// Last world.time that the player tried to request their resources.
var/last_ui_resource_send = 0
@@ -305,3 +305,11 @@
set desc = "Silence the current admin midi playing"
usr.stop_sound_channel(CHANNEL_ADMIN)
to_chat(src, "The current admin midi has been silenced")
/client/verb/toggle_runechat()
set name = "Enable/Disable Runechat"
set category = "Preferences"
set desc = "Toggle runechat messages"
prefs.toggles2 ^= PREFTOGGLE_2_RUNECHAT
to_chat(src, "You will [(prefs.toggles2 & PREFTOGGLE_2_RUNECHAT) ? "now see" : "no longer see"] floating chat messages.")
+18 -7
View File
@@ -3,7 +3,6 @@
/mob/proc/combine_message(var/list/message_pieces, var/verb, var/mob/speaker, always_stars = FALSE)
var/iteration_count = 0
var/msg = "" // This is to make sure that the pieces have actually added something
. = "[verb], \""
for(var/datum/multilingual_say_piece/SP in message_pieces)
iteration_count++
var/piece = SP.message
@@ -44,8 +43,10 @@
// There is literally no content left in this message, we need to shut this shit down
. = "" // hear_say will suppress it
else
. = trim(. + trim(msg))
. += "\""
if(verb)
. = "[verb], \"[trim(msg)]\""
else
. = trim(msg)
/mob/proc/hear_say(list/message_pieces, verb = "says", italics = 0, mob/speaker = null, sound/speech_sound, sound_vol, sound_frequency, use_voice = TRUE)
if(!client)
@@ -78,10 +79,11 @@
var/mob/living/carbon/human/H = speaker
speaker_name = H.GetVoice()
var/message = combine_message(message_pieces, verb, speaker)
var/message = combine_message(message_pieces, null, speaker)
if(message == "")
return
var/message_clean = message
if(italics)
message = "<i>[message]</i>"
@@ -101,13 +103,18 @@
else
to_chat(src, "<span class='name'>[speaker.name]</span> talks but you cannot hear [speaker.p_them()].")
else
to_chat(src, "<span class='game say'><span class='name'>[speaker_name]</span>[use_voice ? speaker.GetAltName() : ""] [track][message]</span>")
to_chat(src, "<span class='game say'><span class='name'>[speaker_name]</span>[speaker.GetAltName()] [track][verb], \"[message]\"</span>")
// Create map text message
if (client?.prefs.toggles2 & PREFTOGGLE_2_RUNECHAT) // can_hear is checked up there on L99
create_chat_message(speaker, message_clean, italics)
if(speech_sound && (get_dist(speaker, src) <= world.view && src.z == speaker.z))
var/turf/source = speaker? get_turf(speaker) : get_turf(src)
playsound_local(source, speech_sound, sound_vol, 1, sound_frequency)
/mob/proc/hear_radio(list/message_pieces, verb = "says", part_a, part_b, mob/speaker = null, hard_to_hear = 0, vname = "", atom/follow_target)
/mob/proc/hear_radio(list/message_pieces, verb = "says", part_a, part_b, mob/speaker = null, hard_to_hear = 0, vname = "", atom/follow_target, radio_freq)
if(!client)
return
@@ -171,7 +178,7 @@
to_chat(src, heard)
/mob/proc/hear_holopad_talk(list/message_pieces, verb = "says", mob/speaker = null)
/mob/proc/hear_holopad_talk(list/message_pieces, verb = "says", mob/speaker = null, obj/effect/overlay/holo_pad_hologram/H)
if(sleeping || stat == UNCONSCIOUS)
hear_sleep(multilingual_to_message(message_pieces))
return
@@ -180,10 +187,14 @@
return
var/message = combine_message(message_pieces, verb, speaker)
var/message_unverbed = combine_message(message_pieces, null, speaker)
var/name = speaker.name
if(!say_understands(speaker))
name = speaker.voice_name
if((client?.prefs.toggles2 & PREFTOGGLE_2_RUNECHAT) && can_hear())
create_chat_message(H, message_unverbed)
var/rendered = "<span class='game say'><span class='name'>[name]</span> [message]</span>"
to_chat(src, rendered)
@@ -1974,3 +1974,11 @@ Eyes need to have significantly high darksight to shine unless the mob has the X
/mob/living/carbon/human/proc/get_perceived_trauma()
return min(health, maxHealth - getStaminaLoss())
/**
* Helper to get the mobs runechat colour span
*
* Basically just a quick redirect to the DNA handler that gets the species-specific colour handler
*/
/mob/living/carbon/human/get_runechat_color()
return dna.species.get_species_runechat_color(src)
@@ -860,3 +860,18 @@ It'll return null if the organ doesn't correspond, so include null checks when u
var/obj/item/organ/internal/ears/ears = H.get_int_organ(/obj/item/organ/internal/ears)
if(istype(ears) && !ears.deaf)
. = TRUE
/**
* Species-specific runechat colour handler
*
* Checks the species datum flags and returns the appropriate colour
* Can be overridden on subtypes to short-circuit these checks (Example: Grey colour is eye colour)
* Arguments:
* * H - The human who this DNA belongs to
*/
/datum/species/proc/get_species_runechat_color(mob/living/carbon/human/H)
if(bodyflags & HAS_SKIN_COLOR)
return H.skin_colour
else
var/obj/item/organ/external/head/HD = H.get_organ("head")
return HD.hair_colour
@@ -61,3 +61,7 @@
"eyes" = /obj/item/organ/internal/eyes/drask, //5 darksight.
"brain" = /obj/item/organ/internal/brain/drask
)
/datum/species/drask/get_species_runechat_color(mob/living/carbon/human/H)
var/obj/item/organ/internal/eyes/E = H.get_int_organ(/obj/item/organ/internal/eyes)
return E.eye_colour
@@ -88,3 +88,7 @@
H.adjustFireLoss(1)
return TRUE
return ..()
/datum/species/grey/get_species_runechat_color(mob/living/carbon/human/H)
var/obj/item/organ/internal/eyes/E = H.get_int_organ(/obj/item/organ/internal/eyes)
return E.eye_colour
@@ -40,3 +40,8 @@
"is cracking their exoskeleton!",
"is stabbing themselves with their mandibles!",
"is holding their breath!")
/datum/species/kidan/get_species_runechat_color(mob/living/carbon/human/H)
var/obj/item/organ/internal/eyes/E = H.get_int_organ(/obj/item/organ/internal/eyes)
return E.eye_colour
+3
View File
@@ -1268,6 +1268,9 @@ GLOBAL_LIST_INIT(ai_verbs_default, list(
var/name_used = M.GetVoice()
//This communication is imperfect because the holopad "filters" voices and is only designed to connect to the master only.
var/rendered = "<i><span class='game say'>Relayed Speech: <span class='name'>[name_used]</span> [message]</span></i>"
if(client?.prefs.toggles2 & PREFTOGGLE_2_RUNECHAT)
var/message_clean = combine_message(message_pieces, null, M)
create_chat_message(M, message_clean)
show_message(rendered, 2)
/mob/living/silicon/ai/proc/malfhacked(obj/machinery/power/apc/apc)
+5 -1
View File
@@ -75,8 +75,12 @@
var/obj/machinery/hologram/holopad/T = current
if(istype(T) && T.masters[src])
var/obj/effect/overlay/holo_pad_hologram/H = T.masters[src]
if ((client?.prefs.toggles2 & PREFTOGGLE_2_RUNECHAT) && can_hear())
var/message = combine_message(message_pieces, null, src)
create_chat_message(H, message)
for(var/mob/M in hearers(T.loc))//The location is the object, default distance.
M.hear_holopad_talk(message_pieces, verb, src)
M.hear_holopad_talk(message_pieces, verb, src, H)
to_chat(src, "<i><span class='game say'>Holopad transmitted, <span class='name'>[real_name]</span> [combine_message(message_pieces, verb, src)]</span></i>")
else
to_chat(src, "No holopad connected.")