Merge pull request #6840 from Neerti/qol_notification_sounds

QoL: Various Notifications
This commit is contained in:
Atermonera
2020-03-20 12:08:04 -07:00
committed by GitHub
31 changed files with 131 additions and 17 deletions
@@ -85,6 +85,7 @@
"ED-209" = "ed209",
"Beepsky" = "secbot"
)
var/last_revive_notification = null // world.time of last notification, used to avoid spamming players from defibs or cloners.
/mob/observer/dead/New(mob/body)
sight |= SEE_TURFS | SEE_MOBS | SEE_OBJS | SEE_SELF
@@ -137,6 +138,9 @@
var/mob/target = locate(href_list["track"]) in mob_list
if(target)
ManualFollow(target)
if(href_list["reenter"])
reenter_corpse()
return
/mob/observer/dead/attackby(obj/item/W, mob/user)
if(istype(W,/obj/item/weapon/book/tome))
@@ -805,3 +809,18 @@ mob/observer/dead/MayRespawn(var/feedback = 0)
/mob/observer/dead/speech_bubble_appearance()
return "ghost"
// Lets a ghost know someone's trying to bring them back, and for them to get into their body.
// Mostly the same as TG's sans the hud element, since we don't have TG huds.
/mob/observer/dead/proc/notify_revive(var/message, var/sound, flashwindow = TRUE)
if((last_revive_notification + 2 MINUTES) > world.time)
return
last_revive_notification = world.time
if(flashwindow)
window_flash(client)
if(message)
to_chat(src, "<span class='ghostalert'><font size=4>[message]</font></span>")
to_chat(src, "<span class='ghostalert'><a href=?src=[REF(src)];reenter=1>(Click to re-enter)</a></span>")
if(sound)
SEND_SOUND(src, sound(sound))
+35 -9
View File
@@ -1,6 +1,7 @@
/mob/living/silicon
var/datum/ai_laws/laws = null
var/list/additional_law_channels = list("State" = "")
var/last_law_notification = null // Avoids receiving 5+ of them at once.
/mob/living/silicon/proc/laws_sanity_check()
if (!src.laws)
@@ -9,54 +10,79 @@
/mob/living/silicon/proc/has_zeroth_law()
return laws.zeroth_law != null
/mob/living/silicon/proc/set_zeroth_law(var/law, var/law_borg)
/mob/living/silicon/proc/set_zeroth_law(var/law, var/law_borg, notify = TRUE)
laws_sanity_check()
laws.set_zeroth_law(law, law_borg)
if(notify)
notify_of_law_change(law||law_borg ? "NEW ZEROTH LAW: <b>[istype(src, /mob/living/silicon/robot) && law_borg ? law_borg : law]</b>" : null)
log_and_message_admins("has given [src] the zeroth laws: [law]/[law_borg ? law_borg : "N/A"]")
/mob/living/silicon/robot/set_zeroth_law(var/law, var/law_borg)
/mob/living/silicon/robot/set_zeroth_law(var/law, var/law_borg, notify = TRUE)
..()
if(tracking_entities)
to_chat(src, "<span class='warning'>Internal camera is currently being accessed.</span>")
/mob/living/silicon/proc/add_ion_law(var/law)
/mob/living/silicon/proc/add_ion_law(var/law, notify = TRUE)
laws_sanity_check()
laws.add_ion_law(law)
if(notify)
notify_of_law_change("NEW \[!ERROR!\] LAW: <b>[law]</b>")
log_and_message_admins("has given [src] the ion law: [law]")
/mob/living/silicon/proc/add_inherent_law(var/law)
/mob/living/silicon/proc/add_inherent_law(var/law, notify = TRUE)
laws_sanity_check()
laws.add_inherent_law(law)
if(notify)
notify_of_law_change("NEW CORE LAW: <b>[law]</b>")
log_and_message_admins("has given [src] the inherent law: [law]")
/mob/living/silicon/proc/add_supplied_law(var/number, var/law)
/mob/living/silicon/proc/add_supplied_law(var/number, var/law, notify = TRUE)
laws_sanity_check()
laws.add_supplied_law(number, law)
if(notify)
var/th = uppertext("[number]\th")
notify_of_law_change("NEW \[[th]\] LAW: <b>[law]</b>")
log_and_message_admins("has given [src] the supplied law: [law]")
/mob/living/silicon/proc/delete_law(var/datum/ai_law/law)
/mob/living/silicon/proc/delete_law(var/datum/ai_law/law, notify = TRUE)
laws_sanity_check()
laws.delete_law(law)
if(notify)
notify_of_law_change("LAW DELETED: <b>[law.law]</b>")
log_and_message_admins("has deleted a law belonging to [src]: [law.law]")
/mob/living/silicon/proc/clear_inherent_laws(var/silent = 0)
/mob/living/silicon/proc/clear_inherent_laws(var/silent = 0, notify = TRUE)
laws_sanity_check()
laws.clear_inherent_laws()
if(notify)
notify_of_law_change("CORE LAWS WIPED.")
if(!silent)
log_and_message_admins("cleared the inherent laws of [src]")
/mob/living/silicon/proc/clear_ion_laws(var/silent = 0)
/mob/living/silicon/proc/clear_ion_laws(var/silent = 0, notify = TRUE)
laws_sanity_check()
laws.clear_ion_laws()
if(notify)
notify_of_law_change("CORRUPTED LAWS WIPED.")
if(!silent)
log_and_message_admins("cleared the ion laws of [src]")
/mob/living/silicon/proc/clear_supplied_laws(var/silent = 0)
/mob/living/silicon/proc/clear_supplied_laws(var/silent = 0, notify = TRUE)
laws_sanity_check()
laws.clear_supplied_laws()
if(notify)
notify_of_law_change("NON-CORE LAWS WIPED.")
if(!silent)
log_and_message_admins("cleared the supplied laws of [src]")
/mob/living/silicon/proc/notify_of_law_change(message)
if((last_law_notification + 1 SECOND) > world.time)
return
last_law_notification = world.time
SEND_SOUND(src, 'sound/machines/defib_success.ogg')
window_flash(client)
to_chat(src, span("warning", message))
/mob/living/silicon/proc/statelaws(var/datum/ai_laws/laws)
var/prefix = ""
if(MAIN_CHANNEL == lawchannel)