_0StevenandGitHub 18c346274e Ethereals: Standardize defines, lower hunger rate, refactor charging methods (#88960)
## About The Pull Request

Man.

### Standardizing Ethereal Defines

The _single_ biggest issue with all of the recent Ethereal prs has been
that, well, none of our Ethereal defines meaningfully tie to each other,
and as shown repeatedly it's _incredibly_ easy to the others when
changing one of them.
To resolve this, we introduce a `STANDARD_ETHEREAL_CHARGE` define that
every single other Ethereal define is scaled around, which itself is
tied to `STANDARD_CELL_CHARGE`.
Now these can be changed without immediately blowing up everything else,
and with awareness that they tie back to something.

As a side to this, we redefine all reagent-based charge recovery to be
relative to `ETHEREAL_DISCHARGE_RATE` rather than an arbitrary power
level, so it's easier to compare them to how quickly an ethereal
discharges.

### Adjusting Ethereal Defines

Previously, we defined `ETHEREAL_DISCHARGE_RATE` as `8e-3 *
STANDARD_CELL_CHARGE` per second, while defining `ETHEREAL_CHARGE_FULL`
as `2 * STANDARD_CELL_CHARGE`.
With some math, we get that we'd `2 / 8e-3 = 250 seconds`, 4 whole
minutes, to go from full charge to none at all.
It only takes half as much to get hungry, and about 3 minutes to start
taking toxin damage from roundstart.
So we slash this by eight, to `1e-3 STANDARD_ETHEREAL_CHARGE`, giving us
a nice 16-17~ minutes until we're hungry, and another 16-17~ until we
are 100% out of charge. This is also closer to the pre-power-rework
discharge rate.

What made this _worse_ was that the Ethereal APC charge define
`ETHEREAL_APC_POWER_GAIN` wasn't updated to match the current
charge/discharge levels, still being at `10 * STANDARD_CELL_CHARGE`,
which due to how it was coded led to it being impossible for Ethereals
to recharge from APCs.
We first and foremost change this to `0.1 * STANDARD_ETHEREAL_CHARGE`,
which is roughly equal to what it was before the most recent change, and
actually falls in line with Ethereal charge levels.

### Refactoring Ethereal Charge Methods

APC and Power Store recharging were both performing some awkward checks,
which led to our primary issues above, where they would refuse to even
attempt to charge if the stomach couldn't handle a full load or the cell
didn't have a full load.
So we rewrite their entire method to instead check how much can be
charged by taking the minimum of the cell charge, stomach used charge,
and charge-per-step.
We do this instead of just discharging it and taking the return value,
as the stomach may not have enough space for the cell's power, and
that'd get wasted.

This rewrite also allows us to address a small list of bugs.
We keep the `to_chat` for power store draining, as it better
communicates that this method is imperfect than a balloon alert would.

# Testing:<br>I spent an extended period of time looking at Ethereals
slowly starve in front of me with a stopwatch in hand.

## Why It's Good For The Game

Fixes #88934.
Fixes #88977.
16-17~ minutes is a _lot_ more bearable than 2-3~ minutes, and more in
line with discharge rates before the power rework.
Having Ethereal charging stuff actually work is nice.

## Changelog
🆑
balance: Ethereal hunger rate has been adjusted to be 1/8th of its
previous rate, now taking roughly 16-17~ minutes to go down from full to
normal or normal to none. Ethereal defines have been standardized to
help keep this sane.
refactor: Ethereal APC and power store draining/charging methods have
been refactored. Please report any issues.
fix: Ethereal APC and power store draining/charging no longer
arbitrarily caps out at slightly below or above the max/min.
fix: Ethereal APC draining/charging no longer runtimes when there is no
cell or it gets removed mid-charge.
fix: Ethereals can no longer continue charging their stomach even if it
gets surgically removed from them mid-charge.
fix: Ethereal power store draining actually updated the charge level
overlay.
qol: Ethereal APC and power store draining displays a balloon alert when
it can't continue for whatever reason.
/🆑
2025-01-11 00:44:04 +00:00
2025-01-10 16:16:07 -05:00
2025-01-06 08:08:12 -08:00
2025-01-10 13:07:41 +02:00
2024-11-06 14:12:43 -07:00
2025-01-10 13:03:36 +01:00
2024-03-11 19:31:15 -06:00
2024-04-12 07:14:39 -04:00
2024-05-23 10:13:15 +12:00
2024-12-09 16:39:04 +00:00

/tg/station codebase

Build Status Percentage of issues still open Average time to resolve an issue Coverage

resentment technical debt forinfinityandbyond

Website Link
Website https://www.tgstation13.org
Code https://github.com/tgstation/tgstation
Wiki https://tgstation13.org/wiki/Main_Page
Codedocs https://codedocs.tgstation13.org/
/tg/station Discord https://tgstation13.org/phpBB/viewforum.php?f=60
Coderbus Discord https://discord.gg/Vh8TJp9

This is the codebase for the /tg/station flavoured fork of SpaceStation 13.

Space Station 13 is a paranoia-laden round-based roleplaying game set against the backdrop of a nonsensical, metal death trap masquerading as a space station, with charming spritework designed to represent the sci-fi setting and its dangerous undertones. Have fun, and survive!

All github inquiries (such as moderation actions) may be handled via the /tg/station discord #coding-general. Simply ping the @Maintainer role, following the guide on asking questions located in the channel description, with your issue!

DOWNLOADING

Downloading

Running a server

Maps and Away Missions

Compilation

The quick way. Find bin/server.cmd in this folder and double click it to automatically build and host the server on port 1337.

The long way. Find bin/build.cmd in this folder, and double click it to initiate the build. It consists of multiple steps and might take around 1-5 minutes to compile. If it closes, it means it has finished its job. You can then setup the server normally by opening tgstation.dmb in DreamDaemon.

Building tgstation in DreamMaker directly is deprecated and might produce errors, such as 'tgui.bundle.js': cannot find file.

How to compile in VSCode and other build options.

Getting started

For contribution guidelines refer to the Guides for Contributors.

For getting started (dev env, compilation) see the HackMD document here.

For overall design documentation see HackMD.

For lore, see Common Core.

LICENSE

All code after commit 333c566b88108de218d882840e61928a9b759d8f on 2014/31/12 at 4:38 PM PST is licensed under GNU AGPL v3.

All code before commit 333c566b88108de218d882840e61928a9b759d8f on 2014/31/12 at 4:38 PM PST is licensed under GNU GPL v3. (Including tools unless their readme specifies otherwise.)

See LICENSE and GPLv3.txt for more details.

The TGS DMAPI is licensed as a subproject under the MIT license.

See the footer of code/__DEFINES/tgs.dm and code/modules/tgs/LICENSE for the MIT license.

All assets including icons and sound are under a Creative Commons 3.0 BY-SA license unless otherwise indicated.

Languages
DM 91.5%
TypeScript 5.9%
JavaScript 1.6%
Python 0.5%
SCSS 0.2%