From fb2df9c3a228bf56dc7a04b9b0e86320d98c93dc Mon Sep 17 00:00:00 2001 From: Arkatos1 <43862960+Arkatos1@users.noreply.github.com> Date: Thu, 8 Jul 2021 21:51:17 +0200 Subject: [PATCH] Fix soapstone and engraved messages (#60055) This PR fixes and improves a few things regarding soapstones and engraved messages: - Observers can now interact with the engraved messages from any distance instead of having to be next to them to rate them, which was rather unintuitive and unnecessary. This also solves problems where admin observers were unable to delete them without being next to them or activating AI interact mode. - Fixed a case where you could make more engraved messages than your soapstone had uses by queing them fast enough. - Cleaned up engraved message UI code a little bit - removed an unnecessary section and replaced deprecated with . Looks practically the same. - Minor code improvements. --- code/modules/library/soapstone.dm | 13 +++++++++++-- .../tgui/interfaces/EngravedMessage.js | 19 +++++++++---------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/code/modules/library/soapstone.dm b/code/modules/library/soapstone.dm index 7eeef43fa5d..abf0ac95cb2 100644 --- a/code/modules/library/soapstone.dm +++ b/code/modules/library/soapstone.dm @@ -65,7 +65,7 @@ remove_use() /obj/item/soapstone/proc/can_use() - return remaining_uses == -1 || remaining_uses >= 0 + return remaining_uses == -1 || remaining_uses > 0 /obj/item/soapstone/proc/remove_use() if(remaining_uses <= 0) @@ -205,11 +205,16 @@ but only permanently removed with the curator's soapstone. if(persists) SSpersistence.SaveChiselMessage(src) SSpersistence.chisel_messages -= src - . = ..() + return ..() /obj/structure/chisel_message/interact() return +/obj/structure/chisel_message/ui_status(mob/user) + if(isobserver(user)) // ignore proximity restrictions if we're an observer + return UI_INTERACTIVE + return ..() + /obj/structure/chisel_message/ui_state(mob/user) return GLOB.always_state @@ -234,6 +239,10 @@ but only permanently removed with the curator's soapstone. data["admin_mode"] = TRUE data["creator_key"] = creator_key data["creator_name"] = creator_name + else + data["admin_mode"] = FALSE + data["creator_key"] = null + data["creator_name"] = null return data diff --git a/tgui/packages/tgui/interfaces/EngravedMessage.js b/tgui/packages/tgui/interfaces/EngravedMessage.js index 84928bd4de3..1db17834661 100644 --- a/tgui/packages/tgui/interfaces/EngravedMessage.js +++ b/tgui/packages/tgui/interfaces/EngravedMessage.js @@ -1,6 +1,6 @@ import { decodeHtmlEntities } from 'common/string'; import { useBackend } from '../backend'; -import { Box, Button, Grid, LabeledList, Section } from '../components'; +import { Box, Button, LabeledList, Section, Stack } from '../components'; import { Window } from '../layouts'; export const EngravedMessage = (props, context) => { @@ -30,8 +30,8 @@ export const EngravedMessage = (props, context) => { mb={2}> {decodeHtmlEntities(hidden_message)} - - + +