This commit is contained in:
Timothy Teakettle
2020-10-20 02:11:08 +01:00
parent 8e72c61d2d
commit 4afceebcc1
8 changed files with 32 additions and 13 deletions
+20 -1
View File
@@ -14,10 +14,29 @@
return legcuffed
return null
/mob/living/carbon/proc/equip_in_one_of_slots(obj/item/I, list/slots, qdel_on_fail = 1)
/mob/living/carbon/proc/equip_in_one_of_slots(obj/item/I, list/slots, qdel_on_fail = 1, critical = FALSE)
for(var/slot in slots)
if(equip_to_slot_if_possible(I, slots[slot], qdel_on_fail = 0, disable_warning = TRUE))
return slot
if(critical) //it is CRITICAL they get this item, no matter what
//do they have a backpack?
var/obj/item/backpack = get_item_by_slot(SLOT_BACK)
if(!backpack)
//nothing on their back
backpack = new /obj/item/storage/backpack(get_turf(src))
if(equip_to_slot(backpack, SLOT_BACK)) //worst-case-scenario, something that shouldnt wear a backpack gets one
I.forceMove(backpack)
return SLOT_BACK
else if(istype(backpack) && SEND_SIGNAL(backpack, COMSIG_CONTAINS_STORAGE))
//place it in here, regardless of storage capacity
I.forceMove(backpack)
return SLOT_BACK
else
//this should NEVER happen, but if it does, report it with the appropriate information
var/conclusion = qdel_on_fail ? "deleted" : "not moved, staying at current position [I.x], [I.y], [I.z]"
message_admins("User [src] failed to get item of critical importance: [I]. Result: item is [conclusion]")
//it's not dropped at their turf as this is generally un-safe for midround antags and we don't know their status
if(qdel_on_fail)
qdel(I)
return null