mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-30 02:52:30 +00:00
## About The Pull Request This moves Cyborgs onto using storage datums, removing the remenants of the shitcode that was Cyborg inventory. It's now done mostly by equipping/unequipping/storage items, much like how other mobs do. This allows borgs to take advantage of more hand support stuff and things like ``dropped()``, so borgs no longer have to copy paste drop code to ``cyborg_unequip`` It also: - Removes ``CYBORG_ITEM_TRAIT`` - Removes all borg items being ``NODROP`` https://github.com/user-attachments/assets/11442a10-3443-41f2-8c72-b38fb0126cdb ## Why It's Good For The Game Currently borgs are able to have their entire inventory open and a bag below it, which I thought was a little weird. I always assumed they WERE storage items, so I guess I'm doing it myself. Cyborgs using storage code makes it easier for contributors to actually do stuff with, without risking breaking everything. It also hopefully will make borg items more resilient against breaking in the future, now that we're not relying on nodrop. Also just brings them more in line with other mobs, all of which make use of storages. ## Changelog 🆑 refactor: Cyborg's modules now use storage (so opening a bag will close modules instead of overlap one over the other). qol: Observers can now see Cyborg's inventories (like they can for humans). /🆑 --------- Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
81 lines
2.1 KiB
Plaintext
81 lines
2.1 KiB
Plaintext
// Drone inventory procs
|
|
|
|
/mob/living/basic/drone/doUnEquip(obj/item/item_dropping, force, newloc, no_move, invdrop = TRUE, silent = FALSE)
|
|
if(..())
|
|
update_held_items()
|
|
if(item_dropping == head)
|
|
head = null
|
|
update_worn_head()
|
|
if(item_dropping == internal_storage)
|
|
internal_storage = null
|
|
update_inv_internal_storage()
|
|
return TRUE
|
|
return FALSE
|
|
|
|
|
|
/mob/living/basic/drone/can_equip(obj/item/item, slot, disable_warning = FALSE, bypass_equip_delay_self = FALSE, ignore_equipped = FALSE, indirect_action = FALSE)
|
|
switch(slot)
|
|
if(ITEM_SLOT_HEAD)
|
|
if(head)
|
|
return FALSE
|
|
if(!((item.slot_flags & ITEM_SLOT_HEAD) || (item.slot_flags & ITEM_SLOT_MASK)))
|
|
return FALSE
|
|
return TRUE
|
|
if(ITEM_SLOT_DEX_STORAGE)
|
|
if(internal_storage)
|
|
return FALSE
|
|
return TRUE
|
|
..()
|
|
|
|
|
|
/mob/living/basic/drone/get_item_by_slot(slot_id)
|
|
switch(slot_id)
|
|
if(ITEM_SLOT_HEAD)
|
|
return head
|
|
if(ITEM_SLOT_DEX_STORAGE)
|
|
return internal_storage
|
|
|
|
return ..()
|
|
|
|
/mob/living/basic/drone/get_slot_by_item(obj/item/looking_for)
|
|
if(internal_storage == looking_for)
|
|
return ITEM_SLOT_DEX_STORAGE
|
|
if(head == looking_for)
|
|
return ITEM_SLOT_HEAD
|
|
return ..()
|
|
|
|
/mob/living/basic/drone/equip_to_slot(obj/item/equipping, slot, initial = FALSE, redraw_mob = FALSE, indirect_action = FALSE)
|
|
if(!slot)
|
|
return
|
|
if(!istype(equipping))
|
|
return
|
|
|
|
var/index = get_held_index_of_item(equipping)
|
|
if(index)
|
|
held_items[index] = null
|
|
update_held_items()
|
|
|
|
if(equipping.pulledby)
|
|
equipping.pulledby.stop_pulling()
|
|
|
|
equipping.screen_loc = null // will get moved if inventory is visible
|
|
equipping.forceMove(src)
|
|
SET_PLANE_EXPLICIT(equipping, ABOVE_HUD_PLANE, src)
|
|
|
|
switch(slot)
|
|
if(ITEM_SLOT_HEAD)
|
|
head = equipping
|
|
update_worn_head()
|
|
if(ITEM_SLOT_DEX_STORAGE)
|
|
internal_storage = equipping
|
|
update_inv_internal_storage()
|
|
else
|
|
to_chat(src, span_danger("You are trying to equip this item to an unsupported inventory slot. Report this to a coder!"))
|
|
return
|
|
|
|
//Call back for item being equipped to drone
|
|
equipping.on_equipped(src, slot)
|
|
|
|
/mob/living/basic/drone/getBackSlot()
|
|
return ITEM_SLOT_DEX_STORAGE
|