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

[MDB Ignore] [IDB Ignore] Massive TGUI-focused port from upstream #678

Open
wants to merge 287 commits into
base: master
Choose a base branch
from

Conversation

siliconOpossum
Copy link
Contributor

@siliconOpossum siliconOpossum commented Feb 26, 2025

As the title says, the primary goal here was the PRs converting everything over to TGUI-Core to make 516 compatibility easier, but my ulterior motive was to pull in other improvements that came along the way, some highlights include, in no particular order:

  • Generally just better performing UI, less janky, more reliable
  • Fullscreen QOL
  • Bumps all of the deps, including replacing AuxLua with DreamLuau if that interests anyone
  • Very pretty new stack crafting, vending machine, smart-fridge, language menu, and supply console UIs, probably others I forgot
  • Datumized admin verbs, makes adding modular admin verbs easier, no longer requiring non-modular changes
  • Definitely other things, probably

The culmination of a surprisingly high and simultaneously surprisingly little amount of work at times, this is a full year worth of changes to an entire top-level folder of the codebase.
It compiles, passed tgui-lint, and if anything's broken, I couldn't find it, I'd be shocked though if there isn't something left that I didn't find, lets just hope whatever it is isn't too important.

siliconOpossum and others added 30 commits February 22, 2025 16:10
Remakes Battle Arcade from just about the ground up, with exceptions
taken for emagged stuff since I didn't really want to touch its
behavior.

The Battle Arcade now has stages that players can go through, unlocking
a stage by beating 2 enemies and the boss of the previous one, but this
must all be done in a row. You can choose to take a break between each
battle and there's a good chance you'll sleep just fine but there's also
a chance it can go wrong either through an ambush or robbery.

The Inn lets you restore everything for 15 gold and you can buy a sword
and armor, each level you unlock is a new sword and armor pair you can
buy that's better than the last, it's 30 gold each but scales up as you
progress through levels. They are really worth getting so it's best to
try to not lose your money early in.

The battle system is nearly the same as how it was before but I removed
the poor combo system that plagued the old arcade as one big knowledge
lock, now it's more just turn based. The game is built on permadeath so
dying means you restart from the beginning, but if you are going to lose
you can try to escape instead which costs you half of your gold.

Getting to higher levels increases the difficulty of enemies but also
increases the gaming exp rewards which could make this a better way to
get exp if you can get good at it.

Gaming EXP is used to increase chances of counterattacking but doesn't
give any extra health to the player.

I also removed the exploit of being able to screwdriver arcade cabinets
because people would do that if they thought they were on the verge of
losing to bypass the effects of loss. I instead replaced it with a new
interaction that the Curator's display case key can be used to reset
arcade cabinets (there's several keys on the chain so it made sense to
me), which I added solely because I thought Curators would be the type
of person to have run an actual arcade.

This is some gameplay

https://github.com/tgstation/tgstation/assets/53777086/499083f5-75cc-43b5-b457-017a012beede

As a misc sidenote, I also split up the arcade file just like how Orion
Trail was before, just for neat code organization.
The Inn keeper is straight up just a photo of my localhost dude, he's
not a player reference or anything it's not my actual character.
I also have no idea how well balanced this is cause I suck at it lol.

Battle Arcade is one of 3 last machines in my hackmd here to turn into
TGUI https://hackmd.io/XLt5MoRvRxuhFbwtk4VAUA?view
I've always thought the current version of battle arcade is quite lame
and lacks any progression, like Orion Trail I thought that since I was
moving this to TGUI, it would also be a perfect opportunity to revamp it
and try to improve on where it failed before, especially since the
alternative (NTOS Arcade) is also lame as hell and is even lamer than
HTML battle arcade (spam mana, then spam health, then just spam attack,
rinse and repeat).
This will hopefully be more entertaining and give players sense that
they are getting through a series of tasks rather than doing one same
one again and again.

:cl: JohnFulpWillard, Zeek the Rat
add: Battle Arcade has been completely overhauled in a new progression
system, this time using TGUI.
add: The Curator's keys can now reset arcade cabinets.
balance: You now need to be literate to play arcade games, except for
Mediborg's Amputation Adventure.
fix: You can no longer screwdriver emagged arcade consoles. Accept your
fate.
fix: Silicons can no longer play Mediborg's Amputation Adventure.
/:cl:

---------

Co-authored-by: Jeremiah <[email protected]>
- Fixes #82119. ph is not computed & shown when recording recipes is
enabled. The ph value was inaccurate anyway because it was not computed
from the recorded recipe but from the beaker.
- Removed deprecated `content` tag from buttons in the UI

:cl:
fix: chem dispenser UI doesn't brick when beaker is ejected while
recording recipes
code: removed deprecated `content` tag from buttons in chem dispenser
/:cl:
## About The Pull Request
Title. Had some extra time, converted some UIs to use
usestate/usecontext rather than uselocalstate.

PAI available software interface was adjusted a little.

<details>
<summary>pictures</summary>

before
![Screenshot 2024-05-20
155616](https://github.com/tgstation/tgstation/assets/42397676/ea5e66bc-1257-4fad-ac8c-6ed40df70563)

after
![Screenshot 2024-05-20
155927](https://github.com/tgstation/tgstation/assets/42397676/2b86f44c-27e9-4bc4-9503-dd3d5a41e4a4)


![image](https://github.com/tgstation/tgstation/assets/42397676/4f745a4d-14c8-429f-91ca-9e06e505c7fc)

</details>

## Why It's Good For The Game
Uselocalstate is deprecated in favor of using plain react hooks.
## Changelog
:cl:
fix: Slightly cleaned up PAI software downloads interface
/:cl:
## About The Pull Request
They were using a nested uselocalstate which I naively converted to
usestate

This gave it the treatment(tm) which means just simplifying it by not
creating a component which maps new items inside of itself

I also fixed the layout shift caused by buttons / pricing

![image](https://github.com/tgstation/tgstation/assets/42397676/f8f99d68-4d50-4d73-a266-020487e6764b)
## Why It's Good For The Game
Fixes #83571
## Changelog
:cl:
fix: Fixed the biogenerator's tabs
/:cl:
A redo of #82679. A new UI for heretic research that organizes the nodes
into tiers and gives them icons.

This is done by a few new variables for the knowledge datum, which hold
the level it should be located at, and the icon it should have. If not
specified, an icon is automatically generated for summons, spells,
eldritch marks and ascensions. You may also only specify some of the
parameters, in which case the rest is generated automatically.

Also three notable related changes:
- fixes a typo where the eldritch flask texture's state was called
"eldrich_flask"
- moves the code responsible for granting the ascension achievements
into the parent path, the children simply hold a new variable to store
the achievement to be granted. (apart from on its own being a good
refactor, this also makes it possible to generate the ascension icons by
taking the achievement sprites)
- DmIcon now takes any type for the `movement` argument and casts it
into boolean on its own, so that we can pass it `BooleanLike`

![image](https://github.com/tgstation/tgstation/assets/44502667/ed20dfb4-8152-419b-8f41-eaae3097271e)

![image](https://github.com/tgstation/tgstation/assets/44502667/a7746d1c-f4d7-4d55-8151-0419362d8386)

![image](https://github.com/tgstation/tgstation/assets/44502667/1b86296b-4f8c-4276-b38b-6e4d06e59c1c)

![image](https://github.com/tgstation/tgstation/assets/44502667/46bebb6b-9666-470c-9a88-9b914568ca0d)

![image](https://github.com/tgstation/tgstation/assets/44502667/5ca35f31-b12c-4a58-810a-70ec2887317a)

![image](https://github.com/tgstation/tgstation/assets/44502667/569c2655-1ee8-4696-baaa-ca6fc3c29348)

Pretty UI is good. Makes the research interface less confusing by at
least showing what nodes are more advanced, and will lead to ascension,
and giving a rough idea of the relationship of the paths.

:cl:
add: Added a new UI for heretic research.
/:cl:
I am back to pushing my code improvements upstream, sorry in advance.
As the title says, this adds support for achievement icons to be in
different dmi files than the default, pretty much the exact same way
that Language icons (for chat assets) do.

It is one of the few things in game (the only other thing i can think of
that does this rn is barsigns) that cannot have their icon changed when
trying to make a subtype, this is very limiting and very annoying,
especially since dmi conflicts are one of the worst types to deal with,
this would make my life a lot easier.

No player-facing changes.
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request

<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->
As the title says. Upgrades the menu and allows you to create action
button shortcuts.


![image](https://github.com/tgstation/tgstation/assets/37270891/902d5e2b-de50-463e-a566-062ee24cc138)

![image](https://github.com/tgstation/tgstation/assets/37270891/0ce025e3-2f38-4013-8cde-00af12584086)

![image](https://github.com/tgstation/tgstation/assets/37270891/88ad4a30-dd65-4275-912c-b341264d77fd)

Additionally, bots can now select the radio channel if they have one.

Lowers the cooldown for voice lines.

## Why It's Good For The Game

<!-- Argue for the merits of your changes and how they benefit the game,
especially if they are controversial and/or far reaching. If you can't
actually explain WHY what you are doing will improve the game, then it
probably isn't good for the game in the first place. -->
Being able to more conveniently send a voice line by pressing a button
without needing to open up an interface and navigate to the correct line
will make using these a lot easier in relevant situations.

Voice line cooldowns are lowered a bit just to make voice lines easier
to use in relevant situations.
I.e. 'Extinguishing fire' -> 5 seconds later -> 'Fire extinguished'

Abuse should generally just be punished by the admins, the cooldown
doesn't need to be too lengthy.

## Changelog

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
mark your PRs to prevent unnecessary GBP loss. You can read up on GBP
and it's effects on PRs in the tgstation guides for contributors. Please
note that maintainers freely reserve the right to remove and add tags
should they deem it appropriate. You can attempt to finagle the system
all you want, but it's best to shoot for clear communication right off
the bat. -->

:cl:
qol: Bots can now bind voice lines to an action slot. Lowers cooldown
for all bot voicelines to 5 seconds.
/:cl:

<!-- Both :cl:'s are required for the changelog to work! You can put
your name to the right of the first :cl: if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->

---------

Co-authored-by: Watermelon914 <[email protected]>
makes air lock controllers use tgui

![image](https://github.com/tgstation/tgstation/assets/138636438/a5bba240-d0a2-4bef-b72b-3717e1a13f09)
they will now use tgui instead of html
:cl:
refactor: airlock controllers now use tgui
/:cl:
**1. Qol**
- Adds screen tips & examines for screwdriver, wrench, crowbar & beaker
insertion, removal & replacing actions
- Analyzing reagents is now a client side feature & not a back end mode,
meaning one person can see details of a reagent while the other can
print stuff and do other operations so it's a non blocking operation.
This also means 2 players can see information of 2 different reagents in
their own screens, With that the overlay for analysis mode has been
removed
- You cannot do any tool acts on machines while printing. Balloon alerts
will be displayed warning you of that.
- The preferred container for the master reagent in the beaker is now
showed in both condiment & chem master. It can be enabled/disabled via a
CheckBox

**2. Code Improvements**
- Removed defines like `TARGET_BEAKER` , `TARGET_BEAKER` etc. ther
functionality is implemented as params in the `transfer_reagent()` proc
directly
- Removed all variables relating to analyzing reagents like
`reagent_analysis_mode`, `has_container_suggestion` etc. all memory
savings
- `printable_containers` now stores static values that can be shared
across many chem masters
- Updates only overlays and not the whole icon during operations for
efficiency

**3. Fixes**
- You can hit the chem master with the screwdriver, wrench, crowbar &
beaker when in combat mode
 - You cannot insert hologram items into the chem master
- Deconstructing a condiment master will give you the circuit board
already pre-programmed with that option selected so you don't need to
use a screwdriver to re program it
- `printing_amount` is now the maximum number of containers that can be
printed at a time. Presently this number with upgraded parts would print
out empty containers especially for patches. This is because
`volume_per_item` does not take into consideration this var. Also this
var would not give control to the player on exactly how many containers
to print as whatever amount the player entered would be multiplied with
this value producing a lot of waste & worse empty containers. Now this
var determines exactly how many containers you can print and is imposed
on the client side UI as well

**4. Refactors (UI performance)**
- Beaker data is compressed into a single entity & sent to the UI. This
is set to null if no beaker is loaded thus saving data sent
- Reuses Beaker props from chem synthesizer to reduce code
- reagent REF replaced with direct type converted to text and later
converted with `text2path()` cause its much faster

:cl:
qol: Adds screen tips & examines for screwdriver, wrench, crowbar &
beaker insertion, removal & replacing actions
qol: Analyzing reagents no longer blocks other players from doing other
operations. Multiple players can analyze different reagents on the same
machine
qol: You cannot do any tool acts on the machine while printing to
prevent any side effects.
qol: The preferred container for the master reagent in the beaker is now
showed in both condiment & chem master. The feature can be
enabled/disabled via a check box
code: removed defines for reagent transfer, vars for reagent analyzis to
save memory. Autodoc for other vars & procs
fix: You can hit the chem master with tools like screwdriver, crowbar,
wrench & beaker in combat mode
fix: You cannot insert hologram items into the chem master
fix: Deconstructing a condiment master will give you the circuit board
already pre-programmed with that option
fix: You now print the exact amount of containers requested even with
upgraded parts without creating empty containers. Max printable
containers is 13 with tier 4 parts able to print 50 containers.
refactor: Optimized client side UI code & chem master as a whole.
/:cl:

---------

Co-authored-by: MrMelbert <[email protected]>
This completely reworks how ghetto chem separator works & brings more
depth & immersion to it. To understand the new system let's compare it
with the current one

**Old System**
1. You insert a beaker containing the reagents you want to separate.
2. You use a lighter/whatever to light a flame, Flame has _magic &
unrealistic_ properties such as
    - It will never heat the beaker above 100k
    - It doesn't burn oxygen or use fuel source to sustain it
- Distillation rate is a constant 5u/s. It doesn't increase as the
solution boils hotter

3. The apparatus sorts the reagents alphabetically? & transfers the 1st
reagent from sorted list to the target beaker. It does not care if each
individual reagent has their boiling points & how to separate them based
on that etc. It's just bland overall

**New System**
1. You insert a beaker containing the reagents you want to separate,
just lke the old system
2. You use a lighter/whatever to light a flame just like the old system,
however flame behaves in a more realistic fashion as follows
- It will heat the beaker all the way to 1000k if you let it run long
enough
- It now burns oxygen & uses a fuel source(a secondary beaker which you
must insert containing flamable reagents like oil, welding fuel etc).
When oxygen is the fuel source no O2 gas is required
    - Distillation rate starts at 2u/s & increases with rising temps
- Intensity of the flame depends on the quality of reagents used as
fuel, Oil has best flammable quality & will heat the beaker faster,
other reagents mixed in various proportions can produce better quality
flames which you can understand by examining the aparatus
    - The flame intensity can be adjusted via the burner knob setting
3. Each reagent now has their _boiling computed_ computed from their
mass allowing for realistic interactions, like having to control the
temp's just right to separate your required reagent
4. Temps automatically cooldown and you can install a condenser to
Facilitate faster cooling

Here's the demo video explaining everything

https://github.com/tgstation/tgstation/assets/110812394/ba591859-3fff-4d06-90f8-024c7266f830

🆑
refactor: ghetto chem separator has been reworked from scratch. See PR
83275 for details
qol: adds examines & screentips for ghetto chem separator
/🆑
- If the chem master runs out of power mid printing, it will properly
stop the printing process and its animation
- When transferring reagents it correctly checks if we have enough power
without forcing it

:cl:
fix: chem master properly shuts down if it loses power mid printing and
won't transfer reagents for the same
/:cl:
## About The Pull Request
Fixes #84938 by adding a check for whether a beaker is inserted into the
machine, and added a feedback message.
## Why It's Good For The Game
Fixes #84938.
## Changelog
:cl:
fix: deleting reagents from the chemmaster buffer works without a beaker
inserted
/:cl:

---------

Co-authored-by: Ghom <[email protected]>
Tgui core seems to be holding steady, so I'm working to move more UIs
over to it. This converts all UIs from A-C to use tgui-core components.

I also version bumped tgui-core, check the changelog:
https://github.com/tgstation/tgui-core/releases/tag/v1.1.3
Tgui tuneups
Updates some of the dependencies in tgui. Should have zero gameplay
impact at all.

This puts our typescript version up to 5.4.3! And it detected errors
immediately

Bzzz here comes the airplane

N/A
…3597)

## About The Pull Request
Swaps moduleResolution to the recommended setting. Should have no averse
effects anywhere.

Current moduleResolution: "Node" gives this tooltip message:
`Node: Deprecated, use "Node10" in TypeScript 5.0+ instead`

This PR:
moduleResolution: "Bundler"
`Bundler: This is the recommended setting in TypeScript 5.0+ for
applications that use a bundler` (aka us)

More info https://www.typescriptlang.org/tsconfig/#moduleResolution
## Why It's Good For The Game
If you're wondering what this PR is even for, I'd like to centralize tg
components eventually so we can distribute them as a npm package. This
lets me use the aliased imports from that package, so if we do make that
change it's one line:


![image](https://github.com/tgstation/tgstation/assets/42397676/1dbb0180-01ea-42fb-b8c2-dc83c3b2bd1a)

In return we get to delete the entire tgui components folder, their
style sheets, the common package, and maybe more. I have tested this
using my (future PR) tgui library and it works.
## About The Pull Request
Context: #82522

Apparently you cant just stuff the byond helper functions into an
external js file, but if you do, byond won't even let you know its a
problem until the servers crash and you have to run `bin/clean` just to
unbork your entire repo

This reimplements the changes from #82473 without:
- moving the byond helper functions externally
- causing a tooltip render issue in panel

## Why It's Good For The Game
516 prep (again this time)
This stores the icon ref map for DmIcon globally so external libraries
(tgui-core) can use it.

- Bumps tgui-core to latest for support of this feature
- Moves bodyzoneselector out to common interfaces (really a group of
components)

Fixes #84756

Kind of silly to market a package which isn't able to provide our
coolest component

:cl:
fix: Fixed a bluescreen in the heretic research ui
/:cl:
…087)

## About The Pull Request
See title.
scrollableRef is no longer a variable that exists on the Section datum,
instead it forwards a ref.
onChange has a lagging effect, changing it to onInput allows for
responsiveness.

## Why It's Good For The Game
Fixes bugs

## Changelog
:cl:
fix: Fixed the lua editor being outright broken.
/:cl:

Co-authored-by: Watermelon914 <[email protected]>
…ile|null (#82202)

## About The Pull Request
My lua scripts were hitting the topic byte limit, so this makes file
upload of lua scripts able to bypass the topic limit.

## Why It's Good For The Game
Removes arbitrary restriction on how big a lua file can be in bytes.

## Changelog
:cl:
admin: Admins can now run lua files bigger than 36 KB by importing them
directly.
/:cl:

Co-authored-by: Watermelon914 <[email protected]>
…ler. (#82131)

## About The Pull Request
Lua uses the timer subsystem, which can end up holding the entire timer
subsystem if lua is creating a lot of timers.
The solution to this is to use an internal scheduler instead so that the
load gets placed onto the lua subsystem.

## Why It's Good For The Game
Performance improvement when using lua scripts.

## Changelog
:cl:
refactor: Auxlua no longer uses the timer subsystem to get stuff done,
lua scripts shouldn't slow down timers anymore.
/:cl:

---------

Co-authored-by: Watermelon914 <[email protected]>
…andling multiple signals on different objects. (#82458)

## About The Pull Request
Cleaned up the SS13.register_signal and SS13.unregister_signal, removing
the weird list shifting.
Also adds a new lua file that can be included for the use of registering
different signals on various datums and being able to clear them all in
1 function.
Removed the make_easy_clear_function option when registering a signal
via lua because I don't think it's used by anyone and it lacks any sort
of versatility. Users can just create their own function for clearing
signals from a datum.

Also updates the documentation for HARDDELETES.md as
COMSIG_PARENT_QDELETING was renamed to COMSIG_QDELETING

## Why It's Good For The Game
New handler file makes registering signals in batches a lot easier if
you want to clear them in one go without clearing unrelated callbacks on
the same datum. The list shifting in SS13.register_signal had pretty
significant performance problems, so removing that will make registering
and unregistering signals faster.

## Changelog
:cl:
admin: LUA - Adds a new library called handler_group. Include it in your
files by doing require('handler_group')
/:cl:

---------

Co-authored-by: Watermelon914 <[email protected]>
…eted datums (#82597)

## About The Pull Request
See title

## Why It's Good For The Game
More descriptive error message

## Changelog
:cl:
fix: LUA: Registering a signal on a deleted datum will throw a more
descriptive error message.
/:cl:

---------

Co-authored-by: Watermelon914 <[email protected]>
## About The Pull Request
Signals don't get removed on turfs when they're deleted. This fixes that
so that it is reflected in lua as well.

## Why It's Good For The Game
Lua bugfixes

## Changelog
:cl:
fix: Fixed lua scripts breaking when turfs with registered signals get
deleted.
/:cl:

---------

Co-authored-by: Watermelon914 <[email protected]>
## About The Pull Request

Noticed during #82138

Basically, the unit test that makes sure that all of the subsystems that
had to initialize properly initialized is good with the Notice
annotation, but it had a flaw - it didn't tell you _why_ the subsystem
failed to initialize:


![image](https://github.com/tgstation/tgstation/assets/34697715/3cd719d2-2f1f-42a9-8c36-d5c37b8a330c)

Basically this PR just adds a variable, `initialization_failure_message`
(i have it on good authority that variables that don't get changed from
their compile time variable don't take up extra memory), and we just
append the failure message to this notice should it occur so all of the
information is available in one spot, rather than have the coder dig
through the CI Run Log to figure out what the specific error was should
it occur on something that isn't SSlua.

also small cute code cleanup :3
## About The Pull Request
Does a full shutdown of auxlua when the lua subsystem shuts down. This
should unpin the dll file.

Compare `AUXTOOLS_SHUTDOWN` code with `AUXTOOLS_FULL_SHUTDOWN`, let me
know if I'm mistaken:

### AUXTOOLS_SHUTDOWN


https://github.com/willox/auxtools/blob/bc5b2cf019f0f9b18f46b560a0f730d709171b55/auxtools/src/lib.rs#L346

### AUXTOOLS_FULL_SHUTDOWN


https://github.com/willox/auxtools/blob/bc5b2cf019f0f9b18f46b560a0f730d709171b55/auxtools/src/lib.rs#L365

## Why It's Good For The Game
Fixes auxlua keeping the dll pinned when the server is in a process of
shutting down.

Co-authored-by: Watermelon914 <[email protected]>
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request

<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->
Lua errors don't get logged when `call_function` is called

Timer.start_loop was just straight up broken due to me not properly
testing it, so this fixes that.

## Why It's Good For The Game

<!-- Argue for the merits of your changes and how they benefit the game,
especially if they are controversial and/or far reaching. If you can't
actually explain WHY what you are doing will improve the game, then it
probably isn't good for the game in the first place. -->
Makes debugging lua scripts easier. Also fixes bugs.

## Changelog

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
mark your PRs to prevent unnecessary GBP loss. You can read up on GBP
and it's effects on PRs in the tgstation guides for contributors. Please
note that maintainers freely reserve the right to remove and add tags
should they deem it appropriate. You can attempt to finagle the system
all you want, but it's best to shoot for clear communication right off
the bat. -->

:cl:
fix: Fixed lua error logging.
fix: Fixed the SS13.start_loop function not working properly.
/:cl:

<!-- Both :cl:'s are required for the changelog to work! You can put
your name to the right of the first :cl: if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->

---------

Co-authored-by: Watermelon914 <[email protected]>
…83483)

## About The Pull Request
As the title says. This should significantly improve the performance of
running lua scripts.

## Why It's Good For The Game
There is a lot of performance overhead in logging each individual
function called by a lua script as can be seen in the following
screenshot:
This is a test done on a local server where I run the
`zombie_controller.lua` script that can be found on the auxlua-cookbook
repository with a lot of AI zombies spawned in.

![image](https://github.com/tgstation/tgstation/assets/37270891/fb8ee2d8-0b4c-49d7-823a-a552cde6cb10)

![image](https://github.com/tgstation/tgstation/assets/37270891/186c2cb0-82f9-4914-bd29-df19e1c0dbe1)

Logging these calls is not necessary as it doesn't provide any real
information to anyone looking for bad actors. Lua scripts are already
logged when ran and they can be examined to spot if the script being run
is done so in bad faith.

---------

Co-authored-by: Watermelon914 <[email protected]>
Ghommie and others added 17 commits February 25, 2025 22:49
## About The Pull Request
Kapu told us to do it because it has the function for sound length now.

## Why It's Good For The Game
rust_g updated.

## Changelog
N/A

---------

Co-authored-by: Watermelon914 <[email protected]>
## About The Pull Request

https://github.com/tgstation/rust-g/releases/tag/3.6.0

IconForge and hash functions

## Why It's Good For The Game

Routine version bump
## About The Pull Request
This is an improvement on #80839 regarding how custom materials are set
on items, it's based on the following findings.

1. `set_custom_materials()` proc already comes with an prebuilt
`multiplier` var

https://github.com/tgstation/tgstation/blob/1e8d511946d194f92f744f5f957a7c41683d84a6/code/game/atom/atom_materials.dm#L11
This means we can pass the machine's cost coefficiency directly to this
proc rather than creating our own list of materials with their values
scaled by the factor like so

https://github.com/tgstation/tgstation/blob/1e8d511946d194f92f744f5f957a7c41683d84a6/code/game/machinery/autolathe.dm#L192-L193
We can instead just do `set_custom_materials(design.materials,
material_cost_coefficient)` without ever needing this list, thus making
code cleaner, with that the changes propogate to how `has_materials()` &
`use_materials()` procs are also used as we can now use their
`coefficiency` param rather than seeing it go to waste

2. All items custom materials will now always be integer values. With
this `SSmaterials.FindOrCreateMaterialCombo` now has better performance
because when computing the key for caching values like `1.5` or `1.7` it
will become just `1` and will point to the same cache thus reducing
memory usage

3. Materials are now uniformly split among all the contents of a printed
item from techfab or autolathe. What this means is items like the foam
ammo box printed from autolathe will have both the ammo case and their
40 bullets each set with custom materials such that their final sum
becomes equal to the design cost. For info on how that's done see the
documentation of `split_materials_uniformly` proc.

One downside of this proc is when items have a very small amount of
`custom_materials`(less than 2). In that case values like `0.8` or `1.5`
or `1.7` ends up getting rounded to 1 which means you end up getting
less materials when recycling than what you used for printing that item.
In this case You get 0.48 iron from both the box & it's ammo instead of
0.79 iron used for printing in tier1 autolathe(Or 0.50 for tier4
autolathe).
    
This shouldn't be an issue as you still can't make any profits from this
but at least everything in the box is now recyclable.

## Changelog
:cl:
fix: items that contain recursive contents inside them (like foam dart
boxes from autolathes) now have their custom materials set to match with
its design cost rather than being nullified, meaning they are now
recyclable.
code: all custom materials are now integer values. Improved code for how
materials are used in techfab & auto lathe for printing
/:cl:
## About The Pull Request
- Fixes #81115

Right we have to start the sum from `0` my bad. Also uses material
define constant when inserting sheets instead of constant `100`

## Changelog
:cl:
fix: auto lathes don't hog local apc supply when printing items
/:cl:
…r (#81198)

check for area.requires_power
## About The Pull Request

If the area is supposed to not require power, we should respect that
Also it doesnt make sense to use all the power at once even though we
print items in series not parallel

fixes #81155

## Changelog
:cl:
fix: lathes now respect always-powered areas
balance: lathes now use power as they print instead of all at once
/:cl:
## About The Pull Request

you may no longer reset drop direction at range and stuff

## Why It's Good For The Game

bug bad

## Changelog
:cl:
fix: you may no longer reset autolathe drop direction at times when you
shouldnt be able to
/:cl:
…of mineral balance (#81151)

## About The Pull Request


![image](https://github.com/tgstation/tgstation/assets/41715314/9ea9b578-d394-4a0e-971c-7f1099acae4a)

![image](https://github.com/tgstation/tgstation/assets/41715314/ab06a6b8-ab7c-4db4-86a8-e91d4f0bb771)

![image](https://github.com/tgstation/tgstation/assets/41715314/5d08ee4b-4005-4175-9f21-a0295f1596c5)

With the merge of #78524, we have a significant amount more control over
how many materials are entering the round, as if it's overtuned, we can
adjust the mineral spawning percentages, and if it's undertuned we can
do vice-versa. Similarly with ore vents, we can adjust how much of every
resource will spawn, allowing for items that can be printed via the
lathe to have a significant more impact on how much they cost depending
on round balance.

Going forward, this data can be found using the mineral logging and
graphing tool found in `tools\silo_grapher\silo_graph_script.py` to make
future balance decisions. These tools combined allow for a full suite of
resource controls going in and out of the round for decisions to be made
on item printing.

## Why It's Good For The Game

We needed better control on resources going in and out of the round for
the massive, massive quantity of items in game limited by being
extremely cheap to print on the lathe.

We have those resource controls now, and the tools to adjust the balance
as necessary. Therefore, I'm fine with us axing this.

Fixes #67009, and fixes #66601.

I would wait out the last bit of the freeze but ahh fuck it I don't see
why not to do it now

## Changelog

:cl:
del: The lathe tax on printing items has been removed from the game for
both humans and silicons.
/:cl:
## About The Pull Request
1. **Qol Stuff**
- Screentips & examines for screwdriver, crowbar acts, multiool &
wirecutter Also for Alt click
- Techfabs can now also use the Mouse drag functionality to set drop
target for items
- Lathe printing animation now plays on loop instead of just flicking
once till printing is finished for more visual feedback

2. **Code Improvements**
- Merged `start_making()` with `do_make_item()`. That proc was like only
3 lines long and used only in 1 place so let's just move that code to
`ui_act()`
- Merged `user_print_item_id()` with `ui_act()`. Again was used only in
1 place so let's just move that code in to save some proc overhead
- Sets `processing_flags` for autolathe to `NONE` cause we don't use
`process()`
    - Autodocs vars such as `hacked` , `shocked` etc & procs
- `maxmult` is now computed client side saving backend bandwidth,
`construction_time` is removed from lathes which did not use it
- Removed all usages of lathe taxes and their related vars, removed
engineering lathe no tax from ice moon, replaced with normal engineering
lathe

3. **Fixes**
- Lathe sheet insertion animations are now linked & work again for all
material types inserted via remote silo/local storage,
silver/titanium/plastic all play the same animation(that is
`protolathe_shiny` overlay). Other materials have their own respective
overlays
- Fixes #81243. Calling `update_static_data_for_all_viewers()` is too
expensive for the UI. We should instead use `SStgui.update_uis(src)`
which will report the `busy` status to the UI more immediatly
- Fixes #81236. Some problems with the params passed to the timer
callback. It should now print the correct number of requested items
- Fixes #81192. `design.materials` would runtime for custom material
items as they were list of texts not materials. We have to pass our
manually parsed list of materials for an specific item to ensure they
are set & used correctly. Same fixes apply for techfabs as well


## Changelog
:cl:
qol: adds screentips & examines for screwdriver & crowbar acts & alt
click.
qol: techfabs can now use the mouse drop functionality to set drop
target.
qol: lathe printing animation plays on loop while printing rather than
flicking once for more visual feedback
fix: lathe sheet insertion animations are now linked & work again for
all material types inserted via remote silo/local storage
fix: printing custom materials items from autolathe works again.
fix: printing multiple items from lathes will actually print that
correct quantity of items requested.
fix: printing items the 2nd time around from lathes won't cause the UI
to reload each time.
code: autodoc for some vars & procs, merges procs.
refactor: Optimized code for autolathe & techfabs in general. Report
bugs on github
/:cl:

---------

Co-authored-by: MrMelbert <[email protected]>
Co-authored-by: Ghom <[email protected]>
## About The Pull Request
This employs a formula that creates a relationship between total stacks
of material used & the machines active power consumption

- When inserting/ejecting a full stack of materials, lathes use 1% of
the machine active power usage. To put it in player terms if your apc
has a normal high capacity power cell it will use 2% of power when
inserting a full stack(50 sheets) of material or when ejecting a full
stack of materials

- Fixes #81366. When printing multiple items that would require a full
stack of materials (50 sheets or roughly 5000 matter units) It now uses
5% of the machine active power usage. To see the comparision we will see
the same examples used in the issue

    **Old Behaviour**
- Printing 10 large beakers for tier 1 lathe would consume 48% of apc
cell
- Printing 1 circular saw for tier 1 lathe would consume 32% of apc cell
    
    **New Behaviour**
- Printing 10 large beakers for tier 1 lathe now consumes just 5% of apc
cell
- Printing 1 circular saw for tier 1 lathe now consumes just 1% of apc
cell
- Higher tier parts will consume more power to compensate for the lower
material costs because the machines active power usage increases with
higher tier parts, assuming your apc has a normal high capacity power
cell
- Printing 10 large beakers for tier 4 lathe now consumes 12% of apc
cell
- Printing 1 circular saw for tier 4 lathe now consumes 5% of apc cell
      
This formula is experimental and i just made it up so let's see how this
plays out

## Changelog
:cl:
fix: lathes now use moderate power for printing operations
/:cl:
[Removes all other listlike var
accesses](tgstation/tgstation@4c5996b)

Also fucking dumpsters an unused proc that allowed for arbitrary
variable modifcation. Bad juju

This is undefined behavior and errors in later 515 versions. also it's
stupid as hell
I wrote this expecting that there would be more broken versions in the
distant future, so we could simply re-use this block for those

But I forgot this will most likely be seen by fresh contributors or
people who don't even contribute and are just testing things

So I'm just making the message as explicit as possible
This bumps the minimum compile version to 515.1642, due to [this BYOND
bug](https://www.byond.com/forum/post/2936624) where byondapi can
corrupt vars, and dreamluau is called regardless of whether a Lua script
is actually being ran (mostly via `DREAMLUAU_CLEAR_REF_USERDATA`), so
it's best to get rid of any potential of this bug triggering.

mrrrp mrrrp mrrrowww

No user-facing changes
@github-actions github-actions bot added Story Content Related to someone's character(s) Maintenance Little spring cleaning never done anyone wrong Map Oh christ what have you done Lima Station The bean station, ported originally from Russ Station. Modularity Suggested Read the README in "maplestation_modules" and follow the instructions or risk doom Cherry Picked We're behind on schedule; and this is something we fucking need Pubby Station PRs pertaining to Pubbystation, the stepchild. Kilo Station PRs pertaining to Kilo, the kidnapped map. Non-Module Code Touches main files. Proceed with caution labels Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cherry Picked We're behind on schedule; and this is something we fucking need Kilo Station PRs pertaining to Kilo, the kidnapped map. Lima Station The bean station, ported originally from Russ Station. Maintenance Little spring cleaning never done anyone wrong Map Oh christ what have you done Modularity Suggested Read the README in "maplestation_modules" and follow the instructions or risk doom Non-Module Code Touches main files. Proceed with caution Pubby Station PRs pertaining to Pubbystation, the stepchild. Story Content Related to someone's character(s)
Projects
None yet
Development

Successfully merging this pull request may close these issues.