mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Merge pull request #14235 from Heroman3003/inventory-fix
Fixes critical inventory equipment bug
This commit is contained in:
@@ -41,7 +41,7 @@ var/list/outfits_decls_by_type_
|
||||
var/l_hand = null
|
||||
// In the list(path=count,otherpath=count) format
|
||||
var/list/uniform_accessories = list() // webbing, armbands etc - fits in slot_tie
|
||||
var/list/backpack_contents = list()
|
||||
var/list/backpack_contents = list()
|
||||
|
||||
var/id_type
|
||||
var/id_desc
|
||||
|
||||
@@ -394,7 +394,7 @@ var/list/global/slot_flags_enumeration = list(
|
||||
//If you are making custom procs but would like to retain partial or complete functionality of this one, include a 'return ..()' to where you want this to happen.
|
||||
//Set disable_warning to 1 if you wish it to not give you outputs.
|
||||
//Should probably move the bulk of this into mob code some time, as most of it is related to the definition of slots and not item-specific
|
||||
/obj/item/proc/mob_can_equip(M as mob, slot, disable_warning = FALSE)
|
||||
/obj/item/proc/mob_can_equip(M as mob, slot, disable_warning = FALSE, var/ignore_obstruction = FALSE)
|
||||
if(!slot) return 0
|
||||
if(!M) return 0
|
||||
|
||||
@@ -420,7 +420,7 @@ var/list/global/slot_flags_enumeration = list(
|
||||
|
||||
//Next check if the slot is accessible.
|
||||
var/mob/_user = disable_warning? null : H
|
||||
if(!H.slot_is_accessible(slot, src, _user))
|
||||
if(!H.slot_is_accessible(slot, src, _user) && !ignore_obstruction)
|
||||
return 0
|
||||
|
||||
//Lastly, check special rules for the desired slot.
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
for (var/obj/item/weapon/grab/G in H.grabbed_by)
|
||||
if (G.loc == user && G.state >= GRAB_AGGRESSIVE)
|
||||
return TRUE
|
||||
|
||||
|
||||
return FALSE
|
||||
|
||||
/obj/item/weapon/tape_roll/attack(var/mob/living/carbon/human/H, var/mob/user)
|
||||
@@ -53,7 +53,7 @@
|
||||
return
|
||||
|
||||
user.visible_message("<span class='danger'>\The [user] has taped up \the [H]'s eyes!</span>")
|
||||
H.equip_to_slot_or_del(new /obj/item/clothing/glasses/sunglasses/blindfold/tape(H), slot_glasses)
|
||||
H.equip_to_slot_or_del(new /obj/item/clothing/glasses/sunglasses/blindfold/tape(H), slot_glasses, ignore_obstructions = FALSE)
|
||||
H.update_inv_glasses()
|
||||
playsound(src, 'sound/effects/tape.ogg',25)
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
|
||||
user.visible_message("<span class='danger'>\The [user] has taped up \the [H]'s mouth!</span>")
|
||||
|
||||
H.equip_to_slot_or_del(new /obj/item/clothing/mask/muzzle/tape(H), slot_wear_mask)
|
||||
H.equip_to_slot_or_del(new /obj/item/clothing/mask/muzzle/tape(H), slot_wear_mask, ignore_obstructions = FALSE)
|
||||
H.update_inv_wear_mask()
|
||||
playsound(src, 'sound/effects/tape.ogg',25)
|
||||
|
||||
|
||||
@@ -47,10 +47,10 @@ var/list/slot_equipment_priority = list( \
|
||||
//set del_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 as obj, slot, del_on_fail = 0, disable_warning = 0, redraw_mob = 1)
|
||||
/mob/proc/equip_to_slot_if_possible(obj/item/W as obj, slot, del_on_fail = 0, disable_warning = 0, redraw_mob = 1, ignore_obstructions = 1)
|
||||
if(!W)
|
||||
return 0
|
||||
if(!W.mob_can_equip(src, slot, disable_warning))
|
||||
if(!W.mob_can_equip(src, slot, disable_warning, ignore_obstructions))
|
||||
if(del_on_fail)
|
||||
qdel(W)
|
||||
|
||||
@@ -68,8 +68,8 @@ var/list/slot_equipment_priority = list( \
|
||||
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.
|
||||
/mob/proc/equip_to_slot_or_del(obj/item/W as obj, slot)
|
||||
return equip_to_slot_if_possible(W, slot, 1, 1, 0)
|
||||
/mob/proc/equip_to_slot_or_del(obj/item/W as obj, slot, ignore_obstructions = 1)
|
||||
return equip_to_slot_if_possible(W, slot, 1, 1, 0, ignore_obstructions)
|
||||
|
||||
//hurgh. these feel hacky, but they're the only way I could get the damn thing to work. I guess they could be handy for antag spawners too?
|
||||
/mob/proc/equip_voidsuit_to_slot_or_del_with_refit(obj/item/clothing/suit/space/void/W as obj, slot, species = SPECIES_HUMAN)
|
||||
|
||||
Reference in New Issue
Block a user