From 8cceefd2d776df83ac936db21a637a0a4b37fef7 Mon Sep 17 00:00:00 2001
From: larentoun <31931237+larentoun@users.noreply.github.com>
Date: Sun, 27 Oct 2024 02:16:38 +0300
Subject: [PATCH] Update examine panel a bit (#625)
## About The Pull Request
fixes https://github.com/ss220club/Bandastation/issues/494
---
.../code/examine_panel_component.dm | 34 +++++++++---------
.../examine_panel/code/examine_panel_mob.dm | 35 ++++++++++++++-----
.../packages/tgui/interfaces/ExaminePanel.tsx | 6 ++--
3 files changed, 47 insertions(+), 28 deletions(-)
diff --git a/modular_bandastation/examine_panel/code/examine_panel_component.dm b/modular_bandastation/examine_panel/code/examine_panel_component.dm
index 543f2d514144d..608687ea8659b 100644
--- a/modular_bandastation/examine_panel/code/examine_panel_component.dm
+++ b/modular_bandastation/examine_panel/code/examine_panel_component.dm
@@ -1,23 +1,22 @@
/datum/component/examine_panel
- dupe_mode = COMPONENT_DUPE_UNIQUE
- /// Mob that the examine panel belongs to.
- var/mob/living/holder
/// The screen containing the appearance of the mob
var/atom/movable/screen/map_view/examine_panel_screen/examine_panel_screen
/// Flavor text
var/flavor_text
-/datum/component/examine_panel/Initialize(use_prefs = FALSE)
- . = ..()
- if(!isliving(parent))
+/datum/component/examine_panel/Initialize(flavor_override)
+ if(!iscarbon(parent) && !issilicon(parent))
return COMPONENT_INCOMPATIBLE
- holder = parent
- if(!use_prefs)
+ if(flavor_override)
+ flavor_text = flavor_override
return
if(iscarbon(parent))
- flavor_text = holder.client?.prefs.read_preference(/datum/preference/text/flavor_text)
+ var/mob/living/carbon/carbon = parent
+ flavor_text = carbon.dna.features["flavor_text"]
+ return
if(issilicon(parent))
- flavor_text = holder.client?.prefs.read_preference(/datum/preference/text/silicon_flavor_text)
+ var/mob/living/silicon/silicon = parent
+ flavor_text = silicon.flavor_text
/datum/component/examine_panel/RegisterWithParent()
RegisterSignal(parent, COMSIG_ATOM_EXAMINE, PROC_REF(on_examine))
@@ -30,6 +29,7 @@
if(iscarbon(source))
examine_list += get_carbon_flavor_text(source)
+ return
if(issilicon(source))
examine_list += get_silicon_flavor_text(source)
@@ -41,9 +41,9 @@
var/face_obscured = (source.wear_mask && (source.wear_mask.flags_inv & HIDEFACE)) || (source.head && (source.head.flags_inv & HIDEFACE))
if (!(face_obscured))
- flavor_text_link = span_notice("[preview_text]... Look closer?")
+ flavor_text_link = span_notice("[preview_text]... Раскрыть описание")
else
- flavor_text_link = span_notice("Examine closely...")
+ flavor_text_link = span_notice("Раскрыть описание")
if (flavor_text_link)
return flavor_text_link
@@ -52,7 +52,7 @@
/// The first 1-FLAVOR_PREVIEW_LIMIT characters in the mob's client's silicon_flavor_text preference datum. FLAVOR_PREVIEW_LIMIT is defined in flavor_defines.dm.
var/preview_text = copytext_char(flavor_text, 1, FLAVOR_PREVIEW_LIMIT)
- flavor_text_link = span_notice("[preview_text]... Look closer?")
+ flavor_text_link = span_notice("[preview_text]... Раскрыть описание")
if (flavor_text_link)
return flavor_text_link
@@ -78,11 +78,11 @@
if(!examine_panel_screen)
examine_panel_screen = new
examine_panel_screen.name = "screen"
- examine_panel_screen.assigned_map = "examine_panel_[REF(holder)]_map"
+ examine_panel_screen.assigned_map = "examine_panel_[REF(parent)]_map"
examine_panel_screen.del_on_map_removal = FALSE
examine_panel_screen.screen_loc = "[examine_panel_screen.assigned_map]:1,1"
- var/mutable_appearance/current_mob_appearance = new(holder)
+ var/mutable_appearance/current_mob_appearance = new(parent)
current_mob_appearance.setDir(SOUTH)
current_mob_appearance.transform = matrix() // We reset their rotation, in case they're lying down.
@@ -110,9 +110,9 @@
if(ishuman(parent))
var/mob/living/carbon/human/holder_human = parent
obscured = (holder_human.wear_mask && (holder_human.wear_mask.flags_inv & HIDEFACE)) || (holder_human.head && (holder_human.head.flags_inv & HIDEFACE))
- tgui_flavor_text = obscured ? "Obscured" : flavor_text
+ tgui_flavor_text = obscured ? "Скрывает лицо" : flavor_text
- var/name = obscured ? "Unknown" : holder
+ var/name = obscured ? "Неизвестный" : parent
data["obscured"] = obscured ? TRUE : FALSE
data["character_name"] = name
diff --git a/modular_bandastation/examine_panel/code/examine_panel_mob.dm b/modular_bandastation/examine_panel/code/examine_panel_mob.dm
index b55a6eec0ded8..f98cab758567f 100644
--- a/modular_bandastation/examine_panel/code/examine_panel_mob.dm
+++ b/modular_bandastation/examine_panel/code/examine_panel_mob.dm
@@ -1,19 +1,38 @@
// TODO: Don't use prefs when spawned via admins
/mob/living/carbon/human/Login()
. = ..()
- AddComponent(/datum/component/examine_panel, use_prefs = TRUE)
+ AddComponent(/datum/component/examine_panel)
+
+/datum/dna/transfer_identity(mob/living/carbon/destination, transfer_SE, transfer_species)
+ if(!istype(destination))
+ return
+ . = ..()
+ destination.AddComponent(/datum/component/examine_panel)
+
+/mob/living/silicon
+ var/flavor_text
/mob/living/silicon/Login()
. = ..()
- AddComponent(/datum/component/examine_panel, use_prefs = TRUE)
+ if(!flavor_text)
+ flavor_text = client?.prefs.read_preference(/datum/preference/text/silicon_flavor_text)
+ AddComponent(/datum/component/examine_panel)
/mob/living/verb/change_flavor_text()
- set name = "Change flavor text"
+ set name = "Изменить описание"
set category = "IC"
- var/datum/component/examine_panel/examine_panel = GetComponent(/datum/component/examine_panel)
- if(!examine_panel)
- examine_panel = AddComponent(/datum/component/examine_panel)
- var/new_flavor_text = tgui_input_text(usr, "Enter new flavor text", "Changing Flavor Text", examine_panel.flavor_text)
+ var/new_flavor_text = tgui_input_text(usr, "Введите новое описание", "Изменение описания")
if(new_flavor_text)
- examine_panel.flavor_text = new_flavor_text
+ DEFAULT_QUEUE_OR_CALL_VERB(VERB_CALLBACK(src, PROC_REF(save_new_flavor_text), new_flavor_text))
+
+/mob/living/proc/save_new_flavor_text(new_flavor_text)
+ return
+
+/mob/living/carbon/save_new_flavor_text(new_flavor_text)
+ dna.features["flavor_text"] = new_flavor_text
+ AddComponent(/datum/component/examine_panel)
+
+/mob/living/silicon/save_new_flavor_text(new_flavor_text)
+ flavor_text = new_flavor_text
+ AddComponent(/datum/component/examine_panel)
diff --git a/tgui/packages/tgui/interfaces/ExaminePanel.tsx b/tgui/packages/tgui/interfaces/ExaminePanel.tsx
index 8dc853a13850a..38d8a10b3f128 100644
--- a/tgui/packages/tgui/interfaces/ExaminePanel.tsx
+++ b/tgui/packages/tgui/interfaces/ExaminePanel.tsx
@@ -15,11 +15,11 @@ export const ExaminePanel = (props) => {
const { act, data } = useBackend();
const { character_name, obscured, assigned_map, flavor_text } = data;
return (
-
+
-
+
{!obscured && (
)}
@@ -31,7 +31,7 @@ export const ExaminePanel = (props) => {