Files
Bubberstation/code/modules/unit_tests/omnitools.dm
John Willard 3c1505ac06 Cyborgs now use storage datum (#90927)
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

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.

🆑
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>
2025-06-05 19:49:49 -04:00

33 lines
1.5 KiB
Plaintext

/datum/unit_test/omnitools/Run()
var/mob/living/silicon/robot/borg = allocate(__IMPLIED_TYPE__)
var/obj/structure/frame/machine/test_frame = allocate(__IMPLIED_TYPE__)
test_frame.state = FRAME_STATE_WIRED
//transform to engiborg
borg.model.transform_to(/obj/item/robot_model/engineering, forced = TRUE, transform = FALSE)
var/obj/item/borg/cyborg_omnitool/omnitool = null
for(var/obj/item/borg/tool as anything in borg.model.modules)
if(istype(tool, /obj/item/borg/cyborg_omnitool/engineering))
omnitool = tool
break
TEST_ASSERT_NOTNULL(omnitool, "Could not find /obj/item/borg/cyborg_omnitool/engineering in borg inbuilt modules!")
borg.put_in_hand(omnitool, 1)
borg.select_module(1)
//these must match
TEST_ASSERT_EQUAL(borg.get_active_held_item(), omnitool, "Borg held tool is not the selected omnitool!")
//Initialize the tool
omnitool.set_internal_tool(/obj/item/wirecutters/cyborg)
//Check the proxy attacker is of this type
var/obj/item/proxy = omnitool.get_proxy_attacker_for(test_frame, borg)
TEST_ASSERT_EQUAL(proxy.type, /obj/item/wirecutters/cyborg, "Omnitool proxy attacker [proxy.type] does not match selected type /obj/item/wirecutters/cyborg")
//Test the attack chain to see if the internal tool interacted correctly with the target
omnitool.melee_attack_chain(borg, test_frame)
TEST_ASSERT_EQUAL(test_frame.state, FRAME_STATE_EMPTY, "Machine frame's wires were not cut by the borg omnitool wirecutters!")
//unequip
borg.drop_all_held_items()