From 411486f7b46e482d7461ff46fe07d077cc965f63 Mon Sep 17 00:00:00 2001 From: ShadowLarkens Date: Tue, 15 Sep 2020 18:16:08 -0700 Subject: [PATCH] Move PDA to code/modules/pda --- code/modules/pda/app.dm | 106 ++++++++++++++++++ .../items/devices/PDA => modules/pda}/cart.dm | 0 .../devices/PDA => modules/pda}/cart_vr.dm | 0 .../devices/PDA => modules/pda}/chatroom.dm | 0 .../devices/PDA/PDA.dm => modules/pda/pda.dm} | 0 .../PDA/PDA_vr.dm => modules/pda/pda_vr.dm} | 0 .../devices/PDA => modules/pda}/radio.dm | 0 vorestation.dme | 13 ++- 8 files changed, 113 insertions(+), 6 deletions(-) create mode 100644 code/modules/pda/app.dm rename code/{game/objects/items/devices/PDA => modules/pda}/cart.dm (100%) rename code/{game/objects/items/devices/PDA => modules/pda}/cart_vr.dm (100%) rename code/{game/objects/items/devices/PDA => modules/pda}/chatroom.dm (100%) rename code/{game/objects/items/devices/PDA/PDA.dm => modules/pda/pda.dm} (100%) rename code/{game/objects/items/devices/PDA/PDA_vr.dm => modules/pda/pda_vr.dm} (100%) rename code/{game/objects/items/devices/PDA => modules/pda}/radio.dm (100%) diff --git a/code/modules/pda/app.dm b/code/modules/pda/app.dm new file mode 100644 index 0000000000..655bb891de --- /dev/null +++ b/code/modules/pda/app.dm @@ -0,0 +1,106 @@ +// Base class for anything that can show up on home screen +/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 + +/datum/data/pda/Destroy() + pda = null + return ..() + +/datum/data/pda/proc/start() + return + +/datum/data/pda/proc/stop() + return + +/datum/data/pda/proc/program_process() + return + +/datum/data/pda/proc/program_hit_check() + return + +/datum/data/pda/proc/notify(message, blink = 1) + if(message) + //Search for holder of the PDA. + var/mob/living/L = null + if(pda.loc && isliving(pda.loc)) + L = pda.loc + //Maybe they are a pAI! + else + L = get(pda, /mob/living/silicon) + + if(L) + to_chat(L, "[bicon(pda)] [message]") + SSnanoui.update_user_uis(L, pda) // Update the receiving user's PDA UI so that they can see the new message + + if(!notify_silent) + pda.play_ringtone() + + if(blink && !(src in pda.notifying_programs)) + pda.overlays += image('icons/obj/pda.dmi', "pda-r") + pda.notifying_programs |= src + +/datum/data/pda/proc/unnotify() + if(src in pda.notifying_programs) + pda.notifying_programs -= src + if(!pda.notifying_programs.len) + pda.overlays -= image('icons/obj/pda.dmi', "pda-r") + +// An app has a button on the home screen and its own UI +/datum/data/pda/app + name = "App" + size = 3 + var/title = null // what is displayed in the title bar when this is the current app + var/template = "" + var/update = PDA_APP_UPDATE + var/has_back = 0 + +/datum/data/pda/app/New() + if(!title) + title = name + +/datum/data/pda/app/start() + if(pda.current_app) + pda.current_app.stop() + pda.current_app = src + return 1 + +/datum/data/pda/app/proc/update_ui(mob/user as mob, list/data) + + +// Utilities just have a button on the home screen, but custom code when clicked +/datum/data/pda/utility + name = "Utility" + icon = "gear" + size = 1 + category = "Utilities" + + +/datum/data/pda/utility/scanmode + var/base_name + category = "Scanners" + +/datum/data/pda/utility/scanmode/New(obj/item/cartridge/C) + ..(C) + name = "Enable [base_name]" + +/datum/data/pda/utility/scanmode/start() + if(pda.scanmode) + pda.scanmode.name = "Enable [pda.scanmode.base_name]" + + if(pda.scanmode == src) + pda.scanmode = null + else + pda.scanmode = src + name = "Disable [base_name]" + + pda.update_shortcuts() + return 1 + +/datum/data/pda/utility/scanmode/proc/scan_mob(mob/living/C as mob, mob/living/user as mob) + +/datum/data/pda/utility/scanmode/proc/scan_atom(atom/A as mob|obj|turf|area, mob/user as mob) diff --git a/code/game/objects/items/devices/PDA/cart.dm b/code/modules/pda/cart.dm similarity index 100% rename from code/game/objects/items/devices/PDA/cart.dm rename to code/modules/pda/cart.dm diff --git a/code/game/objects/items/devices/PDA/cart_vr.dm b/code/modules/pda/cart_vr.dm similarity index 100% rename from code/game/objects/items/devices/PDA/cart_vr.dm rename to code/modules/pda/cart_vr.dm diff --git a/code/game/objects/items/devices/PDA/chatroom.dm b/code/modules/pda/chatroom.dm similarity index 100% rename from code/game/objects/items/devices/PDA/chatroom.dm rename to code/modules/pda/chatroom.dm diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/modules/pda/pda.dm similarity index 100% rename from code/game/objects/items/devices/PDA/PDA.dm rename to code/modules/pda/pda.dm diff --git a/code/game/objects/items/devices/PDA/PDA_vr.dm b/code/modules/pda/pda_vr.dm similarity index 100% rename from code/game/objects/items/devices/PDA/PDA_vr.dm rename to code/modules/pda/pda_vr.dm diff --git a/code/game/objects/items/devices/PDA/radio.dm b/code/modules/pda/radio.dm similarity index 100% rename from code/game/objects/items/devices/PDA/radio.dm rename to code/modules/pda/radio.dm diff --git a/vorestation.dme b/vorestation.dme index 6b5153f039..16816e2506 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -1157,12 +1157,6 @@ #include "code\game\objects\items\devices\communicator\messaging.dm" #include "code\game\objects\items\devices\communicator\phone.dm" #include "code\game\objects\items\devices\communicator\UI.dm" -#include "code\game\objects\items\devices\PDA\cart.dm" -#include "code\game\objects\items\devices\PDA\cart_vr.dm" -#include "code\game\objects\items\devices\PDA\chatroom.dm" -#include "code\game\objects\items\devices\PDA\PDA.dm" -#include "code\game\objects\items\devices\PDA\PDA_vr.dm" -#include "code\game\objects\items\devices\PDA\radio.dm" #include "code\game\objects\items\devices\radio\beacon.dm" #include "code\game\objects\items\devices\radio\electropack.dm" #include "code\game\objects\items\devices\radio\encryptionkey.dm" @@ -3071,6 +3065,13 @@ #include "code\modules\paperwork\photography.dm" #include "code\modules\paperwork\silicon_photography.dm" #include "code\modules\paperwork\stamps.dm" +#include "code\modules\pda\app.dm" +#include "code\modules\pda\cart.dm" +#include "code\modules\pda\cart_vr.dm" +#include "code\modules\pda\chatroom.dm" +#include "code\modules\pda\pda.dm" +#include "code\modules\pda\pda_vr.dm" +#include "code\modules\pda\radio.dm" #include "code\modules\persistence\filth.dm" #include "code\modules\persistence\graffiti.dm" #include "code\modules\persistence\noticeboard.dm"