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

Substation Maintenance (take 3) #32550

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

Conversation

AwareFoxy
Copy link

@AwareFoxy AwareFoxy commented Sep 30, 2024

About the PR

This PR not ready, and suggestions or critiques are welcome. It builds upon Peptide90's earlier pull request (#25191) and aims to address issue #18278.

Objectives

  • Accessibility Improvements: Change the substation screen icons to be more legible and distinct, rather than just color-coded. Rotate the red icon as needed.
  • Configuration Updates: Move substation decay settings to CVars for better manageability.
  • Bug Fixes:
    • Resolve the issue causing the verb to eject the nitrogen booster even when the maintenance door is closed.
    • Investigate and fix why substations do not decay their integrity as expected.

Why / Balance

Refer to the previous two PRs for detailed context on why these changes are necessary.

Media

Media will be added soon :3

Requirements

Breaking Changes

Changelog

🆑

  • add: Added fun!
  • remove: Removed fun!
  • tweak: Changed fun!
  • fix: Fixed fun!

@github-actions github-actions bot added the Changes: Sprites Should be reviewed or fixed by people who are knowledgeable with spriting or visual design. label Sep 30, 2024
Copy link
Contributor

github-actions bot commented Sep 30, 2024

RSI Diff Bot; head commit 18e52e6 merging into adb7aee
This PR makes changes to 1 or more RSIs. Here is a summary of all changes:

Resources/Textures/Objects/Tanks/nitrogenbooster.rsi

State Old New Status
equipped-BELT Added
icon Added
inhand-left Added
inhand-right Added

Resources/Textures/Structures/Power/substation.rsi

State Old New Status
screen1 Added
screen2 Added

Edit: diff updated after 18e52e6

Copy link
Author

@AwareFoxy AwareFoxy left a comment

Choose a reason for hiding this comment

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

uh

Content.Server/Power/EntitySystems/SubstationSystem.cs Outdated Show resolved Hide resolved
Content.Server/Power/EntitySystems/SubstationSystem.cs Outdated Show resolved Hide resolved
Content.Server/Power/EntitySystems/SubstationSystem.cs Outdated Show resolved Hide resolved
Content.Server/Power/EntitySystems/SubstationSystem.cs Outdated Show resolved Hide resolved
Content.Server/Power/EntitySystems/SubstationSystem.cs Outdated Show resolved Hide resolved
@AwareFoxy
Copy link
Author

Ok I think its ready for review now(not for merge obviously)

@AwareFoxy AwareFoxy marked this pull request as ready for review October 14, 2024 17:29
Comment on lines +12 to +15
if(args.Sprite == null || !args.Sprite.LayerMapTryGet(component.LayerMap, out var layer))
return;

if(args.AppearanceData.TryGetValue(SubstationVisuals.Screen, out var stateObject)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if(args.Sprite == null || !args.Sprite.LayerMapTryGet(component.LayerMap, out var layer))
return;
if(args.AppearanceData.TryGetValue(SubstationVisuals.Screen, out var stateObject)
if (args.Sprite == null || !args.Sprite.LayerMapTryGet(component.LayerMap, out var layer))
return;
if (args.AppearanceData.TryGetValue(SubstationVisuals.Screen, out var stateObject)


public sealed class SubstationVisualsSystem : VisualizerSystem<SubstationVisualsComponent>
{
protected override void OnAppearanceChange(EntityUid uid, SubstationVisualsComponent component, ref AppearanceChangeEvent args)
Copy link
Contributor

Choose a reason for hiding this comment

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

All system methods that take EntityUid and one or more components should be changed to take Entity<TComp1, TComp2, ..> instead.

Suggested change
protected override void OnAppearanceChange(EntityUid uid, SubstationVisualsComponent component, ref AppearanceChangeEvent args)
protected override void OnAppearanceChange(Entity<SubstationVisualsComponent> ent, ref AppearanceChangeEvent args)

Comment on lines +61 to +62
if (args.IsInDetailsRange)
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Negate and return early instead.

Comment on lines +89 to +90
subs.SubstationLightBlinkTimer -= deltaTime;
if (subs.SubstationLightBlinkTimer <= 0f)
Copy link
Contributor

Choose a reason for hiding this comment

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

Store a [AutoPausedField] TimeSpan NextUpdate on the comp instead, and compare that with CurTime.

continue;

if (!_lightSystem.TryGetLight(uid, out var shlight))
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

return will stop iterating the rest of the substations, which is probably not what you want here.

Comment on lines +44 to +47
_substationDecayEnabled = _cfg.GetCVar(CCVars.SubstationDecayEnabled);
_substationDecayTimeout = _cfg.GetCVar(CCVars.SubstationDecayTimeout);
_substationDecayCoefficient = _cfg.GetCVar(CCVars.SubstationDecayCoefficient);
_substationDecayTimer = _cfg.GetCVar(CCVars.SubstationDecayTimer);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think these are updated if you change the cvars in the middle of a round?

Comment on lines +2 to +4

[RegisterComponent]
public sealed partial class SubstationComponent : Component
Copy link
Contributor

Choose a reason for hiding this comment

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

Put an xmldoc summary on the class, and every field that isn't self-explanatory from its name.


public bool AllowInsert = true;

public float SubstationLightBlinkInterval = 1f;
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be a TimeSpan, and either a datafield or a constant.


public float SubstationLightBlinkInterval = 1f;

public float SubstationLightBlinkTimer = 1f;
Copy link
Contributor

Choose a reason for hiding this comment

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

As mentioned earlier, replace this with a TimeSpan that represents the next game time that the light should blink.

Comment on lines +341 to +348
if (!component.Initialized)
return;

if (args.Container.ID != component.NitrogenBoosterSlotId)
return;

if (!TryComp<WiresPanelComponent>(uid, out var panel))
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

Combine ifs when possible, when the conditional code is the same.

"name": "substation"
"version": 1,
"license": "CC0-1.0",
"copyright": "Created by EmoGarbage404 (github), screen sprites created by joshepvodka (github) and updated by AwareFoxy(github)",
Copy link
Contributor

Choose a reason for hiding this comment

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

Have you asked joshepvodka if they were the one that created the screen sprites, and that they are okay with relicensing to CC0? (In their PR they are licensed as CC-BY-SA)

@Krovotushka
Copy link

Based PR, merge now🦖

@github-actions github-actions bot added the Merge Conflict This PR currently has conflicts that need to be addressed. label Oct 17, 2024
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot removed the Merge Conflict This PR currently has conflicts that need to be addressed. label Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changes: Sprites Should be reviewed or fixed by people who are knowledgeable with spriting or visual design.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants