Files
Bubberstation/code/modules/modular_computers/file_system/programs/cargoship.dm
Ghom f9957b0373 Integrated circuits for modular computers (#80530)
## About The Pull Request
This PR integrates circuits for modular computers and a good bits of
their programs.
The peculiarity here is that modular computers have no fixed amount of
unremovable components (except the base one with just a couple ports for
now), instead, they're added and removed along with programs. With a few
exceptions (such as the messenger and signaler), for these program
circuits to work, their associated program has to be either open or in
the background.

For a reason or another, not all programs have a circuit associated to
them, still, however the programs with a circuit are still a handful.
They are:
- Nanotrasen Pay System
- Notepad
- SiliConnect
- WireCarp
- MODsuit Control
- Spectre Meter
- Direct Messenger*
- LifeConnect
- Custodial Locator
- Fission360
- Camera
- Status Display
- SignalCommander

*By the by, sending messages has a cooldown, so it shouldn't be as
spammy. If it turns out to not be enough, I can make it so messages from
circuit will be ignored by other messenger circuits.

The PR is no longer WIP.

## Why It's Good For The Game
I believe modular computers could make for some interesting setups with
circuits, since they're fairly flexible and stocked with features unlike
many other appliances, therefore also a speck more abusable, though
limits, cooldowns, logging and sanitization have been implemented to
keep it in check.

## Changelog

🆑
add: Modular Computers now support integrated circuits. What can be done
with them depends on the programs installed and whether they're running
(open or background).
add: Modular Consoles (the machinery) now have a small backup cell they
draw power from if the power goes out.
/🆑
2024-01-20 21:21:42 +01:00

60 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, datum/tgui/ui, datum/ui_state/state)
. = ..()
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."))