mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-22 05:25:15 +01:00
* Fixes #55112 - Swapping items no longer eats things (#55122) Quick swapping items no longer hides them in the mobs contents * Fixes #55112 - Swapping items no longer eats things Co-authored-by: Jared-Fogle <35135081+Jared-Fogle@users.noreply.github.com>
This commit is contained in:
@@ -199,8 +199,8 @@
|
||||
|
||||
|
||||
//Puts the item into our inactive hand if possible, returns TRUE on success
|
||||
/mob/proc/put_in_inactive_hand(obj/item/I)
|
||||
return put_in_hand(I, get_inactive_hand_index())
|
||||
/mob/proc/put_in_inactive_hand(obj/item/I, forced = FALSE)
|
||||
return put_in_hand(I, get_inactive_hand_index(), forced)
|
||||
|
||||
|
||||
//Puts the item our active hand if possible. Failing that it tries other hands. Returns TRUE on success.
|
||||
@@ -281,8 +281,8 @@
|
||||
* * Will pass FALSE if the item can not be dropped due to TRAIT_NODROP via doUnEquip()
|
||||
* If the item can be dropped, it will be forceMove()'d to the ground and the turf's Entered() will be called.
|
||||
*/
|
||||
/mob/proc/dropItemToGround(obj/item/I, force = FALSE, silent = FALSE)
|
||||
. = doUnEquip(I, force, drop_location(), FALSE, silent = silent)
|
||||
/mob/proc/dropItemToGround(obj/item/I, force = FALSE, silent = FALSE, invdrop = TRUE)
|
||||
. = doUnEquip(I, force, drop_location(), FALSE, invdrop = invdrop, silent = silent)
|
||||
if(. && I) //ensure the item exists and that it was dropped properly.
|
||||
I.pixel_x = I.base_pixel_x + rand(-6, 6)
|
||||
I.pixel_y = I.base_pixel_y + rand(-6, 6)
|
||||
|
||||
@@ -88,31 +88,31 @@
|
||||
switch(slot)
|
||||
if(ITEM_SLOT_BELT)
|
||||
if (belt && swap)
|
||||
if (!temporarilyRemoveItemFromInventory(belt))
|
||||
return
|
||||
current_equip = belt
|
||||
if (!dropItemToGround(belt))
|
||||
return
|
||||
belt = I
|
||||
update_inv_belt()
|
||||
if(ITEM_SLOT_ID)
|
||||
if (wear_id && swap)
|
||||
if (!temporarilyRemoveItemFromInventory(wear_id))
|
||||
return
|
||||
current_equip = wear_id
|
||||
if (!dropItemToGround(wear_id))
|
||||
return
|
||||
wear_id = I
|
||||
sec_hud_set_ID()
|
||||
update_inv_wear_id()
|
||||
if(ITEM_SLOT_EARS)
|
||||
if (ears && swap)
|
||||
if (!temporarilyRemoveItemFromInventory(ears))
|
||||
return
|
||||
current_equip = ears
|
||||
if (!dropItemToGround(ears))
|
||||
return
|
||||
ears = I
|
||||
update_inv_ears()
|
||||
if(ITEM_SLOT_EYES)
|
||||
if (glasses && swap)
|
||||
if (!temporarilyRemoveItemFromInventory(glasses))
|
||||
return
|
||||
current_equip = glasses
|
||||
if (!dropItemToGround(glasses))
|
||||
return
|
||||
glasses = I
|
||||
var/obj/item/clothing/glasses/G = I
|
||||
if(G.glass_colour_type)
|
||||
@@ -126,31 +126,31 @@
|
||||
update_inv_glasses()
|
||||
if(ITEM_SLOT_GLOVES)
|
||||
if (gloves && swap)
|
||||
if (!temporarilyRemoveItemFromInventory(gloves))
|
||||
return
|
||||
current_equip = gloves
|
||||
if (!dropItemToGround(gloves))
|
||||
return
|
||||
gloves = I
|
||||
update_inv_gloves()
|
||||
if(ITEM_SLOT_FEET)
|
||||
if (shoes && swap)
|
||||
if (!temporarilyRemoveItemFromInventory(shoes))
|
||||
return
|
||||
current_equip = shoes
|
||||
if (!dropItemToGround(shoes))
|
||||
return
|
||||
shoes = I
|
||||
update_inv_shoes()
|
||||
if(ITEM_SLOT_OCLOTHING)
|
||||
var/obj/item/s_store_backup = s_store
|
||||
|
||||
if (swap && wear_suit)
|
||||
if (!temporarilyRemoveItemFromInventory(wear_suit))
|
||||
return
|
||||
current_equip = wear_suit
|
||||
if (!dropItemToGround(wear_suit, invdrop = FALSE))
|
||||
return
|
||||
|
||||
wear_suit = I
|
||||
|
||||
if (swap && s_store_backup)
|
||||
dropItemToGround(s_store_backup)
|
||||
put_in_inactive_hand(s_store_backup)
|
||||
put_in_inactive_hand(s_store_backup, forced = TRUE)
|
||||
equip_to_slot_if_possible(s_store_backup, ITEM_SLOT_SUITSTORE)
|
||||
|
||||
if(I.flags_inv & HIDEJUMPSUIT)
|
||||
@@ -162,9 +162,9 @@
|
||||
update_inv_wear_suit()
|
||||
if(ITEM_SLOT_ICLOTHING)
|
||||
if (w_uniform && swap)
|
||||
if (!temporarilyRemoveItemFromInventory(w_uniform))
|
||||
return
|
||||
current_equip = w_uniform
|
||||
if (!dropItemToGround(w_uniform, invdrop = FALSE))
|
||||
return
|
||||
w_uniform = I
|
||||
update_suit_sensors()
|
||||
update_inv_w_uniform()
|
||||
@@ -176,16 +176,16 @@
|
||||
update_inv_pockets()
|
||||
if(ITEM_SLOT_SUITSTORE)
|
||||
if (s_store && swap)
|
||||
if (!temporarilyRemoveItemFromInventory(s_store))
|
||||
return
|
||||
current_equip = s_store
|
||||
if (!dropItemToGround(s_store))
|
||||
return
|
||||
s_store = I
|
||||
update_inv_s_store()
|
||||
else
|
||||
to_chat(src, "<span class='danger'>You are trying to equip this item to an unsupported inventory slot. Report this to a coder!</span>")
|
||||
|
||||
if (current_equip)
|
||||
put_in_active_hand(current_equip)
|
||||
put_in_hands(current_equip)
|
||||
|
||||
//Item is handled and in slot, valid to call callback, for this proc should always be true
|
||||
if(!not_handled)
|
||||
|
||||
@@ -55,31 +55,31 @@
|
||||
switch(slot)
|
||||
if(ITEM_SLOT_BACK)
|
||||
if (back && swap)
|
||||
if (!temporarilyRemoveItemFromInventory(back))
|
||||
return
|
||||
current_equip = back
|
||||
if (!dropItemToGround(back))
|
||||
return
|
||||
back = I
|
||||
update_inv_back()
|
||||
if(ITEM_SLOT_MASK)
|
||||
if (wear_mask && swap)
|
||||
if (!temporarilyRemoveItemFromInventory(wear_mask))
|
||||
return
|
||||
current_equip = wear_mask
|
||||
if (!dropItemToGround(wear_mask))
|
||||
return
|
||||
wear_mask = I
|
||||
wear_mask_update(I, toggle_off = 0)
|
||||
if(ITEM_SLOT_HEAD)
|
||||
if (head && swap)
|
||||
if (!temporarilyRemoveItemFromInventory(head))
|
||||
return
|
||||
current_equip = head
|
||||
if (!dropItemToGround(head))
|
||||
return
|
||||
head = I
|
||||
SEND_SIGNAL(src, COMSIG_CARBON_EQUIP_HAT, I)
|
||||
head_update(I)
|
||||
if(ITEM_SLOT_NECK)
|
||||
if (wear_neck && swap)
|
||||
if (!temporarilyRemoveItemFromInventory(wear_neck))
|
||||
return
|
||||
current_equip = wear_neck
|
||||
if (!dropItemToGround(wear_neck))
|
||||
return
|
||||
wear_neck = I
|
||||
update_inv_neck(I)
|
||||
if(ITEM_SLOT_HANDCUFFED)
|
||||
@@ -98,7 +98,7 @@
|
||||
not_handled = TRUE
|
||||
|
||||
if (current_equip)
|
||||
put_in_active_hand(current_equip)
|
||||
put_in_hands(current_equip)
|
||||
|
||||
//Item has been handled at this point and equipped callback can be safely called
|
||||
//We cannot call it for items that have not been handled as they are not yet correctly
|
||||
|
||||
Reference in New Issue
Block a user