Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Photocopier blanks and TGUI port (Rebased) #148

Merged
merged 44 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
aa897f9
Blanks
AyIong Jul 31, 2023
c7ca316
well well well...
AyIong Jul 31, 2023
3f97969
that just work
AyIong Jul 31, 2023
557ba25
now it didn't
AyIong Aug 1, 2023
88b679f
da suka blyat
AyIong Aug 1, 2023
5fc7b3a
work again
AyIong Aug 1, 2023
ab12462
eto prosto rabotaet
AyIong Aug 1, 2023
179feee
done
AyIong Aug 1, 2023
3874c9c
del unused
AyIong Aug 1, 2023
228c7a3
TGUI rebuild
AyIong Aug 1, 2023
aed3565
linter fix?
AyIong Aug 1, 2023
3b96111
hide centcom forms for non CC users
AyIong Aug 30, 2023
3b4df24
Update modular_ss220.dme
AyIong Aug 30, 2023
e2dd455
Update modular_ss220.dme
AyIong Aug 30, 2023
98762fd
suka yobana
AyIong Aug 30, 2023
8a01cf6
Move forms
AyIong Aug 30, 2023
9642660
Update tgui.bundle.js
AyIong Sep 6, 2023
8a7535f
minor stuff
Furrior Sep 6, 2023
341c275
Atomic commits? Lol. I have a "did everything" commit
Furrior Sep 7, 2023
e1abf46
Some better stuff
Furrior Sep 7, 2023
e294126
del: double fingerprint
Furrior Sep 7, 2023
11343d5
more minor stuff
Furrior Sep 7, 2023
dc1379b
removed another excess fingerprint
Furrior Sep 7, 2023
a0a2110
more minor stuff
Furrior Sep 7, 2023
f045319
narcissism
Furrior Sep 7, 2023
85eb605
del: useless update icon
Furrior Sep 7, 2023
2bcebda
more minor stuff + some translation(probably should be made auto tran…
Furrior Sep 7, 2023
898524b
nah, autotranslation is better
Furrior Sep 7, 2023
e20ba89
forgot this
Furrior Sep 7, 2023
a39cf79
probably better way
Furrior Sep 7, 2023
e9b9392
Selection fix + smaller strings
Furrior Sep 8, 2023
c57f457
Search
Furrior Sep 8, 2023
ae78c51
tgui build
Furrior Sep 8, 2023
fdd4e05
prettier
Furrior Sep 8, 2023
7bd69be
prettier
Furrior Sep 8, 2023
4d0253f
Можешь забыть
AyIong Sep 8, 2023
40134a4
-src.cringe
Furrior Sep 8, 2023
9239d91
Update modular_ss220/bureaucracy/code/photocopier.dm
Furrior Sep 8, 2023
d79fae7
Update modular_ss220/bureaucracy/_bureaucracy.dm
Furrior Sep 8, 2023
aaf1eae
Update modular_ss220/bureaucracy/code/photocopier.dm
Furrior Sep 8, 2023
b49c511
grammar
Furrior Sep 8, 2023
84cf40a
Moved resize check to a proc
Furrior Sep 8, 2023
04fe349
support for pencode forms
Furrior Sep 8, 2023
c642656
sorting by id instead of altername
Furrior Sep 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions modular_ss220/bureaucracy/bureaucracy.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/datum/modpack/bureaucracy
name = "Бюрократия"
desc = "Добавляет бланки в ксероксе"
author = "Aylong220, Furior, RV666"
Furrior marked this conversation as resolved.
Show resolved Hide resolved
5 changes: 5 additions & 0 deletions modular_ss220/bureaucracy/bureaucracy.dme
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#include "bureaucracy.dm"

#include "code/paper.dm"
#include "code/forms.dm"
#include "code/photocopier.dm"
524 changes: 524 additions & 0 deletions modular_ss220/bureaucracy/code/forms.dm

Large diffs are not rendered by default.

66 changes: 66 additions & 0 deletions modular_ss220/bureaucracy/code/paper.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/obj/item/paper
var/paper_width_big = 600
var/paper_height_big = 700
var/small_paper_cap = 1024
var/force_big = FALSE

/obj/item/paper/updateinfolinks()
. = ..()
if(length(info) > small_paper_cap)
become_big()
else
reset_size()

/obj/item/paper/proc/become_big()
paper_width = paper_width_big
paper_height = paper_height_big

/obj/item/paper/proc/reset_size()
paper_width = initial(paper_width)
paper_height = initial(paper_height)

/obj/item/paper/Topic(href, href_list)
..()
if(!usr || (usr.stat || usr.restrained()))
return
if(href_list["auto_write"])
var/id = href_list["auto_write"]
var/const/sign_text = "\[Подпись\]"
var/const/time_text = "\[Текущее время\]"
var/const/date_text = "\[Текущая Дата\]"
var/const/num_text = "\[Номер аккаунта\]"
var/const/pin_text = "\[ПИН\]"
var/const/station_text = "\[Название станции\]"
var/list/menu_list = list() //text items in the menu
menu_list.Add(usr.real_name) //the real name of the character, even if it is hidden
if(usr.real_name != usr.name || usr.name != "unknown") //if the player is masked or the name is different a new answer option is added
menu_list.Add("[usr.name]")
menu_list.Add(usr.job, //current job
num_text, //account number
pin_text, //pin code number
sign_text, //signature
time_text, //time
date_text, //date
station_text, // station name
usr.gender, //current gender
usr.dna.species //current species
)
var/input_element = input("Select the text you want to add:", "Select item") as null|anything in menu_list
switch(input_element) //format selected menu items in pencode and internal data
if(sign_text)
input_element = "\[sign\]"
if(time_text)
input_element = "\[time\]"
if(date_text)
input_element = "\[date\]"
if(station_text)
input_element = "\[station\]"
if(num_text)
input_element = usr.mind.initial_account.account_number
if(pin_text)
input_element = usr.mind.initial_account.account_pin
topic_href_write(id, input_element)
if(href_list["write"] )
var/id = href_list["write"]
var/input_element = input("Enter what you want to write:", "Write", null, null) as message
topic_href_write(id, input_element)
115 changes: 115 additions & 0 deletions modular_ss220/bureaucracy/code/photocopier.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
/obj/machinery/photocopier
/// Selected form's category
var/category = ""
/// Selected form's id
var/form_id = ""
/// List of available forms
var/list/forms
/// Selected form's datum
var/datum/bureaucratic_form/form
/// Printing sound
var/print_sound = 'sound/goonstation/machines/printer_dotmatrix.ogg'

/obj/machinery/photocopier/Initialize(mapload)
. = ..()
forms = new

/obj/machinery/photocopier/attack_ai(mob/user)
src.add_hiddenprint(user)
Furrior marked this conversation as resolved.
Show resolved Hide resolved
parse_forms(user)
ui_interact(user)
return attack_hand(user)

/obj/machinery/photocopier/attack_ghost(mob/user)
ui_interact(user)
return attack_hand(user)

/obj/machinery/photocopier/attack_hand(mob/user)
if(..())
return 1
AyIong marked this conversation as resolved.
Show resolved Hide resolved

user.set_machine(src)
parse_forms(user)
ui_interact(user)

/obj/machinery/photocopier/ui_act(action, list/params)
if(..())
return

switch(action)
if("print_form")
for(var/i in 1 to copies)
if(toner <= 0)
break
print_form(form)
use_power(active_power_consumption)
sleep(15)
. = TRUE
if("choose_form")
form = params["path"]
form_id = params["id"]
. = TRUE
if("choose_category")
category = params["category"]
. = TRUE
if("aipic")
aipic()
. = TRUE
update_icon()


/obj/machinery/photocopier/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "Photocopier220", name, 650, 635, master_ui, state)
ui.open()

