space-station-14 icon indicating copy to clipboard operation
space-station-14 copied to clipboard

Flash overlay rework and bugfixes

Open slarticodefast opened this issue 9 months ago • 4 comments

About the PR

This reworks the flash effect to use the status effect system. Fixes #22217 Fixes #27992 Fixes #27072 Fixes #27743

Why / Balance

bugfixes and code improvements

Technical details

The flash effect works by taking a screenshot and having two copies of that screenshot circle around you, overlayed with a black screen. The problem was that this screenshot was taken after the shader was applied, resulting in stacking multiple effects with each use. I solved this by resetting the saved screenshot back to null after the effect has dissipated, which prevents the shader from being drawn until a new screenshot has been taken.

Edit: I also changed the flash effect to use the status effects system. Previously the FlashOverlay was added in EntryPoint.cs and active at all times, even when the player never gets flashed during the round. Now it is properly attached and detached with the status effect.

I was able to remove FlashableComponent, which was basically doing the same thing as the status effect system, only worse. Even the code comments said it was awful.

I changed InRangeUnobstructed to InRangeUnoccluded. Previously it used FlashableComponent as a whitelist in the predicate, so that most mobs don't block the line of sight of the flash. Now it just checks if the flash is in view and in range. This means that smoke, which occludes vision, will now block flashes and non-occluding entities like the shadow anomaly will not.

Rejuvenate will now remove the status effect from the player.

Media

before:

https://github.com/space-wizards/space-station-14/assets/161409025/7aabb037-87bb-4605-9127-fcf7232fc957

disabling the shader shows the underlying problem better: testing2

https://github.com/space-wizards/space-station-14/assets/161409025/e6834a65-b127-4c9a-94f1-662eae49006c

after:

https://github.com/space-wizards/space-station-14/assets/161409025/86875909-5c66-4c95-be2c-f52b4fbfae05

  • [x] I have added screenshots/videos to this PR showcasing its changes ingame, or this PR does not require an ingame showcase

Breaking changes

Removed FlashableComponent. If you want to allow mobs to be affected by flashes, allow the new Flashed status effect instead.

Changelog :cl:

  • fix: Fixed the flash effect getting darker with each appearence.
  • fix: Fixed short-sightedness making you immune to flashes.

slarticodefast avatar Apr 26 '24 22:04 slarticodefast

I was sure it was a feature... That, like, every other flash makes your vision worse.

TheShuEd avatar Apr 27 '24 09:04 TheShuEd

I was sure it was a feature... That, like, every other flash makes your vision worse.

It is not coupled to eye damage though. In the first video I test using rejuvenate and switching to another mob.

slarticodefast avatar Apr 27 '24 10:04 slarticodefast

Yeah, I realize that now. It's just that I never had my eyesight treated in the game, so my view of the world wasn't compromised

TheShuEd avatar Apr 27 '24 10:04 TheShuEd

@metalgearsloth I made some further improvements to the whole FlashSystem so it now uses the status effects system. Further details in the PR description. Appearently there is a vulnerability issue with SixLabors.ImageSharp, is there a newer version we can switch it to? Also the build fail seems to affect all new PRs, so probably not my fault.

slarticodefast avatar May 15 '24 14:05 slarticodefast