Fix posibrain whispering while muted

This commit is contained in:
Markolie
2017-02-08 22:12:59 +01:00
parent 8e0f2092ea
commit d7f8f68ff8
2 changed files with 37 additions and 30 deletions

View File

@@ -1,6 +1,6 @@
/obj/item/device/mmi/posibrain
name = "positronic brain"
desc = "A cube of shining metal, four inches to a side and covered in shallow grooves. The speaker switch is set to 'on'."
desc = "A cube of shining metal, four inches to a side and covered in shallow grooves."
icon = 'icons/obj/assemblies.dmi'
icon_state = "posibrain"
w_class = 3
@@ -15,11 +15,14 @@
var/silenced = 0 //if set to 1, they can't talk.
var/next_ping_at = 0
/obj/item/device/mmi/posibrain/examine(mob/user)
if(..(user, 1))
to_chat(user, "Its speaker is turned [silenced ? "off" : "on"].")
/obj/item/device/mmi/posibrain/attack_self(mob/user as mob)
/obj/item/device/mmi/posibrain/attack_self(mob/user)
if(brainmob && !brainmob.key && searching == 0)
//Start the process of searching for a new user.
to_chat(user, "\blue You carefully locate the manual activation switch and start the positronic brain's boot process.")
to_chat(user, "<span class='notice'>You carefully locate the manual activation switch and start the positronic brain's boot process.</span>")
icon_state = "posibrain-searching"
ghost_volunteers.Cut()
src.searching = 1
@@ -31,18 +34,10 @@
transfer_personality(O)
reset_search()
else
if(silenced)
silenced = 0
to_chat(user, "<span class='notice'>You toggle the speaker to 'on', on the [src].</span>")
desc = "A cube of shining metal, four inches to a side and covered in shallow grooves. The speaker switch is set to 'on'."
silenced = !silenced
to_chat(user, "<span class='notice'>You toggle the speaker [silenced ? "off" : "on"].</span>")
if(brainmob && brainmob.key)
to_chat(brainmob, "<span class='warning'>Your internal speaker has been toggled to 'on'.</span>")
else
silenced = 1
to_chat(user, "<span class='notice'>You toggle the speaker to 'off', on the [src].</span>")
desc = "A cube of shining metal, four inches to a side and covered in shallow grooves. The speaker switch is set to 'off'."
if(brainmob && brainmob.key)
to_chat(brainmob, "<span class='warning'>Your internal speaker has been toggled to 'off'.</span>")
to_chat(brainmob, "<span class='warning'>Your internal speaker has been toggled [silenced ? "off" : "on"].</span>")
/obj/item/device/mmi/posibrain/proc/request_player()
for(var/mob/dead/observer/O in player_list)

View File

@@ -1,24 +1,36 @@
//TODO: Convert this over for languages.
/mob/living/carbon/brain/say(var/message, var/datum/language/speaking = null)
if(silent)
if(!can_speak(warning = TRUE))
return
if(!(container && istype(container, /obj/item/device/mmi)))
return //No MMI, can't speak, bucko./N
else
if(container && istype(container, /obj/item/device/mmi/posibrain))
var/obj/item/device/mmi/posibrain/P = container
if(P && P.silenced)
to_chat(usr, "<span class='warning'>You cannot speak, as your internal speaker has been toggled to 'off'.</span>")
return
if(prob(emp_damage * 4))
if(prob(10))//10% chane to drop the message entirely
if(prob(10)) //10% chance to drop the message entirely
return
else
message = Gibberish(message, (emp_damage*6))//scrambles the message, gets worse when emp_damage is higher
..(message)
/mob/living/carbon/brain/whisper(message as text)
if(!can_speak(warning = TRUE))
return
..()
/mob/living/carbon/brain/can_speak(var/warning = FALSE)
. = ..()
if(!container)
. = FALSE
else if(!istype(container, /obj/item/device/mmi))
. = FALSE
else if(istype(container, /obj/item/device/mmi/posibrain))
var/obj/item/device/mmi/posibrain/P = container
if(P && P.silenced)
if(warning)
to_chat(usr, "<span class='warning'>You cannot speak, as your internal speaker is turned off.</span>")
. = FALSE
/mob/living/carbon/brain/handle_message_mode(var/message_mode, var/message, var/verb, var/speaking, var/used_radios, var/alt_name)
switch(message_mode)
if("headset")