From 11ec2b89e0108f996bd83eddb6175f3d843492e9 Mon Sep 17 00:00:00 2001 From: shellspeed1 Date: Sat, 17 Sep 2022 02:40:37 -0700 Subject: [PATCH] borg pda --- code/__DEFINES/hud.dm | 3 ++ code/_onclick/hud/robot.dm | 40 +++++++++++++++++ code/game/objects/items/devices/PDA/PDA.dm | 45 +++++++++++++++++++ .../modules/mob/living/silicon/robot/robot.dm | 10 +++++ 4 files changed, 98 insertions(+) diff --git a/code/__DEFINES/hud.dm b/code/__DEFINES/hud.dm index 128f9120c6..88cba1c449 100644 --- a/code/__DEFINES/hud.dm +++ b/code/__DEFINES/hud.dm @@ -4,3 +4,6 @@ #define HUD_STYLE_NOHUD 3 //No hud (for screenshots) #define HUD_VERSIONS 3 //Used in show_hud(); Please ensure this is the same as the maximum index. + +#define ui_borg_pda_send "CENTER+5:21,SOUTH:5" // To the right of the alert panel +#define ui_borg_pda_log "CENTER+6:21,SOUTH:5" diff --git a/code/_onclick/hud/robot.dm b/code/_onclick/hud/robot.dm index 03ad1b1821..e20bae87d7 100644 --- a/code/_onclick/hud/robot.dm +++ b/code/_onclick/hud/robot.dm @@ -342,3 +342,43 @@ if(.) return robot.modularInterface?.interact(robot) + +//borg pda +/datum/hud/robot/New(mob/owner) + . = ..() + + var/atom/movable/screen/using + + //PDA message + using = new /atom/movable/screen/robot/pda_msg_send + using.screen_loc = ui_borg_pda_send + using.hud = src + static_inventory += using + + //PDA log + using = new /atom/movable/screen/robot/pda_msg_show + using.screen_loc = ui_borg_pda_log + using.hud = src + static_inventory += using + +/atom/movable/screen/robot/pda_msg_send + name = "PDA - Send Message" + icon = 'icons/mob/screen_ai.dmi' + icon_state = "pda_send" + +/atom/movable/screen/robot/pda_msg_send/Click() + if(..()) + return + var/mob/living/silicon/robot/R = usr + R.cmd_send_pdamesg(usr) + +/atom/movable/screen/robot/pda_msg_show + name = "PDA - Show Message Log" + icon = 'icons/mob/screen_ai.dmi' + icon_state = "pda_receive" + +/atom/movable/screen/robot/pda_msg_show/Click() + if(..()) + return + var/mob/living/silicon/robot/R = usr + R.cmd_show_message_log(usr) diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index 7fb1dd0065..5ff7bbc714 100644 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -1232,6 +1232,51 @@ GLOBAL_LIST_EMPTY(PDAs) continue . += P +//borg pda stuff +/mob/living/silicon/robot/proc/cmd_send_pdamesg(mob/user) + var/list/plist = list() + var/list/namecounts = list() + + if(aiPDA.toff) + to_chat(user, "Turn on your receiver in order to send messages.") + return + + for (var/obj/item/pda/P in get_viewable_pdas()) + if (P == src) + continue + else if (P == aiPDA) + continue + + plist[avoid_assoc_duplicate_keys(P.owner, namecounts)] = P + + var/c = input(user, "Please select a PDA") as null|anything in sortList(plist) + + if (!c) + return + + var/selected = plist[c] + + if(aicamera.stored.len) + var/add_photo = input(user,"Do you want to attach a photo?","Photo","No") as null|anything in list("Yes","No") + if(add_photo=="Yes") + var/datum/picture/Pic = aicamera.selectpicture(user) + aiPDA.picture = Pic + + if(incapacitated()) + return + + aiPDA.create_message(src, selected) + + +/mob/living/silicon/robot/proc/cmd_show_message_log(mob/user) + if(incapacitated()) + return + if(!isnull(aiPDA)) + var/HTML = "AI PDA Message Log[aiPDA.tnote]" + user << browse(HTML, "window=log;size=400x444;border=1;can_resize=1;can_close=1;can_minimize=0") + else + to_chat(user, "You do not have a PDA. You should make an issue report about this.") + #undef PDA_SCANNER_NONE #undef PDA_SCANNER_MEDICAL #undef PDA_SCANNER_FORENSICS diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 19847d9bdc..2392ee03e0 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -4,6 +4,7 @@ icon = 'icons/mob/robots.dmi' icon_state = "robot" bubble_icon = "robot" + var/obj/item/pda/ai/aiPDA /mob/living/silicon/robot/get_cell() return cell @@ -27,6 +28,12 @@ inv2 = new /atom/movable/screen/robot/module2() inv3 = new /atom/movable/screen/robot/module3() + if(!shell) + aiPDA = new/obj/item/pda/ai(src) + aiPDA.owner = real_name + aiPDA.ownjob = "Cyborg" + aiPDA.name = real_name + " (" + aiPDA.ownjob + ")" + previous_health = health if(ispath(cell)) @@ -968,6 +975,9 @@ notify_ai(RENAME, oldname, newname) if(!QDELETED(builtInCamera)) builtInCamera.c_tag = real_name + if(aiPDA && !shell) + aiPDA.owner = newname + aiPDA.name = newname + " (" + aiPDA.ownjob + ")" custom_name = newname