From c2577638efcc714d4ba64ab420f2db8a94d901f4 Mon Sep 17 00:00:00 2001 From: texan-down-under <73374039+etherware-novice@users.noreply.github.com> Date: Thu, 15 Dec 2022 04:53:00 -0600 Subject: [PATCH] Refactors to add directly to desc less (#71996) ## About The Pull Request Refactors some of the desc += calls to instead use examine() additions ## Why It's Good For The Game There were a few parts in the code where the description was directly written to after an action, where that extra note is information on the status of the item. Moving it to examine() lets you call those procs multiple time without worry and makes it look more consistent to players (extra item info displayed as notice/warning spans under desc) ## Changelog :cl: refactor: moved some description edits to examine hooks /:cl: Co-authored-by: etherware-novice --- code/game/machinery/doors/windowdoor.dm | 6 +++++- code/game/objects/items/devices/radio/encryptionkey.dm | 7 ++----- code/game/objects/items/storage/book.dm | 9 +++++++-- code/game/objects/items/storage/lockbox.dm | 6 +++++- .../antagonists/traitor/objectives/eyesnatching.dm | 6 +++++- 5 files changed, 24 insertions(+), 10 deletions(-) diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index d31db259d6c..4346272b2a3 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -277,9 +277,13 @@ playsound(src, SFX_SPARKS, 75, TRUE, SHORT_RANGE_SOUND_EXTRARANGE) sleep(0.6 SECONDS) operating = FALSE - desc += "
[span_warning("Its access panel is smoking slightly.")]" open(2) +/obj/machinery/door/window/examine(mob/user) + . = ..() + if(obj_flags & EMAGGED) + . += span_warning("Its access panel is smoking slightly.") + /obj/machinery/door/window/screwdriver_act(mob/living/user, obj/item/tool) . = ..() if(flags_1 & NODECONSTRUCT_1) diff --git a/code/game/objects/items/devices/radio/encryptionkey.dm b/code/game/objects/items/devices/radio/encryptionkey.dm index 4b50ee9d8e0..1ad33aa3c73 100644 --- a/code/game/objects/items/devices/radio/encryptionkey.dm +++ b/code/game/objects/items/devices/radio/encryptionkey.dm @@ -16,11 +16,6 @@ greyscale_config = /datum/greyscale_config/encryptionkey_basic greyscale_colors = "#820a16#3758c4" -/obj/item/encryptionkey/Initialize(mapload) - . = ..() - if(!channels.len && !translate_binary && !translated_language) - desc += " Has no special codes in it. You should probably tell a coder!" - /obj/item/encryptionkey/examine(mob/user) . = ..() if(LAZYLEN(channels) || translate_binary) @@ -32,6 +27,8 @@ examine_text_list += "[GLOB.channel_tokens[MODE_BINARY]] - [MODE_BINARY]" . += span_notice("It can access the following channels; [jointext(examine_text_list, ", ")].") + else + . += span_warning("Has no special codes in it. You should probably tell a coder!") /obj/item/encryptionkey/syndicate name = "syndicate encryption key" diff --git a/code/game/objects/items/storage/book.dm b/code/game/objects/items/storage/book.dm index 5e506a33bc3..172fdc9e85d 100644 --- a/code/game/objects/items/storage/book.dm +++ b/code/game/objects/items/storage/book.dm @@ -261,6 +261,7 @@ GLOBAL_LIST_INIT(bibleitemstates, list("bible", "koran", "scrapbook", "burning", attack_verb_continuous = list("attacks", "burns", "blesses", "damns", "scorches") attack_verb_simple = list("attack", "burn", "bless", "damn", "scorch") var/uses = 1 + var/ownername /obj/item/storage/book/bible/syndicate/attack_self(mob/living/carbon/human/H) if (uses) @@ -270,8 +271,12 @@ GLOBAL_LIST_INIT(bibleitemstates, list("bible", "koran", "scrapbook", "burning", playsound(src.loc, 'sound/effects/snap.ogg', 50, TRUE) H.apply_damage(5, BRUTE, pick(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM)) to_chat(H, span_notice("Your name appears on the inside cover, in blood.")) - var/ownername = H.real_name - desc += span_warning("The name [ownername] is written in blood inside the cover.") + ownername = H.real_name + +/obj/item/storage/book/bible/syndicate/examine(mob/user) + . = ..() + if(ownername) + . += span_warning("The name [ownername] is written in blood inside the cover.") /obj/item/storage/book/bible/syndicate/attack(mob/living/M, mob/living/carbon/human/user, heal_mode = TRUE) if (!user.combat_mode) diff --git a/code/game/objects/items/storage/lockbox.dm b/code/game/objects/items/storage/lockbox.dm index 72a6e33a824..56e2fb398cd 100644 --- a/code/game/objects/items/storage/lockbox.dm +++ b/code/game/objects/items/storage/lockbox.dm @@ -53,12 +53,16 @@ if(!broken) broken = TRUE atom_storage.locked = FALSE - desc += "It appears to be broken." icon_state = src.icon_broken if(user) visible_message(span_warning("\The [src] is broken by [user] with an electromagnetic card!")) return +/obj/item/storage/lockbox/examine(mob/user) + . = ..() + if(broken) + . += span_notice("It appears to be broken.") + /obj/item/storage/lockbox/Entered(atom/movable/arrived, atom/old_loc, list/atom/old_locs) . = ..() open = TRUE diff --git a/code/modules/antagonists/traitor/objectives/eyesnatching.dm b/code/modules/antagonists/traitor/objectives/eyesnatching.dm index d485983b603..bd23aa84fc4 100644 --- a/code/modules/antagonists/traitor/objectives/eyesnatching.dm +++ b/code/modules/antagonists/traitor/objectives/eyesnatching.dm @@ -217,9 +217,13 @@ if(prob(20)) victim.emote("cry") used = TRUE - desc += " It has been used up." update_appearance(UPDATE_ICON) +/obj/item/eyesnatcher/examine(mob/user) + . = ..() + if(used) + . += span_notice("It has been used up.") + /obj/item/eyesnatcher/proc/eyeballs_exist(obj/item/organ/internal/eyes/eyeballies, obj/item/bodypart/head/head, mob/living/carbon/human/victim) if(!eyeballies || QDELETED(eyeballies)) return FALSE