Implements PDA Beeping (#15616)

This commit is contained in:
Fox McCloud
2021-02-27 13:30:59 -05:00
committed by GitHub
parent b107fa16d0
commit 204ceaac9e
19 changed files with 84 additions and 29 deletions
+14 -1
View File
@@ -31,6 +31,7 @@ GLOBAL_LIST_EMPTY(PDAs)
var/datum/data/pda/utility/scanmode/scanmode = null
var/lock_code = "" // Lockcode to unlock uplink
var/silent = FALSE //To beep or not to beep, that is the question
var/honkamt = 0 //How many honks left when infected with honk.exe
var/mimeamt = 0 //How many silence left when infected with mime.exe
var/detonate = 1 // Can the PDA be blown up?
@@ -67,6 +68,7 @@ GLOBAL_LIST_EMPTY(PDAs)
*/
/obj/item/pda/Initialize(mapload)
. = ..()
silent = TRUE // We don't want to hear the first program start up
GLOB.PDAs += src
GLOB.PDAs = sortAtom(GLOB.PDAs)
update_programs()
@@ -75,6 +77,7 @@ GLOBAL_LIST_EMPTY(PDAs)
cartridge.update_programs(src)
new /obj/item/pen(src)
start_program(find_program(/datum/data/pda/app/main_menu))
silent = initial(silent)
/obj/item/pda/proc/can_use()
if(!ismob(loc))
@@ -182,6 +185,7 @@ GLOBAL_LIST_EMPTY(PDAs)
id.forceMove(get_turf(src))
overlays -= image('icons/goonstation/objects/pda_overlay.dmi', id.icon_state)
id = null
playsound(src, 'sound/machines/terminal_eject.ogg', 50, TRUE)
/obj/item/pda/verb/verb_remove_id()
set category = "Object"
@@ -214,6 +218,7 @@ GLOBAL_LIST_EMPTY(PDAs)
var/obj/item/pen/O = locate() in src
if(O)
to_chat(user, "<span class='notice'>You remove the [O] from [src].</span>")
playsound(src, 'sound/machines/pda_button2.ogg', 50, TRUE)
if(istype(loc, /mob))
var/mob/M = loc
if(M.get_active_hand() == null)
@@ -243,6 +248,7 @@ GLOBAL_LIST_EMPTY(PDAs)
I.forceMove(src)
id = I
user.put_in_hands(old_id)
playsound(src, 'sound/machines/pda_button1.ogg', 50, TRUE)
return
/obj/item/pda/attackby(obj/item/C as obj, mob/user as mob, params)
@@ -257,11 +263,14 @@ GLOBAL_LIST_EMPTY(PDAs)
SStgui.update_uis(src)
if(cartridge.radio)
cartridge.radio.hostpda = src
playsound(src, 'sound/machines/pda_button1.ogg', 50, TRUE)
else if(istype(C, /obj/item/card/id))
var/obj/item/card/id/idcard = C
if(!idcard.registered_name)
to_chat(user, "<span class='notice'>\The [src] rejects the ID.</span>")
if(!silent)
playsound(src, 'sound/machines/terminal_error.ogg', 50, TRUE)
return
if(!owner)
owner = idcard.registered_name
@@ -270,6 +279,8 @@ GLOBAL_LIST_EMPTY(PDAs)
name = "PDA-[owner] ([ownjob])"
to_chat(user, "<span class='notice'>Card scanned.</span>")
SStgui.update_uis(src)
if(!silent)
playsound(src, 'sound/machines/terminal_success.ogg', 50, TRUE)
else
//Basic safety check. If either both objects are held by user or PDA is on ground and card is in hand.
if(((src in user.contents) && (C in user.contents)) || (istype(loc, /turf) && in_range(src, user) && (C in user.contents)) )
@@ -285,6 +296,7 @@ GLOBAL_LIST_EMPTY(PDAs)
pai = C
to_chat(user, "<span class='notice'>You slot \the [C] into [src].</span>")
SStgui.update_uis(src)
playsound(src, 'sound/machines/pda_button1.ogg', 50, TRUE)
else if(istype(C, /obj/item/pen))
var/obj/item/pen/O = locate() in src
if(O)
@@ -293,6 +305,7 @@ GLOBAL_LIST_EMPTY(PDAs)
user.drop_item()
C.forceMove(src)
to_chat(user, "<span class='notice'>You slide \the [C] into \the [src].</span>")
playsound(src, 'sound/machines/pda_button1.ogg', 50, TRUE)
else if(istype(C, /obj/item/nanomob_card))
if(cartridge && istype(cartridge, /obj/item/cartridge/mob_hunt_game))
cartridge.attackby(C, user, params)
@@ -345,7 +358,7 @@ GLOBAL_LIST_EMPTY(PDAs)
if(ttone in ttone_sound)
S = ttone_sound[ttone]
else
S = 'sound/machines/twobeep.ogg'
S = 'sound/machines/twobeep_high.ogg'
playsound(loc, S, 50, 1)
for(var/mob/O in hearers(3, loc))
O.show_message(text("[bicon(src)] *[ttone]*"))
+3 -3
View File
@@ -69,9 +69,9 @@
if(!can_use())
return
var/datum/data/pda/app/messenger/M = find_program(/datum/data/pda/app/messenger)
M.notify_silent = !M.notify_silent
to_chat(usr, "<span class='notice'>PDA ringer toggled [(M.notify_silent ? "Off" : "On")]!</span>")
silent = !silent
to_chat(usr, "<span class='notice'>PDA ringer toggled [(silent ? "Off" : "On")]!</span>")
/obj/item/pda/silicon/attack_self(mob/user as mob)
if((honkamt > 0) && (prob(60)))//For clown virus.
+6 -4
View File
@@ -2,7 +2,6 @@
/datum/data/pda
var/icon = "tasks" //options comes from http://fontawesome.io/icons/
var/notify_icon = "exclamation-circle"
var/notify_silent = 0
var/hidden = 0 // program not displayed in main menu
var/category = "General" // the category to list it in on the main menu
var/obj/item/pda/pda // if this is null, and the app is running code, something's gone wrong
@@ -37,7 +36,7 @@
to_chat(L, "[bicon(pda)] [message]")
SStgui.update_user_uis(L, pda) // Update the receiving user's PDA UI so that they can see the new message
if(!notify_silent)
if(!pda.silent)
pda.play_ringtone()
if(blink && !(src in pda.notifying_programs))
@@ -67,7 +66,9 @@
if(pda.current_app)
pda.current_app.stop()
pda.current_app = src
return 1
if(!pda.silent)
playsound(pda, 'sound/machines/terminal_select.ogg', 15, TRUE)
return TRUE
/datum/data/pda/app/proc/update_ui(mob/user, list/data)
return
@@ -80,7 +81,6 @@
size = 1
category = "Utilities"
/datum/data/pda/utility/scanmode
var/base_name
category = "Scanners"
@@ -100,6 +100,8 @@
name = "Disable [base_name]"
pda.update_shortcuts()
if(!pda.silent)
playsound(pda, 'sound/machines/terminal_select.ogg', 15, TRUE)
return TRUE
/datum/data/pda/utility/scanmode/proc/scan_mob(mob/living/C, mob/living/user)
+18
View File
@@ -16,6 +16,9 @@
if(..())
return
if(!pda.silent)
playsound(pda, 'sound/machines/terminal_select.ogg', 15, TRUE)
. = TRUE
switch(action)
if("Status")
@@ -78,6 +81,9 @@
. = TRUE
if(!pda.silent)
playsound(pda, 'sound/machines/terminal_select.ogg', 15, TRUE)
if(pda.cartridge && istype(pda.cartridge.radio, /obj/item/integrated_radio/signal))
var/obj/item/integrated_radio/signal/R = pda.cartridge.radio
@@ -110,6 +116,9 @@
if(..())
return
if(!pda.silent)
playsound(pda, 'sound/machines/terminal_select.ogg', 15, TRUE)
. = TRUE
// Observe
pm.ui_act(action, params, ui, state)
@@ -139,6 +148,9 @@
. = TRUE
if(!pda.silent)
playsound(pda, 'sound/machines/terminal_select.ogg', 15, TRUE)
switch(action)
if("Records")
var/datum/data/record/R = locateUID(params["target"])
@@ -252,6 +264,9 @@
if(..())
return
if(!pda.silent)
playsound(pda, 'sound/machines/terminal_select.ogg', 15, TRUE)
. = TRUE
// Aight listen up. Its time for a comment rant again.
@@ -333,6 +348,9 @@
if(..())
return
if(!pda.silent)
playsound(pda, 'sound/machines/terminal_select.ogg', 15, TRUE)
. = TRUE
// Heres the exact same shit as before, but worse
+8 -1
View File
@@ -28,6 +28,9 @@
pda.ownjob = pda.id.assignment
pda.ownrank = pda.id.rank
pda.name = "PDA-[pda.owner] ([pda.ownjob])"
if(!pda.silent)
playsound(pda, 'sound/machines/terminal_processing.ogg', 15, TRUE)
addtimer(CALLBACK(GLOBAL_PROC, .proc/playsound, pda, 'sound/machines/terminal_success.ogg', 15, TRUE), 1.3 SECONDS)
if("pai")
if(pda.pai)
if(pda.pai.loc != pda)
@@ -39,8 +42,9 @@
if(2) // Eject pAI device
var/turf/T = get_turf_or_move(pda.loc)
if(T)
pda.pai.loc = T
pda.pai.forceMove(T)
pda.pai = null
playsound(pda, 'sound/machines/terminal_eject.ogg', 50, TRUE)
/datum/data/pda/app/notekeeper
name = "Notekeeper"
@@ -61,6 +65,9 @@
if(..())
return
if(!pda.silent)
playsound(pda, 'sound/machines/terminal_select.ogg', 15, TRUE)
. = TRUE
switch(action)
+19 -2
View File
@@ -18,7 +18,7 @@
unnotify()
/datum/data/pda/app/messenger/update_ui(mob/user as mob, list/data)
data["silent"] = notify_silent // does the pda make noise when it receives a message?
data["silent"] = pda.silent // does the pda make noise when it receives a message?
data["toff"] = toff // is the messenger function turned off?
// Yes I know convo is awful, but it lets me stay inside the 80 char TGUI line limit
data["active_convo"] = active_conversation // Which conversation are we following right now?
@@ -64,12 +64,16 @@
unnotify()
var/play_beep = TRUE
. = TRUE
switch(action)
if("Toggle Messenger")
toff = !toff
if("Toggle Ringer")//If viewing texts then erase them, if not then toggle silent status
notify_silent = !notify_silent
pda.silent = !pda.silent
if("Clear")//Clears messages
if(params["option"] == "All")
tnote.Cut()
@@ -84,6 +88,7 @@
active_conversation = null
if("Message")
play_beep = FALSE
var/obj/item/pda/P = locateUID(params["target"])
create_message(usr, P)
if(params["target"] in conversations) // Need to make sure the message went through, if not welp.
@@ -108,6 +113,10 @@
if("Back")
active_conversation = null
if(play_beep && !pda.silent)
playsound(pda, 'sound/machines/terminal_select.ogg', 15, TRUE)
/datum/data/pda/app/messenger/proc/create_message(var/mob/living/U, var/obj/item/pda/P)
var/t = input(U, "Please enter message", name, null) as text|null
if(!t)
@@ -160,10 +169,14 @@
if(!sendable) // Are we in the range of a reciever?
to_chat(U, "<span class='warning'>ERROR: No connection to server.</span>")
if(!pda.silent)
playsound(pda, 'sound/machines/terminal_error.ogg', 15, TRUE)
return
if(!receivable) // Is our recipient in the range of a reciever?
to_chat(U, "<span class='warning'>ERROR: No connection to recipient.</span>")
if(!pda.silent)
playsound(pda, 'sound/machines/terminal_error.ogg', 15, TRUE)
return
if(useMS && sendable && receivable) // only send the message if its going to work
@@ -197,8 +210,12 @@
receiver = P
log_message = "[log_message] (no holder)"
U.create_log(MISC_LOG, log_message, receiver)
if(!pda.silent)
playsound(pda, 'sound/machines/terminal_success.ogg', 15, TRUE)
else
to_chat(U, "<span class='notice'>ERROR: Messaging server is not responding.</span>")
if(!pda.silent)
playsound(pda, 'sound/machines/terminal_error.ogg', 15, TRUE)
/datum/data/pda/app/messenger/proc/available_pdas()
var/list/names = list()
+1 -3
View File
@@ -34,9 +34,7 @@
. = ..(user, P)
if(.)
user.show_message("<span class='notice'>Virus sent!</span>", 1)
var/datum/data/pda/app/M = P.find_program(/datum/data/pda/app/messenger)
if(M)
M.notify_silent = 1
P.silent = TRUE
P.ttone = "silence"
+3
View File
@@ -156,6 +156,9 @@
if(..())
return
if(!pda.silent)
playsound(pda, 'sound/machines/terminal_select.ogg', 15, TRUE)
. = TRUE
switch(action)
if("Rename")
+6 -3
View File
@@ -93,14 +93,17 @@
P.unnotify()
cartridge = null
update_shortcuts()
if("Authenticate")//Checks for ID
playsound(src, 'sound/machines/terminal_eject.ogg', 50, TRUE)
if("Authenticate") //Checks for ID
id_check(usr, 1)
if("Ringtone")
if(!silent)
playsound(src, 'sound/machines/terminal_select.ogg', 15, TRUE)
return set_ringtone()
else
if(current_app)
. = current_app.ui_act(action, params, ui, state) // It needs proxying through down here so apps actually have their interacts called
if((honkamt > 0) && (prob(60)))//For clown virus.
if((honkamt > 0) && (prob(60))) //For clown virus.
honkamt--
playsound(loc, 'sound/items/bikehorn.ogg', 30, 1)
playsound(src, 'sound/items/bikehorn.ogg', 30, TRUE)
+2 -12
View File
@@ -45,12 +45,7 @@
default_cartridge = /obj/item/cartridge/mime
icon_state = "pda-mime"
ttone = "silence"
/obj/item/pda/mime/New()
..()
var/datum/data/pda/app/M = find_program(/datum/data/pda/app/messenger)
if(M)
M.notify_silent = 1
silent = TRUE
/obj/item/pda/heads
default_cartridge = /obj/item/cartridge/head
@@ -149,12 +144,7 @@
icon_state = "pda-library"
desc = "A portable microcomputer by Thinktronic Systems, LTD. This is model is a WGW-11 series e-reader."
model_name = "Thinktronic 5290 WGW-11 Series E-reader and Personal Data Assistant"
/obj/item/pda/librarian/New()
..()
var/datum/data/pda/app/M = find_program(/datum/data/pda/app/messenger)
if(M)
M.notify_silent = 1 //Quiet in the library!
silent = TRUE
/obj/item/pda/clear
icon_state = "pda-transp"
+4
View File
@@ -14,6 +14,8 @@
pda.overlays += image('icons/obj/pda.dmi', "pda-light")
else
pda.overlays -= image('icons/obj/pda.dmi', "pda-light")
if(!pda.silent)
playsound(pda, 'sound/machines/terminal_select.ogg', 15, TRUE)
/datum/data/pda/utility/honk
name = "Honk Synthesizer"
@@ -39,6 +41,8 @@
M.open()
else
M.close()
if(!pda.silent)
playsound(pda, 'sound/machines/terminal_select.ogg', 15, TRUE)
/datum/data/pda/utility/scanmode/medical
base_name = "Med Scanner"
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.