From bb79f34cf6964733d648f9c000e7ac9c35ee30c8 Mon Sep 17 00:00:00 2001
From: Lexanx <61974560+Lexanx@users.noreply.github.com>
Date: Mon, 12 Feb 2024 23:29:26 +0300
Subject: [PATCH] Feat: add IPC computer screen sharing and ability to use
flash drives (#723)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
# Описание
ИПС смогут через кнопку в абилити панели выводить изображение их
компьютера, на головной монитор. Другие через нажатие на ссылку в чате,
смогут видеть что показывает ИПС.
ИПС сможет вставлять и удалять флешку из своего компьютера в голове. Для
этого собственно нужна флешка, и нацелится на рот/голову
## Changelog
:cl:
rscadd: Добавлена возможность выводить изображение с экрана ИПСа, для
наблюдения окружающих.
rscadd: Добавлена возможность вставлять флешки в компьютер ИПСа
/:cl:
---
.../mob/living/carbon/human/examine.dm | 2 +-
code/modules/mob/living/carbon/human/human.dm | 5 ++
.../hardware/portable_hard_drive.dm | 10 ++++
code/modules/nano/interaction/default.dm | 11 +++-
.../carbon/human/machine_limb_functions.dm | 58 ++++++++++++++++++-
5 files changed, 81 insertions(+), 5 deletions(-)
diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm
index 3d1cb49747..2d5b3bceeb 100644
--- a/code/modules/mob/living/carbon/human/examine.dm
+++ b/code/modules/mob/living/carbon/human/examine.dm
@@ -168,7 +168,7 @@
msg += "[T.His] face is horribly mangled!\n"
if(species.species_flags & SPECIES_ALL_ROBOPARTS)
var/datum/robolimb/robohead = all_robolimbs[E.model]
- if(length(robohead.display_text) && f_style == "Text")
+ if(length(robohead.display_text) && (f_style == "Text" || f_style == "Database"))
msg += "Отображает на экране: [robohead.display_text]\n"
//splints
diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm
index 1d3add76ea..fe881940bc 100644
--- a/code/modules/mob/living/carbon/human/human.dm
+++ b/code/modules/mob/living/carbon/human/human.dm
@@ -557,6 +557,11 @@ GLOBAL_LIST_EMPTY(compatable_genomes_owners)
if(I)
src.examinate(I)
return TOPIC_HANDLED
+ if(href_list["showipcscreen"])
+ var/obj/item/modular_computer/ecs/S = locate(href_list["showipcscreen"])
+ if(S)
+ S.ui_interact(src)
+ return STATUS_UPDATE
return ..()
/mob/living/carbon/human/CanUseTopic(mob/user, datum/topic_state/state, href_list)
diff --git a/code/modules/modular_computers/hardware/portable_hard_drive.dm b/code/modules/modular_computers/hardware/portable_hard_drive.dm
index f35de05e7b..b0e646fd71 100644
--- a/code/modules/modular_computers/hardware/portable_hard_drive.dm
+++ b/code/modules/modular_computers/hardware/portable_hard_drive.dm
@@ -40,3 +40,13 @@
/obj/item/stock_parts/computer/hard_drive/portable/merchant/Initialize()
. = ..()
store_file(new/datum/computer_file/program/merchant(src))
+
+/obj/item/stock_parts/computer/hard_drive/portable/attack(var/mob/living/carbon/human/H, var/mob/living/user, target_zone, animate = TRUE)
+ if(H.is_species(SPECIES_IPC) && ishuman(user) && (user.zone_sel.selecting == BP_MOUTH || user.zone_sel.selecting == BP_HEAD))
+ var/obj/item/organ/internal/ecs/T = H.internal_organs_by_name[BP_EXONET]
+ if (do_after(user, 10, src))
+ user.visible_message( \
+ "\The [user] install's [src] into [H]'s exonet port.", \
+ "You have installed [src] into [H]'s exonet port." \
+ )
+ T.computer.try_install_component(user, src)
diff --git a/code/modules/nano/interaction/default.dm b/code/modules/nano/interaction/default.dm
index 722abd0911..1573fc7daf 100644
--- a/code/modules/nano/interaction/default.dm
+++ b/code/modules/nano/interaction/default.dm
@@ -95,7 +95,12 @@ GLOBAL_DATUM_INIT(default_state, /datum/topic_state/default, new)
. = min(., shared_living_nano_distance(src_object))
if(. == STATUS_UPDATE && (psi && !psi.suppressed && psi.get_rank(PSI_PSYCHOKINESIS) >= PSI_RANK_OPERANT))
return STATUS_INTERACTIVE
- if(is_species(SPECIES_IPC))
- var/obj/item/modular_computer/ecs/computer = src_object
- if(computer.type == /obj/item/modular_computer/ecs)
+ var/dist = get_dist(src_object, src)
+ var/obj/item/modular_computer/ecs/computer = src_object
+ if(computer.type == /obj/item/modular_computer/ecs)
+ if(is_species(SPECIES_IPC) && dist == 0)
return STATUS_INTERACTIVE
+ else if (dist <= 3)
+ return STATUS_UPDATE
+ else
+ return STATUS_CLOSE
diff --git a/infinity/code/modules/mob/living/carbon/human/machine_limb_functions.dm b/infinity/code/modules/mob/living/carbon/human/machine_limb_functions.dm
index ef23eba26b..adf9aa219b 100644
--- a/infinity/code/modules/mob/living/carbon/human/machine_limb_functions.dm
+++ b/infinity/code/modules/mob/living/carbon/human/machine_limb_functions.dm
@@ -1,5 +1,5 @@
/datum/species/machine
- inherent_verbs = list(/mob/living/carbon/human/proc/detach_limb, /mob/living/carbon/human/proc/attach_limb, /mob/living/carbon/human/proc/IPC_change_screen, /mob/living/carbon/human/proc/IPC_display_text, /mob/living/carbon/human/proc/IPC_toggle_off_screen, /mob/living/carbon/human/proc/enter_exonet)
+ inherent_verbs = list(/mob/living/carbon/human/proc/detach_limb, /mob/living/carbon/human/proc/attach_limb, /mob/living/carbon/human/proc/IPC_toggle_off_screen, /mob/living/carbon/human/proc/enter_exonet)
/mob/living/carbon/human/proc/detach_limb()
set category = "Abilities"
@@ -189,3 +189,59 @@
return
else
enter.exonet(src)
+ update_ipc_verbs()
+
+/mob/living/carbon/human/proc/show_exonet_screen()
+ set category = "Abilities"
+ set name = "Show Exonet Screen"
+ set desc = ""
+ var/obj/item/organ/external/head/R = src.get_organ(BP_HEAD)
+ var/obj/item/organ/internal/ecs/enter = src.internal_organs_by_name[BP_EXONET]
+ var/datum/robolimb/robohead = all_robolimbs[R.model]
+
+ if(R.is_stump() || R.is_broken() || !R)
+ return
+
+ if(!enter)
+ to_chat(usr, "You have no exonet connection port")
+ return
+ if(robohead.is_monitor)
+ var/obj/item/I = enter.computer
+ I.showscreen(src)
+ f_style = "Database"
+ update_hair()
+ else
+ to_chat(usr, "Your head has no screen!")
+
+/obj/item/proc/showscreen(mob/user)
+ for (var/mob/M in view(user))
+ M.show_message("[user] changes image on his screen. Take a closer look.",1)
+
+
+/mob/living/carbon/human/proc/update_ipc_verbs()
+ var/obj/item/organ/external/head/R = src.get_organ(BP_HEAD)
+ var/datum/robolimb/robohead = all_robolimbs[R.model]
+ var/obj/item/organ/internal/ecs/enter = src.internal_organs_by_name[BP_EXONET]
+ if(enter.computer.portable_drive)
+ src.verbs |= /mob/living/carbon/human/proc/ipc_eject_usb
+ else
+ src.verbs -= /mob/living/carbon/human/proc/ipc_eject_usb
+
+ if(robohead.is_monitor)
+ src.verbs |= /mob/living/carbon/human/proc/show_exonet_screen
+ src.verbs |= /mob/living/carbon/human/proc/IPC_change_screen
+ src.verbs |= /mob/living/carbon/human/proc/IPC_display_text
+ else
+ src.verbs -= /mob/living/carbon/human/proc/show_exonet_screen
+ src.verbs -= /mob/living/carbon/human/proc/IPC_change_screen
+ src.verbs -= /mob/living/carbon/human/proc/IPC_display_text
+
+
+
+/mob/living/carbon/human/proc/ipc_eject_usb()
+ set category = "Abilities"
+ set name = "Eject Data Crystal"
+ set desc = ""
+ var/obj/item/organ/internal/ecs/enter = src.internal_organs_by_name[BP_EXONET]
+ enter.computer.uninstall_component(usr, enter.computer.portable_drive)
+ update_ipc_verbs()