Skip to content

Commit

Permalink
Reenables taking info tags from corpses (#13987)
Browse files Browse the repository at this point in the history
* Reenables taking info tags from corpses

* reviews

* Update code/game/objects/items/cards_ids.dm

Co-authored-by: TiviPlus <[email protected]>

---------

Co-authored-by: TiviPlus <[email protected]>
  • Loading branch information
QualityVan and TiviPlus authored Sep 23, 2023
1 parent 1b9cd1d commit f949cc7
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 10 deletions.
3 changes: 2 additions & 1 deletion code/datums/elements/strippable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
10 changes: 9 additions & 1 deletion code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
42 changes: 36 additions & 6 deletions code/game/objects/items/cards_ids.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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)
. = ..()
Expand All @@ -317,23 +347,23 @@
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

/obj/item/dogtag/examine(mob/user)
. = ..()
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 = "<span class='notice'> 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 += ".</span>"

Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/inventory.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion code/modules/mob/living/carbon/human/inventory.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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!</span>"))
return
log_combat(src, M, "attempted to remove [key_name(I)] ([slot_to_process])")

Expand Down

0 comments on commit f949cc7

Please sign in to comment.