From f949cc772b8a3a35221387ffe8edd6bb1bc01088 Mon Sep 17 00:00:00 2001 From: QualityVan Date: Sat, 23 Sep 2023 13:50:36 -0400 Subject: [PATCH] Reenables taking info tags from corpses (#13987) * Reenables taking info tags from corpses * reviews * Update code/game/objects/items/cards_ids.dm Co-authored-by: TiviPlus <57223640+TiviPlus@users.noreply.github.com> --------- Co-authored-by: TiviPlus <57223640+TiviPlus@users.noreply.github.com> --- code/datums/elements/strippable.dm | 3 +- code/game/objects/items.dm | 10 ++++- code/game/objects/items/cards_ids.dm | 42 ++++++++++++++++--- code/modules/mob/inventory.dm | 2 +- .../mob/living/carbon/human/inventory.dm | 1 - 5 files changed, 48 insertions(+), 10 deletions(-) diff --git a/code/datums/elements/strippable.dm b/code/datums/elements/strippable.dm index f3722933cce8e..e7a9b4080291e 100644 --- a/code/datums/elements/strippable.dm +++ b/code/datums/elements/strippable.dm @@ -136,7 +136,6 @@ if(ismob(source)) var/mob/mob_source = source if(!item.canStrip(user, mob_source)) - user.balloon_alert(user, "[item] is stuck!") return FALSE return TRUE @@ -278,6 +277,8 @@ /// A utility function for `/datum/strippable_item`s to finish unequipping an item from a mob. /datum/strippable_item/proc/finish_unequip_mob(obj/item/item, mob/source, mob/user) + if(item.special_stripped_behavior(user, source)) + return FALSE if(!source.dropItemToGround(item)) return FALSE diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 51ca72dedadb3..4b5d00c9e414c 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -676,8 +676,16 @@ GLOBAL_DATUM_INIT(welding_sparks_prepdoor, /mutable_appearance, mutable_appearan return storage_item.can_be_inserted(src, warning) +/// Checks whether the item can be unequipped from owner by stripper. Generates a message on failure and returns TRUE/FALSE /obj/item/proc/canStrip(mob/stripper, mob/owner) - return !(flags_item & NODROP) + if(flags_item & NODROP) + stripper.balloon_alert(stripper, "[src] is stuck!") + return FALSE + return TRUE + +/// Used by any item which wants to react to or prevent its own stripping, called after checks/delays. Return TRUE to block normal stripping behavior. +/obj/item/proc/special_stripped_behavior(mob/stripper, mob/owner) + return /obj/item/proc/update_item_sprites() switch(SSmapping.configs[GROUND_MAP].armor_style) diff --git a/code/game/objects/items/cards_ids.dm b/code/game/objects/items/cards_ids.dm index 983040c95f929..fc123ad2594a2 100644 --- a/code/game/objects/items/cards_ids.dm +++ b/code/game/objects/items/cards_ids.dm @@ -250,6 +250,36 @@ iff_signal = TGMC_LOYALIST_IFF var/dogtag_taken = FALSE +/obj/item/card/id/dogtag/update_icon_state() + if(dogtag_taken) + icon_state = initial(icon_state) + "_taken" + return + icon_state = initial(icon_state) + +/obj/item/card/id/dogtag/canStrip(mob/stripper, mob/owner) + . = ..() + if(!.) + return + if(dogtag_taken) + stripper.balloon_alert(stripper, "Info tag already taken") + return FALSE + if(owner.stat != DEAD) + stripper.balloon_alert(stripper, "[owner] isn't dead yet") + return FALSE + +/obj/item/card/id/dogtag/special_stripped_behavior(mob/stripper, mob/owner) + if(dogtag_taken) + return + stripper.balloon_alert(stripper, "Took info tag") + to_chat(stripper, span_notice("You take [owner]'s information tag, leaving the ID tag.")) + dogtag_taken = TRUE + update_icon() + var/obj/item/dogtag/info_tag = new() + info_tag.fallen_names = list(registered_name) + info_tag.fallen_assignments = list(assignment) + stripper.put_in_hands(info_tag) + return TRUE + // Vendor points for job override /obj/item/card/id/dogtag/smartgun marine_points = list( @@ -306,7 +336,7 @@ icon = 'icons/obj/items/card.dmi' w_class = WEIGHT_CLASS_TINY var/fallen_names[0] - var/fallen_assignements[0] + var/fallen_assignments[0] /obj/item/dogtag/attackby(obj/item/I, mob/user, params) . = ..() @@ -317,8 +347,8 @@ name = "information dog tags" if(D.fallen_names) fallen_names += D.fallen_names - if(D.fallen_assignements) - fallen_assignements += D.fallen_assignements + if(D.fallen_assignments) + fallen_assignments += D.fallen_assignments qdel(D) return TRUE @@ -326,14 +356,14 @@ . = ..() if(ishuman(user) && fallen_names && length(fallen_names)) if(length(fallen_names) == 1) - to_chat(user, span_notice("It reads: \"[fallen_names[1]] - [fallen_assignements[1]]\".")) + to_chat(user, span_notice("It reads: \"[fallen_names[1]] - [fallen_assignments[1]]\".")) else var/msg = " It reads: " for(var/x = 1 to length(fallen_names)) if (x == length(fallen_names)) - msg += "\"[fallen_names[x]] - [fallen_assignements[x]]\"" + msg += "\"[fallen_names[x]] - [fallen_assignments[x]]\"" else - msg += "\"[fallen_names[x]] - [fallen_assignements[x]]\", " + msg += "\"[fallen_names[x]] - [fallen_assignments[x]]\", " msg += "." diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index 4201550819c02..0856ed982b23b 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -129,7 +129,7 @@ * obj/item/W is the item you are trying to equip * del_on_fail if true will delete the item instead of dropping it to the floor - Returns TURE if it was able to put the thing into one of our hands. + Returns TRUE if it was able to put the thing into one of our hands. */ /mob/proc/put_in_hands(obj/item/W, del_on_fail = FALSE) W.do_pickup_animation(src) diff --git a/code/modules/mob/living/carbon/human/inventory.dm b/code/modules/mob/living/carbon/human/inventory.dm index 1017795586711..851dadcec05e5 100644 --- a/code/modules/mob/living/carbon/human/inventory.dm +++ b/code/modules/mob/living/carbon/human/inventory.dm @@ -533,7 +533,6 @@ /mob/living/carbon/human/stripPanelUnequip(obj/item/I, mob/M, slot_to_process) if(!I.canStrip(M)) - to_chat(src, span_warning("You can't remove [I.name], it appears to be stuck!")) return log_combat(src, M, "attempted to remove [key_name(I)] ([slot_to_process])")