Files
Bubberstation/code/modules/modular_computers/file_system/programs/cargoship.dm
John Willard ddd3f53943 PDA general maintenance (NTNet downloader rework) (#79741)
## About The Pull Request

I deleted the documentation file of ModPCs because it was barebones and
had no new information to give that autodoc couldn't. Just to make sure
this isn't a net-negative, I improved on much of the autodoc and
comments in general around ModPC code to help people understand easier
what's going on around it.
I also renamed vars that were too easily confused with other var names,
and reworked the ntnet downloader a little;
- it now has a search bar
- it now has more sections to scroll through, hopefully making it more
accurate and easy to find what you need.
- also organized the apps that were previously shoved in 'other'.
- i also upgraded it to a .tsx because why not

video demonstration


https://github.com/tgstation/tgstation/assets/53777086/cbba4c1c-b8a8-4ba4-8628-aea8389999fc

## Why It's Good For The Game

Adds in a lot of comments that were previously missing, clears up some
sources of confusion within ModPC code, and improves NTNet Downloader,
something I've procrastinated on doing for a very long time now.

## Changelog

🆑
qol: NTNet Downloader now has a search bar, and programs are now better
sorted.
/🆑
2023-11-19 19:00:18 -05:00

59 lines
2.4 KiB
Plaintext

/datum/computer_file/program/shipping
filename = "shipping"
filedesc = "GrandArk Exporter"
downloader_category = PROGRAM_CATEGORY_SUPPLY
program_open_overlay = "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(!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."))