mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
Paperwork Printing Program for Modular Computers (#16392)
* adds printers to command phones * adds paperwork printer program to modular systems * includes paperwork printing program in the dme * removes ui_static_data as it is not needed * updates to USE static_data at the recommendation of Chubbygummibear * fixes linting * Yoggers moment * fixes linting 2 electric boogaloo * runs tgui fix * Thanks Theos * makes buttons pretty * fixes scuff * improves code to @ynot01 standards, hopefully * fixes redundant if * dynamic paperwork additions part 1, working on getting it to actually print * part 2, paperwork actually prints * Forgot to switch this back * fixes tgui
This commit is contained in:
@@ -39,7 +39,8 @@
|
||||
/obj/item/computer_hardware/hard_drive/small/pda,
|
||||
/obj/item/computer_hardware/network_card,
|
||||
/obj/item/computer_hardware/card_slot,
|
||||
/obj/item/computer_hardware/card_slot/secondary)
|
||||
/obj/item/computer_hardware/card_slot/secondary,
|
||||
/obj/item/computer_hardware/printer/mini)
|
||||
|
||||
/obj/item/modular_computer/tablet/phone/preset/advanced/command/cap
|
||||
finish_color = "yellow"
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
//TODO: add more sane printing handling
|
||||
/datum/computer_file/program/paperwork_printer
|
||||
filename = "ppwrkprnt"
|
||||
filedesc = "Paperwork Printing"
|
||||
category = PROGRAM_CATEGORY_MISC
|
||||
program_icon_state = "id"
|
||||
extended_desc = "Program for dispensing paperwork"
|
||||
requires_ntnet = FALSE
|
||||
size = 4
|
||||
tgui_id = "NtosPaperworkPrinter"
|
||||
program_icon = "clipboard-list"
|
||||
|
||||
/datum/computer_file/program/paperwork_printer/ui_static_data(mob/user)
|
||||
var/list/data = get_header_data()
|
||||
var/list/papers = list()
|
||||
//filter out paperwork we're not allowed to have
|
||||
for(var/R in subtypesof(/obj/item/paper/paperwork))
|
||||
var/obj/item/paper/paperwork/P = R
|
||||
if(initial(P.printable))
|
||||
papers += list(list("name" = initial(P.name), "id" = initial(P.id)))
|
||||
var/obj/item/computer_hardware/printer/printer
|
||||
if(computer)
|
||||
printer = computer.all_components[MC_PRINT]
|
||||
data["have_printer"] = !!printer
|
||||
else
|
||||
data["have_printer"] = FALSE
|
||||
data["printable_papers"] = papers
|
||||
return data
|
||||
|
||||
/datum/computer_file/program/paperwork_printer/ui_act(action, params, datum/tgui/ui)
|
||||
if(..())
|
||||
return
|
||||
//this variable stores the object of which we're actually going to print
|
||||
if(action == "PRG_print")
|
||||
var/paperworkToPick = params["paperworkID"]
|
||||
for(var/R in subtypesof(/obj/item/paper/paperwork))
|
||||
var/obj/item/paper/paperwork/P = R
|
||||
if(initial(P.id)==paperworkToPick)
|
||||
src.print(P)
|
||||
break
|
||||
|
||||
|
||||
/datum/computer_file/program/paperwork_printer/proc/print(var/obj/item/paper/paperwork/T)
|
||||
var/obj/item/computer_hardware/printer/printer
|
||||
if(computer)
|
||||
printer = computer.all_components[MC_PRINT]
|
||||
if(computer && printer) //This option should never be called if there is no printer
|
||||
if(!printer.print_type(T))
|
||||
to_chat(usr, span_notice("Hardware error: Printer was unable to print the file. It may be out of paper."))
|
||||
return
|
||||
else
|
||||
//it printed, how many pages are left?
|
||||
var/pages_left = printer.stored_paper
|
||||
computer.visible_message(span_notice("\The [computer] prints out a paper. There are [pages_left] pages left."))
|
||||
49
tgui/packages/tgui/interfaces/NtosPaperworkPrinter.js
Normal file
49
tgui/packages/tgui/interfaces/NtosPaperworkPrinter.js
Normal file
@@ -0,0 +1,49 @@
|
||||
import { useBackend } from '../backend';
|
||||
import { Button, NoticeBox, Section } from '../components';
|
||||
import { NtosWindow } from '../layouts';
|
||||
|
||||
export const NtosPaperworkPrinter = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
const {
|
||||
have_printer,
|
||||
printable_papers,
|
||||
} = data;
|
||||
if (have_printer) {
|
||||
return (
|
||||
<NtosWindow
|
||||
width={400}
|
||||
height={480}
|
||||
resizable>
|
||||
<NtosWindow.Content scrollable>
|
||||
<Section title="NTOS Paperwork Printer">
|
||||
{printable_papers.map(paper => (
|
||||
<Button
|
||||
key={paper}
|
||||
icon="print"
|
||||
content={"Print " + paper.name}
|
||||
width="100%"
|
||||
onClick={() => act('PRG_print', {
|
||||
paperworkID: paper.id,
|
||||
})} />
|
||||
))}
|
||||
</Section>
|
||||
</NtosWindow.Content>
|
||||
</NtosWindow>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<NtosWindow
|
||||
width={400}
|
||||
height={480}
|
||||
resizable>
|
||||
<NtosWindow.Content scrollable>
|
||||
<Section title="NTOS Paperwork Printer" />
|
||||
<NoticeBox>
|
||||
There is no printer installed. Program halted.
|
||||
</NoticeBox>
|
||||
</NtosWindow.Content>
|
||||
</NtosWindow>
|
||||
);
|
||||
}
|
||||
|
||||
};
|
||||
@@ -2682,6 +2682,7 @@
|
||||
#include "code\modules\modular_computers\file_system\programs\ntmonitor.dm"
|
||||
#include "code\modules\modular_computers\file_system\programs\ntnrc_client.dm"
|
||||
#include "code\modules\modular_computers\file_system\programs\ntpda_msg.dm"
|
||||
#include "code\modules\modular_computers\file_system\programs\paperworkprinter.dm"
|
||||
#include "code\modules\modular_computers\file_system\programs\portrait_printer.dm"
|
||||
#include "code\modules\modular_computers\file_system\programs\radar.dm"
|
||||
#include "code\modules\modular_computers\file_system\programs\robotact.dm"
|
||||
|
||||
@@ -7,9 +7,12 @@
|
||||
* It's a subtype of paper, with written text already on it.
|
||||
*
|
||||
*/
|
||||
/obj/item/paper/paperwork/
|
||||
var/id = 0
|
||||
var/printable = TRUE
|
||||
/obj/item/paper/paperwork/general_request_form
|
||||
name = "General Requests Form (Form NT-010)"
|
||||
|
||||
id = 1
|
||||
|
||||
/obj/item/paper/paperwork/general_request_form/Initialize()
|
||||
. = ..()
|
||||
@@ -34,6 +37,7 @@
|
||||
*/
|
||||
/obj/item/paper/paperwork/complaint_form
|
||||
name = "Complaint Form (Form NT-021)"
|
||||
id = 2
|
||||
|
||||
/obj/item/paper/paperwork/complaint_form/Initialize()
|
||||
. = ..()
|
||||
@@ -65,6 +69,7 @@
|
||||
*/
|
||||
/obj/item/paper/paperwork/incident_report
|
||||
name = "Incident Report (Form NT-400)"
|
||||
id = 3
|
||||
|
||||
/obj/item/paper/paperwork/incident_report/Initialize()
|
||||
. = ..()
|
||||
@@ -113,6 +118,7 @@
|
||||
*/
|
||||
/obj/item/paper/paperwork/sec_incident_report
|
||||
name = "Security Incident Report (Form SEC-030)"
|
||||
id = 4
|
||||
|
||||
/obj/item/paper/paperwork/sec_incident_report/Initialize()
|
||||
. = ..()
|
||||
@@ -180,6 +186,7 @@
|
||||
*/
|
||||
/obj/item/paper/paperwork/item_form
|
||||
name = "Item Request Form (Form NT-089)"
|
||||
id = 5
|
||||
|
||||
/obj/item/paper/paperwork/item_form/Initialize()
|
||||
. = ..()
|
||||
@@ -214,6 +221,7 @@
|
||||
*/
|
||||
/obj/item/paper/paperwork/cyborg_request_form
|
||||
name = "Cyborgization Consent Form (Form NT-203)"
|
||||
id = 6
|
||||
|
||||
/obj/item/paper/paperwork/cyborg_request_form/Initialize()
|
||||
. = ..()
|
||||
@@ -248,6 +256,7 @@
|
||||
*/
|
||||
/obj/item/paper/paperwork/hopaccessrequestform
|
||||
name = "HoP Access Request Form (Form NT-022)"
|
||||
id = 7
|
||||
|
||||
/obj/item/paper/paperwork/hopaccessrequestform/Initialize()
|
||||
. = ..()
|
||||
@@ -278,6 +287,7 @@
|
||||
*/
|
||||
/obj/item/paper/paperwork/hop_job_change_form
|
||||
name = "Job Reassignment Form (Form NT-059)"
|
||||
id = 8
|
||||
|
||||
/obj/item/paper/paperwork/hop_job_change_form/Initialize()
|
||||
. = ..()
|
||||
@@ -408,6 +418,7 @@
|
||||
*/
|
||||
/obj/item/paper/paperwork/rd_form
|
||||
name = "R&D Request Form (Form SCI-3)"
|
||||
id = 9
|
||||
|
||||
/obj/item/paper/paperwork/rd_form/Initialize()
|
||||
. = ..()
|
||||
@@ -437,6 +448,7 @@
|
||||
*/
|
||||
/obj/item/paper/paperwork/mech_form
|
||||
name = "R&D Mech Request Form (Form SCI-9)"
|
||||
id = 10
|
||||
|
||||
/obj/item/paper/paperwork/mech_form/Initialize()
|
||||
. = ..()
|
||||
@@ -466,6 +478,7 @@
|
||||
*/
|
||||
/obj/item/paper/paperwork/jobchangecert
|
||||
name = "Job Change Certificate"
|
||||
id = 11
|
||||
|
||||
/obj/item/paper/paperwork/jobchangecert/Initialize()
|
||||
. = ..()
|
||||
|
||||
Reference in New Issue
Block a user