Files
Bubberstation/code/modules/power/apc/apc_contextual_tips.dm
SkyratBot 4102b5c67b [MIRROR] Add contextual screen tips for APCs [MDB IGNORE] (#18810)
Add contextual screen tips for APCs (#72625)

## About The Pull Request
And makes some improvements on their balloon alerts.

The code has a lot of if/else nonsense, I followed how other big chains
of screen tips work now but maybe it can be smoothed out, I put the code
on it's own DM so we don't need to stare at that wall while dealing with
other APC code.
## Why It's Good For The Game
APC is definitely the worst offender on construction being a mess.
I personally like that it is a complicated machine that needs multiple
pieces to build/repair, but the bad user experience of doing that just
can't be excused.
Need to memorize multiple steps, a sequence of tools, you have "traps"
you can get caught into by using the wrong tool, using crowbar at the
wrong time and locking the access cover or engiborgs using a screwdriver
and ejecting the cell as examples.

Now you will know what will happen before you misuse tool and you will
get hints about what each tool does to the APC, even if it is not the
right step at the moment, as a balloon alert will explain why the
attempt failed.
## Changelog
🆑 Guillaume Prata
qol: APCs have contextual screen tips now.
/🆑

Co-authored-by: GuillaumePrata <55374212+GuillaumePrata@users.noreply.github.com>
2023-01-19 15:30:55 -05:00

57 lines
2.4 KiB
Plaintext

/obj/machinery/power/apc/add_context(atom/source, list/context, obj/item/held_item, mob/user)
. = ..()
if (isnull(held_item))
if (opened == APC_COVER_CLOSED)
context[SCREENTIP_CONTEXT_RMB] = locked ? "Unlock" : "Lock"
else if (opened == APC_COVER_OPENED && cell)
context[SCREENTIP_CONTEXT_LMB] = "Remove cell"
else if(held_item.tool_behaviour == TOOL_CROWBAR)
if (opened == APC_COVER_CLOSED)
context[SCREENTIP_CONTEXT_LMB] = "Open the cover"
else if ((opened == APC_COVER_OPENED && has_electronics == APC_ELECTRONICS_SECURED) && !(machine_stat & BROKEN))
context[SCREENTIP_CONTEXT_LMB] = "Close and lock"
else if (machine_stat & BROKEN|(machine_stat & EMAGGED| malfhack))
context[SCREENTIP_CONTEXT_LMB] = "Remove damaged board"
else
context[SCREENTIP_CONTEXT_LMB] = "Remove board"
else if(held_item.tool_behaviour == TOOL_SCREWDRIVER)
if (opened == APC_COVER_CLOSED)
context[SCREENTIP_CONTEXT_LMB] = panel_open ? "Unexpose wires" : "Expose wires"
else if (cell && opened == APC_COVER_OPENED)
context[SCREENTIP_CONTEXT_LMB] = "Remove cell"
else if (has_electronics == APC_ELECTRONICS_INSTALLED)
context[SCREENTIP_CONTEXT_LMB] = "Fasten the board"
else if (has_electronics == APC_ELECTRONICS_SECURED)
context[SCREENTIP_CONTEXT_LMB] = "Unfasten the board"
else if(held_item.tool_behaviour == TOOL_WIRECUTTER)
if (terminal && opened == APC_COVER_OPENED)
context[SCREENTIP_CONTEXT_LMB] = "Dismantle wire terminal"
else if(held_item.tool_behaviour == TOOL_WELDER)
if (opened == APC_COVER_OPENED && !has_electronics)
context[SCREENTIP_CONTEXT_LMB] = "Disassemble the APC"
else if(istype(held_item, /obj/item/stock_parts/cell) && opened == APC_COVER_OPENED)
context[SCREENTIP_CONTEXT_LMB] = "Insert Cell"
else if(istype(held_item, /obj/item/stack/cable_coil) && opened == APC_COVER_OPENED)
context[SCREENTIP_CONTEXT_LMB] = "Create wire terminal"
else if(istype(held_item, /obj/item/electronics/apc) && opened == APC_COVER_OPENED)
context[SCREENTIP_CONTEXT_LMB] = "Insert board"
else if(istype(held_item, /obj/item/electroadaptive_pseudocircuit) && opened == APC_COVER_OPENED)
if (!has_electronics)
context[SCREENTIP_CONTEXT_LMB] = "Insert an APC board"
else if(!cell)
context[SCREENTIP_CONTEXT_LMB] = "Insert a cell"
else if(istype(held_item, /obj/item/wallframe/apc))
context[SCREENTIP_CONTEXT_LMB] = "Replace damaged frame"
return CONTEXTUAL_SCREENTIP_SET