Tool act superpack 2 (#64428)

About The Pull Request

Continuation of #64375, extracting tool behavior from attackby() and moving it into discrete _act procs. This is about as many files as I had in the last version, as I still want this to be reviewable.

As before, I've tested everything in game and it works as it previously did.
Why It's Good For The Game

The more code moved out of attackby, the more modular things become.
Changelog

cl
refactor: Moves more tool behavior out of attackby().
/cl
This commit is contained in:
Luc
2022-03-08 11:43:22 +13:00
committed by GitHub
parent 33eeba1e59
commit afc1e44ee2
23 changed files with 542 additions and 428 deletions
@@ -60,10 +60,7 @@
return TRUE
return FALSE
/obj/item/computer_hardware/ai_slot/attackby(obj/item/I, mob/living/user)
if(..())
return
if(I.tool_behaviour == TOOL_SCREWDRIVER)
to_chat(user, span_notice("You press down on the manual eject button with \the [I]."))
try_eject(user, TRUE)
return
/obj/item/computer_hardware/ai_slot/screwdriver_act(mob/living/user, obj/item/tool)
to_chat(user, span_notice("You press down on the manual eject button with [tool]."))
try_eject(user, TRUE)
return TOOL_ACT_TOOLTYPE_SUCCESS
@@ -102,16 +102,14 @@
return TRUE
/obj/item/computer_hardware/card_slot/attackby(obj/item/I, mob/living/user)
if(..())
return
if(I.tool_behaviour == TOOL_SCREWDRIVER)
if(stored_card)
to_chat(user, span_notice("You press down on the manual eject button with \the [I]."))
try_eject(user)
return
swap_slot()
to_chat(user, span_notice("You adjust the connecter to fit into [expansion_hw ? "an expansion bay" : "the primary ID bay"]."))
/obj/item/computer_hardware/card_slot/screwdriver_act(mob/living/user, obj/item/tool)
if(stored_card)
to_chat(user, span_notice("You press down on the manual eject button with [tool]."))
try_eject(user)
return TOOL_ACT_TOOLTYPE_SUCCESS
swap_slot()
to_chat(user, span_notice("You adjust the connecter to fit into [expansion_hw ? "an expansion bay" : "the primary ID bay"]."))
return TOOL_ACT_TOOLTYPE_SUCCESS
/**
*Swaps the card_slot hardware between using the dedicated card slot bay on a computer, and using an expansion bay.