Skip to content

Commit

Permalink
[MIRROR] Id context fix (#429)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
Co-authored-by: NovaBot <[email protected]>
  • Loading branch information
3 people authored and FFMirrorBot committed Jan 12, 2024
1 parent a860ef5 commit 8bab599
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions code/game/objects/items/cards_ids.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 8bab599

Please sign in to comment.