/obj/machinery/photocopier/ui_data(mob/user)
if(!length(forms))
parse_forms(user)

var/list/data = list()

data["isAI"] = issilicon(user)
data["copynumber"] = copies
data["toner"] = toner
data["copyitem"] = (copyitem ? copyitem.name : null)
data["folder"] = (folder ? folder.name : null)
data["mob"] = (copymob ? copymob.name : null)
data["files"] = list()
data["form"] = form
data["category"] = category
data["form_id"] = form_id
data["forms"] = forms

if(LAZYLEN(saved_documents))
for(var/obj/item/O in saved_documents)
var/list/document_data = list(
name = O.name,
uid = O.UID()
)
data["files"] += list(document_data)
return data

/obj/machinery/photocopier/proc/parse_forms(mob/user)
var/list/access = user.get_access()
forms = new/list()
for(var/datum/bureaucratic_form/F as anything in subtypesof(/datum/bureaucratic_form))
var/req_access = initial(F.req_access)
if(req_access && !(req_access in access))
continue
var/form[0]
form["path"] = F
form["id"] = initial(F.id)
form["altername"] = initial(F.altername)
form["category"] = initial(F.category)
forms[++forms.len] = form

/obj/machinery/photocopier/proc/print_form(datum/bureaucratic_form/form)
playsound(loc, print_sound, 25, 1)
Furrior marked this conversation as resolved.
Show resolved Hide resolved
toner--
if(!toner)
Furrior marked this conversation as resolved.
Show resolved Hide resolved
visible_message("<span class='notice'>На [src] мигает красная лампочка. Похоже закончился тонер.</span>")
AyIong marked this conversation as resolved.
Show resolved Hide resolved
var/obj/item/paper/paper = new(loc)
var/datum/bureaucratic_form/ink = new form
ink.apply_to_paper(paper)
1 change: 1 addition & 0 deletions modular_ss220/modular_ss220.dme
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

// --- MISC --- //
#include "aesthetics_sounds/_aesthetics_sounds.dme"
#include "bureaucracy/bureaucracy.dme"
#include "crawl_speed/_crawl_speed.dme"
#include "discord_link/_discord_link.dme"
#include "emotes/_emotes.dme"
Expand Down
Loading