Skip to content

Commit

Permalink
[MIRROR] Id context fix (#1541)
Browse files Browse the repository at this point in the history
* Id context fix (#80906)

---------

Co-authored-by: NovaBot <[email protected]>
Co-authored-by: ArcaneMusic <[email protected]>
Co-authored-by: NovaBot <[email protected]>
  • Loading branch information
4 people authored Jan 14, 2024
1 parent a8ca717 commit 402486c
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 402486c

Please sign in to comment.