[MIRROR] Fix nearsighted glasses being able to be neutered with quick swap (#1772)

* Fix nearsighted glasses being able to be neutered with quick swap (#54916)

You can no longer quick swap another pair of glasses with nearsighted to see perfectly.

Currently you can:

    Choose nearsighted
    Quick swap to another pair of glasses
    See perfectly

This wasn't fixed by Shaps' changes since those call dropped, which do not run through unequip code.
I know one of you is abusing this, show yourself!

* Fix nearsighted glasses being able to be neutered with quick swap

Co-authored-by: Jared-Fogle <35135081+Jared-Fogle@users.noreply.github.com>
This commit is contained in:
SkyratBot
2020-11-22 18:22:17 +00:00
committed by GitHub
co-authored by Jared-Fogle
parent aacccc22d0
commit 51fa2dfd84
4 changed files with 53 additions and 19 deletions
@@ -88,26 +88,30 @@
switch(slot)
if(ITEM_SLOT_BELT)
if (belt && swap)
belt.dropped(src, TRUE)
if (!temporarilyRemoveItemFromInventory(belt))
return
current_equip = belt
belt = I
update_inv_belt()
if(ITEM_SLOT_ID)
if (wear_id && swap)
wear_id.dropped(src, TRUE)
if (!temporarilyRemoveItemFromInventory(wear_id))
return
current_equip = wear_id
wear_id = I
sec_hud_set_ID()
update_inv_wear_id()
if(ITEM_SLOT_EARS)
if (ears && swap)
ears.dropped(src, TRUE)
if (!temporarilyRemoveItemFromInventory(ears))
return
current_equip = ears
ears = I
update_inv_ears()
if(ITEM_SLOT_EYES)
if (glasses && swap)
glasses.dropped(src, TRUE)
if (!temporarilyRemoveItemFromInventory(glasses))
return
current_equip = glasses
glasses = I
var/obj/item/clothing/glasses/G = I
@@ -122,25 +126,29 @@
update_inv_glasses()
if(ITEM_SLOT_GLOVES)
if (gloves && swap)
gloves.dropped(src, TRUE)
if (!temporarilyRemoveItemFromInventory(gloves))
return
current_equip = gloves
gloves = I
update_inv_gloves()
if(ITEM_SLOT_FEET)
if (shoes && swap)
shoes.dropped(src, TRUE)
if (!temporarilyRemoveItemFromInventory(shoes))
return
current_equip = shoes
shoes = I
update_inv_shoes()
if(ITEM_SLOT_OCLOTHING)
if (wear_suit && swap)
wear_suit.dropped(src, TRUE)
var/obj/item/s_store_backup = s_store
if (swap && wear_suit)
if (!temporarilyRemoveItemFromInventory(wear_suit))
return
current_equip = wear_suit
wear_suit = I
if (s_store && swap)
var/obj/item/s_store_backup = s_store
if (swap && s_store_backup)
dropItemToGround(s_store_backup)
put_in_inactive_hand(s_store_backup)
equip_to_slot_if_possible(s_store_backup, ITEM_SLOT_SUITSTORE)
@@ -154,7 +162,8 @@
update_inv_wear_suit()
if(ITEM_SLOT_ICLOTHING)
if (w_uniform && swap)
w_uniform.dropped(src, TRUE)
if (!temporarilyRemoveItemFromInventory(w_uniform))
return
current_equip = w_uniform
w_uniform = I
update_suit_sensors()
@@ -167,7 +176,8 @@
update_inv_pockets()
if(ITEM_SLOT_SUITSTORE)
if (s_store && swap)
s_store.dropped(src, TRUE)
if (!temporarilyRemoveItemFromInventory(s_store))
return
current_equip = s_store
s_store = I
update_inv_s_store()
+10 -4
View File
@@ -49,30 +49,36 @@
I.plane = ABOVE_HUD_PLANE
I.appearance_flags |= NO_CLIENT_COLOR
var/not_handled = FALSE
var/obj/item/current_equip
switch(slot)
if(ITEM_SLOT_BACK)
if (back && swap)
back.dropped(src, TRUE)
if (!temporarilyRemoveItemFromInventory(back))
return
current_equip = back
back = I
update_inv_back()
if(ITEM_SLOT_MASK)
if (wear_mask && swap)
wear_mask.dropped(src, TRUE)
if (!temporarilyRemoveItemFromInventory(wear_mask))
return
current_equip = wear_mask
wear_mask = I
wear_mask_update(I, toggle_off = 0)
if(ITEM_SLOT_HEAD)
if (head && swap)
head.dropped(src, TRUE)
if (!temporarilyRemoveItemFromInventory(head))
return
current_equip = head
head = I
SEND_SIGNAL(src, COMSIG_CARBON_EQUIP_HAT, I)
head_update(I)
if(ITEM_SLOT_NECK)
if (wear_neck && swap)
wear_neck.dropped(src, TRUE)
if (!temporarilyRemoveItemFromInventory(wear_neck))
return
current_equip = wear_neck
wear_neck = I
update_inv_neck(I)