mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-19 14:12:55 +00:00
* PDA update (Messenger works while dead, Microwave works, etc). (#80069) This is an update that touches many more things all at once (compared to my other PRs) meant to make PDAs in general feel more consistent and not take away from one of the experiences we want to encourage: interaction between players. 1. Replaced all checks of a 'pda' with a 'modular pc'. This means technically (though not done in-game currently) other modpcs can hold an uplink, and microwaves can charge laptops. 2. Speaking of microwave, they now don't break and require deconstruction if the cell is removed mid-charge. 3. When a Mod PC is out of power, it will now allow the Messenger to work (which now also doesn't consume any additional power), if the app exists on the PC. Here's a video demonstration https://github.com/tgstation/tgstation/assets/53777086/7ae12f81-a271-49b8-95fa-2ba54d2e2d1f 4. Flashlights can't be turned on while the cell is dead 5. I replaced a bunch of program vars with ``program_flags`` and renamed ``usage_flags`` to ``can_run_on_flags``. 6. Added a debug modPC that has every app installed by default. Mafia had some issues in the past that were unknown because Mafia wasn't preinstalled with any tablet so was never in create & destroy nor in any other unit test. This was just an easy solution I had, but PDAs should get more in-depth unit tests in the future for running apps n stuff- I just wanted to make sure no other apps were broken/harddeling. Currently when a PDA dies, its only use is to reply to PDA messages sent to you, since you can still reply to them. Instead of just fixing it and telling players to cope, I thought it would be nice to allow PDA Messenger to still work, as it is a vital app. You can call it some emergency power mode or whatever, I don't really mind the reason behind why it is this way. When I made cells used more on PDAs, my main goal was to encourage upgrading your PDA and/or limiting how many apps you use at once, I did not want this to hit on players who use it as a form of interaction. This is the best of both worlds, I think. The rest of the changes is just for modularity, if some downstream wants to add tablets, phone computers, or whatever the hell else, they can still get just as far as PDAs should be able to get to, hopefully. 🆑 add: PDAs with a dead power cell are now limited to using their Messenger app. fix: Microwaves now stop charging PDAs if the cell was removed mid-charge. fix: Microwaves can now charge laptops. fix: PDA Flashlights can't be turned on while the PDA is dead. fix: You can now hold a laptop up to a camera (if it has a notekeeper app installed) like PDAs already could. /🆑 --------- Co-authored-by: lessthanthree <83487515+lessthnthree@users.noreply.github.com> * ok --------- Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com> Co-authored-by: lessthanthree <83487515+lessthnthree@users.noreply.github.com>
77 lines
2.9 KiB
Plaintext
77 lines
2.9 KiB
Plaintext
/datum/computer_file/program/nt_pay
|
|
filename = "ntpay"
|
|
filedesc = "Nanotrasen Pay System"
|
|
downloader_category = PROGRAM_CATEGORY_DEVICE
|
|
program_open_overlay = "generic"
|
|
extended_desc = "An application that locally (in your sector) helps to transfer money or track your expenses and profits."
|
|
size = 2
|
|
tgui_id = "NtosPay"
|
|
program_icon = "money-bill-wave"
|
|
can_run_on_flags = PROGRAM_ALL
|
|
///Reference to the currently logged in user.
|
|
var/datum/bank_account/current_user
|
|
///Pay token, by which we can send credits
|
|
var/token
|
|
///Amount of credits, which we sends
|
|
var/money_to_send = 0
|
|
///Pay token what we want to find
|
|
var/wanted_token
|
|
|
|
/datum/computer_file/program/nt_pay/ui_act(action, list/params, datum/tgui/ui)
|
|
switch(action)
|
|
if("Transaction")
|
|
if(IS_DEPARTMENTAL_ACCOUNT(current_user))
|
|
return to_chat(usr, span_notice("The app is unable to withdraw from that card."))
|
|
|
|
token = params["token"]
|
|
money_to_send = params["amount"]
|
|
var/datum/bank_account/recipient
|
|
if(!token)
|
|
return to_chat(usr, span_notice("You need to enter your transfer target's pay token."))
|
|
if(!money_to_send)
|
|
return to_chat(usr, span_notice("You need to specify how much you're sending."))
|
|
if(token == current_user.pay_token)
|
|
return to_chat(usr, span_notice("You can't send credits to yourself."))
|
|
|
|
for(var/account as anything in SSeconomy.bank_accounts_by_id)
|
|
var/datum/bank_account/acc = SSeconomy.bank_accounts_by_id[account]
|
|
if(acc.pay_token == token)
|
|
recipient = acc
|
|
break
|
|
|
|
if(!recipient)
|
|
return to_chat(usr, span_notice("The app can't find who you're trying to pay. Did you enter the pay token right?"))
|
|
if(!current_user.has_money(money_to_send) || money_to_send < 1)
|
|
return current_user.bank_card_talk("You cannot afford it.")
|
|
|
|
recipient.bank_card_talk("You received [money_to_send] credit(s). Reason: transfer from [current_user.account_holder]")
|
|
recipient.transfer_money(current_user, money_to_send)
|
|
current_user.bank_card_talk("You send [money_to_send] credit(s) to [recipient.account_holder]. Now you have [current_user.account_balance] credit(s)")
|
|
|
|
if("GetPayToken")
|
|
wanted_token = null
|
|
for(var/account in SSeconomy.bank_accounts_by_id)
|
|
var/datum/bank_account/acc = SSeconomy.bank_accounts_by_id[account]
|
|
if(acc.account_holder == params["wanted_name"])
|
|
wanted_token = "Token: [acc.pay_token]"
|
|
break
|
|
if(!wanted_token)
|
|
return wanted_token = "Account \"[params["wanted_name"]]\" not found."
|
|
|
|
|
|
|
|
/datum/computer_file/program/nt_pay/ui_data(mob/user)
|
|
var/list/data = list()
|
|
|
|
current_user = computer.computer_id_slot?.registered_account || null
|
|
if(!current_user)
|
|
data["name"] = null
|
|
else
|
|
data["name"] = current_user.account_holder
|
|
data["owner_token"] = current_user.pay_token
|
|
data["money"] = current_user.account_balance
|
|
data["wanted_token"] = wanted_token
|
|
data["transaction_list"] = current_user.transaction_history
|
|
|
|
return data
|