critical
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user