mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 09:42:29 +00:00
* Tablets don't close their UI when changing program (and some fixes) (#73635) ## About The Pull Request - Tablets now refresh their page when changing programs, this means the UI will no longer close and reopen itself several times (or even have several UIs open if shit broke hard enough). - Removed tablet's attack self because interact already does everything it had to do. - Header programs now close when minimized (as there's no button to close them in the main menu. - Removed a lot of program UI stuff, it's now handled by the PC itself, such as header data and ui host. - Cut off asset sending from TGUI into it's own proc so I can re-send assets when changing programs - Added an ejection button for machine computers - Fixed ID not ejecting into the user's hand when using 'Eject ID' - Fixes a minor runtime when opening the MODsuit application without a MODsuit already connected. ## Why It's Good For The Game Fixes some bugs that I found with tablets UIS now won't be flickering as bad in front of them, or have inconsistent placement (like when you move your main menu UI, go to Messenger, then it's back to the center of the screen). Video of it in action https://user-images.githubusercontent.com/53777086/221301417-78321149-0c10-475e-bd29-79f5a4ba0597.mp4 ## Changelog 🆑 fix: Being in an application now properly uses the tablet's battery. fix: Messenger and Themify apps now close when minimized, so don't count towards the running app limit. fix: Tablet UIs will now no longer spam open/close the UI when changing applications fix: Using the Eject ID button on tablets now ejects into your hand. fix: Computers now have an Eject ID button refactor: Cut down a lot of copy paste in tablet & program code, now it's mostly done by the tablet. /🆑 * Tablets don't close their UI when changing program (and some fixes) * Update contractor_tablet.dm * wew --------- Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com> Co-authored-by: Zonespace <41448081+Zonespace27@users.noreply.github.com> Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
62 lines
2.4 KiB
Plaintext
62 lines
2.4 KiB
Plaintext
/datum/computer_file/program/shipping
|
|
filename = "shipping"
|
|
filedesc = "GrandArk Exporter"
|
|
category = PROGRAM_CATEGORY_SUPL
|
|
program_icon_state = "shipping"
|
|
extended_desc = "A combination printer/scanner app that enables modular computers to print barcodes for easy scanning and shipping."
|
|
size = 6
|
|
tgui_id = "NtosShipping"
|
|
program_icon = "tags"
|
|
///Account used for creating barcodes.
|
|
var/datum/bank_account/payments_acc
|
|
///The person who tagged this will receive the sale value multiplied by this number.
|
|
var/cut_multiplier = 0.5
|
|
///Maximum value for cut_multiplier.
|
|
var/cut_max = 0.5
|
|
///Minimum value for cut_multiplier.
|
|
var/cut_min = 0.01
|
|
|
|
/datum/computer_file/program/shipping/ui_data(mob/user)
|
|
var/list/data = list()
|
|
|
|
data["has_id_slot"] = !!computer.computer_id_slot
|
|
data["paperamt"] = "[computer.stored_paper] / [computer.max_paper]"
|
|
data["card_owner"] = computer.computer_id_slot || "No Card Inserted."
|
|
data["current_user"] = payments_acc ? payments_acc.account_holder : null
|
|
data["barcode_split"] = cut_multiplier * 100
|
|
return data
|
|
|
|
/datum/computer_file/program/shipping/ui_act(action, list/params)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
if(!computer.computer_id_slot) //We need an ID to successfully run
|
|
return FALSE
|
|
|
|
switch(action)
|
|
if("ejectid")
|
|
computer.RemoveID(usr)
|
|
if("selectid")
|
|
if(!computer.computer_id_slot.registered_account)
|
|
playsound(get_turf(computer.ui_host()), 'sound/machines/buzz-sigh.ogg', 50, TRUE, -1)
|
|
return TRUE
|
|
payments_acc = computer.computer_id_slot.registered_account
|
|
playsound(get_turf(computer.ui_host()), 'sound/machines/ping.ogg', 50, TRUE, -1)
|
|
if("resetid")
|
|
payments_acc = null
|
|
if("setsplit")
|
|
var/potential_cut = input("How much would you like to pay out to the registered card?","Percentage Profit ([round(cut_min*100)]% - [round(cut_max*100)]%)") as num|null
|
|
cut_multiplier = potential_cut ? clamp(round(potential_cut/100, cut_min), cut_min, cut_max) : initial(cut_multiplier)
|
|
if("print")
|
|
if(computer.stored_paper <= 0)
|
|
to_chat(usr, span_notice("Printer is out of paper."))
|
|
return TRUE
|
|
if(!payments_acc)
|
|
to_chat(usr, span_notice("Software error: Please set a current user first."))
|
|
return TRUE
|
|
var/obj/item/barcode/barcode = new /obj/item/barcode(get_turf(computer.ui_host()))
|
|
barcode.payments_acc = payments_acc
|
|
barcode.cut_multiplier = cut_multiplier
|
|
computer.stored_paper--
|
|
to_chat(usr, span_notice("The computer prints out a barcode."))
|