Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor APCs interaction chain from attackby to item_interaction (tg…
…station#82390) ## About The Pull Request For how many lines this is, there's not a lot to really say. In general, we simply move all item interactions from `attackby(...)` to `item_interaction(...)`, split each item interaction off into a separate proc, and make them all return the proper item interaction flags. We _do_ kill some probably dead code, and remove a call to `attackby(...)` elsewhere. Then, for clarity, we move the cell check below the ID check so it can be next to the other item type checks, as the priority between cell and ID is unlikely to matter anyway. Other than what's described above and detailed below, each section's functionality should be the same. Now, for the parts that _do_ need to be explained more. ### Killing Probably Dead Code Alright, so, the first part that does not have the cleanest transition. https://github.com/tgstation/tgstation/blob/d38f9385b863e49f83455a227764d302629e2867/code/modules/power/apc/apc_attack.dm#L22-L23 Whatever the fuck this is. Asking around, this seems to just be dead code. For sanity's sake removing it and testing, silicon interactions with it seem to work just fine. So we kill it. We just kill it. We Just Kill It. Closest we could find requires the distance check there to be false, so it wouldn't apply. But it _does_ bring us to the second bit of weird code. ### Calling APC Attackby Elsewhere? So wallframes let you screwdriver them to put them up, which from a comment seems to be because of cyborgs. APC wallframes of course override this with their own implementation, that allows you to also replace a damaged cover or frame like that! https://github.com/tgstation/tgstation/blob/d38f9385b863e49f83455a227764d302629e2867/code/game/objects/items/apc_frame.dm#L29-L39 ...By just calling the wholeass `attackby(...)` proc on the APC and calling it a day. But hey, this is where our previous splitting up comes in handy, because we just have a `wallframe_act(...)` proc! So we just call that instead. ```dm var/obj/machinery/power/apc/mounted_apc = locate(/obj/machinery/power/apc) in get_turf(user) mounted_apc.wallframe_act(user, src) return ITEM_INTERACT_SUCCESS ``` ...And not use single letter variables, while we're at it. That should be all. Remember to get snacks and drinks. ## Why It's Good For The Game Split off 178 line `attackby(...)` item interaction chain into separate procs called in `item_interaction(...)`. Screwdrivering APC wallframes no longer calls the wholeass `attackby(...)` on the APC, but just call the new sub-proc for the specific interaction it cares about. ## Changelog :cl: refactor: APCs have had their item interaction chain refactored. This should functionally be the same, but please report any issues. /:cl:
- Loading branch information