From 27ba86348ee8cd50c09a750033f85c87e80ca66d Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Fri, 12 Jan 2024 03:52:52 +0100 Subject: [PATCH] [MIRROR] Id context fix [MDB IGNORE] (#26096) * Id context fix (#80906) ## About The Pull Request This pull request fixes two things. First, it moves the behavior for setting your account id from right click (shared with withdrawing credits) over to Alt-Right click instead. Second, this pull request fixes contextual screen tips for the Id card, explaining how to set a bank account on a new card as a result. ## Why It's Good For The Game This fixes #68351. Additionally he early return on add_context was blocking all screen tips from appearing. It improves the readability of ID cards by having the screen tips back, while also correctly splitting two very distinct behaviors into separate hotkeys that weren't available at the time we moved blank ID cards into having blank savings accounts. ## Changelog :cl: qol: ID cards now set their accounts with Alt-Right click. fix: ID cards now once again have contextual screen tips showing what buttons do what actions. /:cl: * Id context fix --------- Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com> --- code/game/objects/items/cards_ids.dm | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/code/game/objects/items/cards_ids.dm b/code/game/objects/items/cards_ids.dm index b1780d24513..793b6c4d613 100644 --- a/code/game/objects/items/cards_ids.dm +++ b/code/game/objects/items/cards_ids.dm @@ -441,14 +441,11 @@ /obj/item/card/id/add_context(atom/source, list/context, obj/item/held_item, mob/user) . = ..() - if(held_item != src) - return - context[SCREENTIP_CONTEXT_LMB] = "Show ID" context[SCREENTIP_CONTEXT_RMB] = "Project pay stand" if(isnull(registered_account) || registered_account.replaceable) //Same check we use when we check if we can assign an account - context[SCREENTIP_CONTEXT_ALT_LMB] = "Assign account" - else + context[SCREENTIP_CONTEXT_ALT_RMB] = "Assign account" + if(!registered_account.replaceable || registered_account.account_balance > 0) context[SCREENTIP_CONTEXT_ALT_LMB] = "Withdraw credits" return CONTEXTUAL_SCREENTIP_SET @@ -676,9 +673,6 @@ /obj/item/card/id/AltClick(mob/living/user) if(!alt_click_can_use_id(user)) return - if(!registered_account || registered_account.replaceable) - set_new_account(user) - return if(registered_account.account_debt) var/choice = tgui_alert(user, "Choose An Action", "Bank Account", list("Withdraw", "Pay Debt")) if(!choice || QDELETED(user) || QDELETED(src) || !alt_click_can_use_id(user) || loc != user) @@ -708,6 +702,14 @@ var/difference = amount_to_remove - registered_account.account_balance registered_account.bank_card_talk(span_warning("ERROR: The linked account requires [difference] more credit\s to perform that withdrawal."), TRUE) +/obj/item/card/id/alt_click_secondary(mob/user) + . = ..() + if(!alt_click_can_use_id(user)) + return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN + if(!registered_account || registered_account.replaceable) + set_new_account(user) + return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN + /obj/item/card/id/proc/pay_debt(user) var/amount_to_pay = tgui_input_number(user, "How much do you want to pay? (Max: [registered_account.account_balance] cr)", "Debt Payment", max_value = min(registered_account.account_balance, registered_account.account_debt)) if(!amount_to_pay || QDELETED(src) || loc != user || !alt_click_can_use_id(user))