mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-19 03:55:11 +01:00
[MIRROR] [READY] Adds notification support to modular computer apps, updates CIMS to use it (#1715)
* [READY] Adds notification support to modular computer apps, updates CIMS to use it * Update tgui.bundle.js Co-authored-by: zxaber <37497534+zxaber@users.noreply.github.com> Co-authored-by: Azarak <azarak10@gmail.com>
This commit is contained in:
@@ -263,6 +263,28 @@
|
||||
handle_power(delta_time) // Handles all computer power interaction
|
||||
//check_update_ui_need()
|
||||
|
||||
/**
|
||||
* Displays notification text alongside a soundbeep when requested to by a program.
|
||||
*
|
||||
* After checking tha the requesting program is allowed to send an alert, creates
|
||||
* a visible message of the requested text alongside a soundbeep. This proc adds
|
||||
* text to indicate that the message is coming from this device and the program
|
||||
* on it, so the supplied text should be the exact message and ending punctuation.
|
||||
*
|
||||
* Arguments:
|
||||
* The program calling this proc.
|
||||
* The message that the program wishes to display.
|
||||
*/
|
||||
|
||||
/obj/item/modular_computer/proc/alert_call(datum/computer_file/program/caller, alerttext, sound = 'sound/machines/twobeep_high.ogg')
|
||||
if(!caller || !caller.alert_able || caller.alert_silenced || !alerttext) //Yeah, we're checking alert_able. No, you don't get to make alerts that the user can't silence.
|
||||
return
|
||||
playsound(src, sound, 50, TRUE)
|
||||
visible_message("<span class='notice'>The [src] displays a [caller.filedesc] notification: [alerttext]</span>")
|
||||
var/mob/living/holder = loc
|
||||
if(istype(holder))
|
||||
to_chat(holder, "[icon2html(src)] <span class='notice'>The [src] displays a [caller.filedesc] notification: [alerttext]</span>")
|
||||
|
||||
// Function used by NanoUI's to obtain data for header. All relevant entries begin with "PC_"
|
||||
/obj/item/modular_computer/proc/get_header_data()
|
||||
var/list/data = list()
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
if(P in idle_threads)
|
||||
running = TRUE
|
||||
|
||||
data["programs"] += list(list("name" = P.filename, "desc" = P.filedesc, "running" = running, "icon" = P.program_icon))
|
||||
data["programs"] += list(list("name" = P.filename, "desc" = P.filedesc, "running" = running, "icon" = P.program_icon, "alert" = P.alert_pending))
|
||||
|
||||
data["has_light"] = has_light
|
||||
data["light_on"] = light_on
|
||||
@@ -148,6 +148,7 @@
|
||||
if(P in idle_threads)
|
||||
P.program_state = PROGRAM_STATE_ACTIVE
|
||||
active_program = P
|
||||
P.alert_pending = FALSE
|
||||
idle_threads.Remove(P)
|
||||
update_icon()
|
||||
return
|
||||
@@ -163,6 +164,7 @@
|
||||
return
|
||||
if(P.run_program(user))
|
||||
active_program = P
|
||||
P.alert_pending = FALSE
|
||||
update_icon()
|
||||
return 1
|
||||
|
||||
|
||||
@@ -52,3 +52,9 @@
|
||||
|
||||
/obj/item/modular_computer/processor/attack_ghost(mob/user)
|
||||
ui_interact(user)
|
||||
|
||||
/obj/item/modular_computer/processor/alert_call(datum/computer_file/program/caller, alerttext)
|
||||
if(!caller || !caller.alert_able || caller.alert_silenced || !alerttext)
|
||||
return
|
||||
playsound(src, 'sound/machines/twobeep_high.ogg', 50, TRUE)
|
||||
machinery_computer.visible_message("<span class='notice'>The [src] displays a [caller.filedesc] notification: [alerttext]</span>")
|
||||
|
||||
@@ -130,6 +130,13 @@
|
||||
borgo.toggle_headlamp(FALSE, TRUE)
|
||||
return TRUE
|
||||
|
||||
/obj/item/modular_computer/tablet/integrated/alert_call(datum/computer_file/program/caller, alerttext, sound = 'sound/machines/twobeep_high.ogg')
|
||||
if(!caller || !caller.alert_able || caller.alert_silenced || !alerttext) //Yeah, we're checking alert_able. No, you don't get to make alerts that the user can't silence.
|
||||
return
|
||||
borgo.playsound_local(src, sound, 50, TRUE)
|
||||
to_chat(borgo, "<span class='notice'>The [src] displays a [caller.filedesc] notification: [alerttext]</span>")
|
||||
|
||||
|
||||
/obj/item/modular_computer/tablet/integrated/syndicate
|
||||
icon_state = "tablet-silicon-syndicate"
|
||||
device_theme = "syndicate"
|
||||
|
||||
Reference in New Issue
Block a user