Adds framework for equip delays and adds it to the straight jacket
This commit is contained in:
@@ -362,6 +362,9 @@
|
||||
if(M.equip_to_appropriate_slot(src))
|
||||
M.update_inv_hands()
|
||||
return TRUE
|
||||
else
|
||||
if(equip_delay_self)
|
||||
return
|
||||
|
||||
if(M.s_active && M.s_active.can_be_inserted(src,1)) //if storage active insert there
|
||||
M.s_active.handle_item_insertion(src)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/mob/living/carbon/human/can_equip(obj/item/I, slot, disable_warning = 0)
|
||||
return dna.species.can_equip(I, slot, disable_warning, src)
|
||||
/mob/living/carbon/human/can_equip(obj/item/I, slot, disable_warning = FALSE, bypass_equip_delay_self = FALSE)
|
||||
return dna.species.can_equip(I, slot, disable_warning, src, bypass_equip_delay_self)
|
||||
|
||||
// Return the item currently in the slot ID
|
||||
/mob/living/carbon/human/get_item_by_slot(slot_id)
|
||||
|
||||
@@ -765,7 +765,7 @@
|
||||
// handles the equipping of species-specific gear
|
||||
return
|
||||
|
||||
/datum/species/proc/can_equip(obj/item/I, slot, disable_warning, mob/living/carbon/human/H)
|
||||
/datum/species/proc/can_equip(obj/item/I, slot, disable_warning, mob/living/carbon/human/H, bypass_equip_delay_self = FALSE)
|
||||
if(slot in no_equip)
|
||||
if(!I.species_exception || !is_type_in_list(src, I.species_exception))
|
||||
return 0
|
||||
@@ -785,7 +785,7 @@
|
||||
return 0
|
||||
if(!H.get_bodypart("head"))
|
||||
return 0
|
||||
return 1
|
||||
return equip_delay_self_check(I, H, bypass_equip_delay_self)
|
||||
if(slot_neck)
|
||||
if(H.wear_neck)
|
||||
return 0
|
||||
@@ -797,13 +797,13 @@
|
||||
return 0
|
||||
if( !(I.slot_flags & SLOT_BACK) )
|
||||
return 0
|
||||
return 1
|
||||
return equip_delay_self_check(I, H, bypass_equip_delay_self)
|
||||
if(slot_wear_suit)
|
||||
if(H.wear_suit)
|
||||
return 0
|
||||
if( !(I.slot_flags & SLOT_OCLOTHING) )
|
||||
return 0
|
||||
return 1
|
||||
return equip_delay_self_check(I, H, bypass_equip_delay_self)
|
||||
if(slot_gloves)
|
||||
if(H.gloves)
|
||||
return 0
|
||||
@@ -811,7 +811,7 @@
|
||||
return 0
|
||||
if(num_arms < 2)
|
||||
return 0
|
||||
return 1
|
||||
return equip_delay_self_check(I, H, bypass_equip_delay_self)
|
||||
if(slot_shoes)
|
||||
if(H.shoes)
|
||||
return 0
|
||||
@@ -823,7 +823,7 @@
|
||||
if(!disable_warning)
|
||||
to_chat(H, "<span class='warning'>The footwear around here isn't compatible with your feet!</span>")
|
||||
return 0
|
||||
return 1
|
||||
return equip_delay_self_check(I, H, bypass_equip_delay_self)
|
||||
if(slot_belt)
|
||||
if(H.belt)
|
||||
return 0
|
||||
@@ -833,7 +833,7 @@
|
||||
return 0
|
||||
if( !(I.slot_flags & SLOT_BELT) )
|
||||
return
|
||||
return 1
|
||||
return equip_delay_self_check(I, H, bypass_equip_delay_self)
|
||||
if(slot_glasses)
|
||||
if(H.glasses)
|
||||
return 0
|
||||
@@ -841,7 +841,7 @@
|
||||
return 0
|
||||
if(!H.get_bodypart("head"))
|
||||
return 0
|
||||
return 1
|
||||
return equip_delay_self_check(I, H, bypass_equip_delay_self)
|
||||
if(slot_head)
|
||||
if(H.head)
|
||||
return 0
|
||||
@@ -849,7 +849,7 @@
|
||||
return 0
|
||||
if(!H.get_bodypart("head"))
|
||||
return 0
|
||||
return 1
|
||||
return equip_delay_self_check(I, H, bypass_equip_delay_self)
|
||||
if(slot_ears)
|
||||
if(H.ears)
|
||||
return 0
|
||||
@@ -857,13 +857,13 @@
|
||||
return 0
|
||||
if(!H.get_bodypart("head"))
|
||||
return 0
|
||||
return 1
|
||||
return equip_delay_self_check(I, H, bypass_equip_delay_self)
|
||||
if(slot_w_uniform)
|
||||
if(H.w_uniform)
|
||||
return 0
|
||||
if( !(I.slot_flags & SLOT_ICLOTHING) )
|
||||
return 0
|
||||
return 1
|
||||
return equip_delay_self_check(I, H, bypass_equip_delay_self)
|
||||
if(slot_wear_id)
|
||||
if(H.wear_id)
|
||||
return 0
|
||||
@@ -873,7 +873,7 @@
|
||||
return 0
|
||||
if( !(I.slot_flags & SLOT_ID) )
|
||||
return 0
|
||||
return 1
|
||||
return equip_delay_self_check(I, H, bypass_equip_delay_self)
|
||||
if(slot_l_store)
|
||||
if(I.flags & NODROP) //Pockets aren't visible, so you can't move NODROP items into them.
|
||||
return 0
|
||||
@@ -945,6 +945,12 @@
|
||||
return 0
|
||||
return 0 //Unsupported slot
|
||||
|
||||
/datum/species/proc/equip_delay_self_check(obj/item/I, mob/living/carbon/human/H, bypass_equip_delay_self)
|
||||
if(!I.equip_delay_self || bypass_equip_delay_self)
|
||||
return TRUE
|
||||
H.visible_message("<span class='notice'>[H] start putting on [I]...</span>", "<span class='notice'>You start putting on [I]...</span>")
|
||||
return do_after(H, I.equip_delay_self, target = H)
|
||||
|
||||
/datum/species/proc/before_equip_job(datum/job/J, mob/living/carbon/human/H)
|
||||
return
|
||||
|
||||
|
||||
@@ -669,7 +669,7 @@
|
||||
return
|
||||
|
||||
visible_message("<span class='notice'>[src] tries to put [what] on [who].</span>")
|
||||
if(do_mob(src, who, what.put_on_delay))
|
||||
if(do_mob(src, who, what.equip_delay_other))
|
||||
if(what && Adjacent(who) && what.mob_can_equip(who, src, final_where, TRUE))
|
||||
if(temporarilyRemoveItemFromInventory(what))
|
||||
if(where_list)
|
||||
|
||||
@@ -199,9 +199,9 @@
|
||||
//set qdel_on_fail to have it delete W if it fails to equip
|
||||
//set disable_warning to disable the 'you are unable to equip that' warning.
|
||||
//unset redraw_mob to prevent the mob from being redrawn at the end.
|
||||
/mob/proc/equip_to_slot_if_possible(obj/item/W, slot, qdel_on_fail = 0, disable_warning = 0, redraw_mob = 1)
|
||||
/mob/proc/equip_to_slot_if_possible(obj/item/W, slot, qdel_on_fail = FALSE, disable_warning = FALSE, redraw_mob = TRUE, bypass_equip_delay_self = FALSE)
|
||||
if(!istype(W)) return 0
|
||||
if(!W.mob_can_equip(src, null, slot, disable_warning))
|
||||
if(!W.mob_can_equip(src, null, slot, disable_warning, bypass_equip_delay_self))
|
||||
if(qdel_on_fail)
|
||||
qdel(W)
|
||||
else
|
||||
@@ -217,8 +217,9 @@
|
||||
return
|
||||
|
||||
//This is just a commonly used configuration for the equip_to_slot_if_possible() proc, used to equip people when the rounds tarts and when events happen and such.
|
||||
//Also bypasses equip delay checks, since the mob isn't actually putting it on.
|
||||
/mob/proc/equip_to_slot_or_del(obj/item/W, slot)
|
||||
return equip_to_slot_if_possible(W, slot, 1, 1, 0)
|
||||
return equip_to_slot_if_possible(W, slot, 1, 1, 0, 1)
|
||||
|
||||
//puts the item "W" into an appropriate slot in a human's inventory
|
||||
//returns 0 if it cannot, 1 if successful
|
||||
|
||||
Reference in New Issue
Block a user