-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Fix air devices ignoring settings after power cycle #34887
base: master
Are you sure you want to change the base?
Fix air devices ignoring settings after power cycle #34887
Conversation
also corrected onpowerchanged methods to update powered arg.
{ | ||
[DataField] | ||
public bool Powered { get; set; } = false; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the power components please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pretend I'm stupid. don't suppose theres an example of this >.>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm running myself ragged trying to find an existing powered component. The only thing I'm seeing that has a powered variable is ApcPowerReceiverComponent. Is that what you're referring to? I also noticed that the particle accelerator is enabling/disabling power in a similar manner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe for the most part you can do a trycomp to check power like so.
TryComp<ApcPowerReceiverComponent>(uid, out var power) && power.Powered
You can see an example in GasPressurePumpSystem, where we check if the device is not powered, if so we stop making sound and return early.
private void OnPumpUpdated(EntityUid uid, GasPressurePumpComponent pump, ref AtmosDeviceUpdateEvent args)
{
if (!pump.Enabled
|| (TryComp<ApcPowerReceiverComponent>(uid, out var power) && !power.Powered)
|| !_nodeContainer.TryGetNodes(uid, pump.InletName, pump.OutletName, out PipeNode? inlet, out PipeNode? outlet))
{
_ambientSoundSystem.SetAmbience(uid, false);
return;
}
Here's an example for checking if a scrubber is powered:
else if (!scrubber.Enabled || TryComp<ApcPowerReceiverComponent>(uid, out var power) && !power.Powered)
{
_ambientSoundSystem.SetAmbience(uid, false);
_appearance.SetData(uid, ScrubberVisuals.State, ScrubberState.Off, appearance);
}
That might work. Feel free to shoot me if it doesn't sloth (godo)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it may be something along those lines but thought that may be a bit bloated. I'll write it up and give it a shot. Thanks Roomba.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I've got it right? Do I have to use an if statement for the trycomp in OnPowerChanged? That bugs me a tad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ignore that last message, we're no longer setting anything but the visual state in OnPowerChange.
{ | ||
[DataField] | ||
public bool Enabled { get; set; } = false; | ||
public bool Powered { get; set; } = false; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above.
crazy first PR verin |
Roomba!! please!! I'm gonna cry.... Metal wants me to use a powered component but I can't find one ;( |
Appears to function as desired. I did spot another issue though while writing this. If a powered air alarm is changed to a different setting while a vent/scrubber is not powered, the state of the vent/scrubber doesn't update. To be clear, it will power as desired, but it won't change from its previous setting to the new one. |
Gonna correct myself on that. Seems the setting changes, but the appearance doesn't. |
I think I have a reason as to why that's happening |
Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM and works as intended.
…tings-after-power-cycle
|
Have you pressed the Resync button and observed this behavior? The device list only updates very, very infrequently. |
I must be tripping. Hang tight, double checking now. |
ignore me, I'm just paranoid |
I get that you're been working on your frezon setups for the (just merged!) frezon buff, but man, don't get high on your own supply (godo). |
Content.Server/Atmos/Piping/Unary/Components/GasVentScrubberComponent.cs
Show resolved
Hide resolved
My first ever merge conflict on a project that isn't mine ;( I'm weeping tears of joy. |
About the PR
Fixes #34852
Why / Balance
Vents and scrubbers currently revert to their default settings when the power cycles. Alongside being annoying, this means they're no longer in sync with their connected air alarm. For example, if an alarm is set to fill, the vent should be enabled and the scrubber disabled. However after a power cycle, the scrubber will be back online, which at the very least gives the impression the alarm is no longer on fill.
Technical details
Reworks GasVentPumpSystem and GasVentScrubberSystem to use ApcPowerReceiverComponent to determine power state.
Media
I don't think this is needed? I can add a video if need be.
Requirements
Breaking changes
None
Changelog
🆑