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

Robust Photocopiers + Adds the Access Request blank #76048

Merged
merged 26 commits into from
Jun 19, 2023

Conversation

distributivgesetz
Copy link
Contributor

@distributivgesetz distributivgesetz commented Jun 14, 2023

About The Pull Request

Currently, photocopiers parse the blanks.json file in ui_data and send the entire thing to the client. Then, the client sends the entire blank back to the server to commit it into the paper, in raw form. This is a detriment to server performance. This PR puts paper blanks into a global associative list that uses the code field as an index.

Printer toner color for some reason would check if the charges were below 10, even though default cartridges only go up to 5. The value has been changed to 2, which is still a high number. Toner cartridges are scams.

Also photocopiers now have to hold actual paper and no longer materialize it out of thin air. It's done similarly to paper bins, where there is a starting integer value dictating how much paper is inside so paper is lazily loaded into existence, as well as a paper stack list that holds newly inserted paper. Photocopier paper starts out at 30 and can go up to 60.

Additionally, the photocopier copying loop has been refactored to be a lot more sane. The previous version abused timers for copying, making a timer for each i interval to num_copies. I changed it to be a proc that loops from i to num_copies, sleeping for a short amount of time whilst playing a sound. This is a lot tidier and nicer since we don't deal with timers, plus we get to play a printing sound too. make_thing_copy now works by returning the copied object, or null if something went wrong, so we know when to continue or exit.

This PR refactors UI code so entire blanks aren't sent to the client, instead relying on the IDs for the blanks. Also, photocopiers now store actual paper and also run out of it instead of materializing some out of thin air.

Also, while I am already editing blanks.json, I added the Access Request blank because people asked me to.

I can revert the config changes if it's too much of a hassle.

Screenshots/Me testing a printer for 5 minutes

dreamseeker_gZ4Kl3QZbF

2023-06-16.00-05-20-1.mp4
2023-06-16.00-05-20-2.mp4
2023-06-16.00-05-20-3.mp4
Access Request form

image

image

image

Why It's Good For The Game

Speeb. Also having photocopiers relying on an ingame stock of paper is also very cool.

Changelog

🆑 distributivgesetz
add: Photocopiers now use actual paper instead of materializing it out of thin air.
add: Adds the "Access Request" form.
refactor: Greatly improve the reliability and performance of photocopiers.
qol: Changed the blanks so they look nicer, whilst also fixing the lawsuit request form.
qol: Nanotrasen's bureaucracy division has ""improved"" the quality of their printer toner after many complaints from furious customers.
/:cl:

@tgstation-server tgstation-server added Feature Exposes new bugs in interesting ways Refactor Makes the code harder to read UI We make the game less playable, but with round edges Config Update Time to bother the headadmins for three months to get your config applied Quality of Life Increasing esword damage is not a quality of life for traitors labels Jun 14, 2023
@distributivgesetz distributivgesetz marked this pull request as ready for review June 14, 2023 15:34
@distributivgesetz distributivgesetz changed the title Many photocopier improvements Many photocopier improvements, adds the Access Request blank Jun 14, 2023
@distributivgesetz distributivgesetz changed the title Many photocopier improvements, adds the Access Request blank Many photocopier improvements + Adds the Access Request blank Jun 14, 2023
@distributivgesetz
Copy link
Contributor Author

i'm considering reworking do_copy_loop to not abuse timers as much

@Singul0
Copy link
Contributor

Singul0 commented Jun 16, 2023

HoP-bros WE ARE SO BACK

@distributivgesetz distributivgesetz changed the title Many photocopier improvements + Adds the Access Request blank Robust Photocopiers + Adds the Access Request blank Jun 16, 2023
Copy link
Member

@san7890 san7890 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a refactor so congratulations on all the extra work you can do while you touch up this file to make it more robust. most of it is the same nit though

code/modules/paperwork/photocopier.dm Show resolved Hide resolved
code/modules/paperwork/photocopier.dm Outdated Show resolved Hide resolved
code/modules/paperwork/photocopier.dm Outdated Show resolved Hide resolved
code/modules/paperwork/photocopier.dm Outdated Show resolved Hide resolved
code/modules/paperwork/photocopier.dm Outdated Show resolved Hide resolved
code/modules/paperwork/photocopier.dm Outdated Show resolved Hide resolved
code/modules/paperwork/photocopier.dm Outdated Show resolved Hide resolved
code/modules/paperwork/photocopier.dm Outdated Show resolved Hide resolved
code/modules/paperwork/photocopier.dm Outdated Show resolved Hide resolved
code/modules/paperwork/photocopier.dm Outdated Show resolved Hide resolved
@san7890 san7890 merged commit 9972102 into tgstation:master Jun 19, 2023
18 checks passed
github-actions bot added a commit that referenced this pull request Jun 19, 2023
comfyorange added a commit that referenced this pull request Jun 19, 2023
@distributivgesetz distributivgesetz deleted the photocopier-changes branch June 19, 2023 08:24
Jolly-66 pushed a commit to TaleStation/TaleStation that referenced this pull request Jun 20, 2023
…lank (#6314)

Original PR: tgstation/tgstation#76048
-----
## About The Pull Request
Currently, photocopiers parse the `blanks.json` file in `ui_data` and
send the entire thing to the client. Then, the client sends the entire
blank back to the server to commit it into the paper, in raw form. This
is a detriment to server performance. This PR puts paper blanks into a
global associative list that uses the `code` field as an index.

Printer toner color for some reason would check if the charges were
below 10, even though default cartridges only go up to 5. The value has
been changed to 2, which is still a high number. Toner cartridges are
scams.

Also photocopiers now have to hold actual paper and no longer
materialize it out of thin air. It's done similarly to paper bins, where
there is a starting integer value dictating how much paper is inside so
paper is lazily loaded into existence, as well as a paper stack list
that holds newly inserted paper. Photocopier paper starts out at 30 and
can go up to 60.

Additionally, the photocopier copying loop has been refactored to be a
lot more sane. The previous version ~~ab~~used timers for copying,
making a timer for each i interval to num_copies. I changed it to be a
proc that loops from i to num_copies, sleeping for a short amount of
time whilst playing a sound. This is a lot tidier and nicer since we
don't deal with timers, plus we get to play a printing sound too.
`make_thing_copy` now works by returning the copied object, or null if
something went wrong, so we know when to continue or exit.

This PR refactors UI code so entire blanks aren't sent to the client,
instead relying on the IDs for the blanks. Also, photocopiers now store
actual paper and also run out of it instead of materializing some out of
thin air.

Also, while I am already editing `blanks.json`, I added the Access
Request blank because people asked me to.

I can revert the config changes if it's too much of a hassle.

<details>
<summary>Screenshots/Me testing a printer for 5 minutes</summary>


![dreamseeker_gZ4Kl3QZbF](https://github.com/tgstation/tgstation/assets/47710522/b601b79a-1b2f-4d7f-b72a-f62dad217698)


https://github.com/tgstation/tgstation/assets/47710522/11c4b63b-7cfc-4425-96c6-970d4a5f51ca


https://github.com/tgstation/tgstation/assets/47710522/2f7a4a15-3400-49f3-9aca-c4d04c886bec


https://github.com/tgstation/tgstation/assets/47710522/14afe7d9-53ea-4d17-870f-1e90319284eb

</details>

<details>
<summary>Access Request form</summary>


![image](https://github.com/tgstation/tgstation/assets/47710522/0cf99542-24d1-41ca-8aa9-26bb201a79c0)


![image](https://github.com/tgstation/tgstation/assets/47710522/36418c42-eb82-4c13-ab65-08f6486cf613)


![image](https://github.com/tgstation/tgstation/assets/47710522/7acde2ff-040a-40bf-8898-398c2150655e)


</details>

## Why It's Good For The Game
Speeb. Also having photocopiers relying on an ingame stock of paper is
also very cool.

## Changelog
:cl: distributivgesetz
add: Photocopiers now use actual paper instead of materializing it out
of thin air.
add: Adds the "Access Request" form.
refactor: Greatly improve the reliability and performance of
photocopiers.
qol: Changed the blanks so they look nicer, whilst also fixing the
lawsuit request form.
qol: Nanotrasen's bureaucracy division has ""improved"" the quality of
their printer toner after many complaints from furious customers.
/:cl:

---------

Co-authored-by: distributivgesetz <distributivgesetz93@gmail.com>
@DATA-xPUNGED
Copy link
Contributor

Hey, so last time i tried HoP, this PR just basically didn't look like it was added, what the hell is going on with that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Config Update Time to bother the headadmins for three months to get your config applied Feature Exposes new bugs in interesting ways Quality of Life Increasing esword damage is not a quality of life for traitors Refactor Makes the code harder to read UI We make the game less playable, but with round edges
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants