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

[MIRROR] Converts arbitrary energy units to the joule. Fixes conservation of energy issues relating to charging cells. #2595

Merged
merged 2 commits into from
Mar 28, 2024

Conversation

Steals-The-PRs
Copy link
Collaborator

Mirrored on Nova: NovaSector/NovaSector#1593
Original PR: tgstation/tgstation#81579

About The Pull Request

Removes all arbitrary energy and power units in the codebase. Everything is replaced with the joule and watt, with 1 = 1 joule, or 1 watt if you are going to multiply by time. This is a visible change, where all arbitrary energy units you see in the game will get proper prefixed units of energy.

With power cells being converted to the joule, charging one joule of a power cell will require one joule of energy.

The grid will now store energy, instead of power. When an energy usage is described as using the watt, a power to energy conversion based on the relevant subsystem's timing (usually multiplying by seconds_per_tick or applying power_to_energy()) is needed before adding or removing from the grid. Power usages that are described as the watt is really anything you would scale by time before applying the load. If it's described as a joule, no time conversion is needed. Players will still read the grid as power, having no visible change.

Machines that dynamically use power with the use_power() proc will directly drain from the grid (and apc cell if there isn't enough) instead of just tallying it up on the dynamic power usages for the area. This should be more robust at conserving energy as the surplus is updated on the go, preventing charging cells from nothing.

APCs no longer consume power for the dynamic power usage channels. APCs will consume power for static power usages. Because static power usages are added up without checking surplus, static power consumption will be applied before any machine processes. This will give a more truthful surplus for dynamic power consumers.

APCs will display how much power it is using for charging the cell. APC cell charging applies power in its own channel, which gets added up to the total. This will prevent invisible power usage you see when looking at the power monitoring console.

After testing in MetaStation, I found roundstart power consumption to be around 406kW after all APCs get fully charged. During the roundstart APC charge rush, the power consumption can get as high as over 2MW (up to 25kW per roundstart APC charging) as long as there's that much available.

Because of the absurd potential power consumption of charging APCs near roundstart, I have changed how APCs decide to charge. APCs will now charge only after all other machines have processed in the machines processing subsystem. This will make sure APC charging won't disrupt machines taking from the grid, and should stop APCs getting their power drained due to others demanding too much power while charging. I have removed the delays for APC charging too, so they start charging immediately whenever there's excess power. It also stops them turning red when a small amount of cell gets drained (airlocks opening and shit during APC charge rush), as they immediately become fully charged (unless too much energy got drained somehow) before changing icon.

Engineering SMES now start at 100% charge instead of 75%. I noticed cells were draining earlier than usual after these changes, so I am making them start maxed to try and combat that.

These changes will fix all conservation of energy issues relating to charging powercells.

Why It's Good For The Game

Closes #73438
Closes #75789
Closes #80634
Closes #82031

Makes it much easier to interface with the power system in the codebase. It's more intuitive. Removes a bunch of conservation of energy issues, making energy and power much more meaningful. It will help the simulation remain immersive as players won't encounter energy duplication so easily. Arbitrary energy units getting replaced with the joule will also tell people more meaningful information when reading it. APC charging will feel more snappy.

Changelog

🆑 Pickle-Coding
fix: Fixes conservation of energy issues relating to charging powercells.
qol: APCs will display how much power they are using to charge their cell. This is accounted for in the power monitoring console.
qol: All arbitrary power cell energy units you see are replaced with prefixed joules.
balance: As a consequence of the conservation of energy issues getting fixed, the power consumption for charging cells is now very significant.
balance: APCs only use surplus power from the grid after every machine processes when charging, preventing APCs from causing others to discharge while charging.
balance: Engineering SMES start at max charge to combat the increased energy loss due to conservation of energy fixes.
/:cl:

…tion of energy issues relating to charging cells. (#1593)

* Converts arbitrary energy units to the joule. Fixes conservation of energy issues relating to charging cells.

* Fix CI issues

* More CI fixes

* restore edits

* Edit

* Yes?

* active power (I think this is right?)

---------

Co-authored-by: Pickle-Coding <[email protected]>
Co-authored-by: SomeRandomOwl <[email protected]>
@Iajret Iajret merged commit 44c23a4 into master Mar 28, 2024
23 checks passed
@Iajret Iajret deleted the upstream-mirror-1593 branch March 28, 2024 09:45
AnywayFarus added a commit that referenced this pull request Mar 28, 2024
Iajret pushed a commit that referenced this pull request May 21, 2024
…2595)

* reverts the description of the nuke op reinforcement beacon (#83341)

## About The Pull Request
Changes the description of the reinforcement beacon from "MI13 designed
one-use radio for calling immediate backup. Have no regards for safety
of whom it summons - they are all inferior clones from Interdyne's
genebanks anyway." back to what it used to be- "A single-use beacon
designed to quickly launch reinforcement operatives into the field."

## Why It's Good For The Game
This change was brought in a sprite PR that had no justification for its
code changes. I don't like this lore change, it seems needlessly "edgy",
and I designed the reinforcements to be flavorful workers from different
companies that are part of the Syndicate as you can see by all their
different random outfits, them being "inferior clones from genebanks" is
a weird contrast to that and doesn't sit well with me. And the random
MI13 drop is eh.

## Changelog
:cl:
spellcheck: the nuke op reinforcement beacon no longer talks about
clones
/:cl:

* reverts the description of the nuke op reinforcement beacon

---------

Co-authored-by: Fikou <[email protected]>
Co-authored-by: NovaBot13 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants