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

Fix non-ghosts and admins counting toward most followed #28120

Merged
merged 8 commits into from
May 20, 2024

Conversation

Tayrtahn
Copy link
Contributor

About the PR

Anomaly cores and admin ghosts no longer count as followers for the purposes of the "Warp to most followed" button.

Why / Balance

Counting cores is silly. Counting admins is bad.

Fixes #28106
Fixes #27957

Technical details

Instead of using Followers.Count, the code now loops through the followers and checks for GhostComponent. To prevent counting admins, only ghosts with CanGhostInteract true are included.

Slightly less efficient since we now iterate through the followers on each followed object, but this isn't exactly a hot code path.

Media

Warping to the character with one ghost follower, ignoring the other character with more anomaly core followers:

Screen.Recording.2024-05-18.at.5.22.26.PM.mp4

The same thing, but now the one ghost is an aghost, so there is no "most followed" and no warp happens:

Screen.Recording.2024-05-18.at.5.23.17.PM.mp4
  • I have added screenshots/videos to this PR showcasing its changes ingame, or this PR does not require an ingame showcase

Breaking changes

Changelog

🆑

  • fix: "Warp to most followed" ghost option no longer includes admins and non-ghost followers.

@Hanzdegloker
Copy link
Contributor

No more admin ghost gang, damn. Also it only just hit me yeah anom cores share code with ghost follow huh?

@Tayrtahn
Copy link
Contributor Author

anom cores share code with ghost follow huh?

Yep, both use FollowerSystem.

@Yousifb26
Copy link
Contributor

If you didn’t already, please do that with the ghost plushie and revenant plushies because they have the same issue

@Tayrtahn
Copy link
Contributor Author

Tayrtahn commented May 18, 2024

If you didn’t already, please do that with the ghost plushie and revenant plushies because they have the same issue

They should be covered, but let me test and confirm that.

EDIT: Confirmed. Ghost and revenant plushies don't count either.

Copy link
Member

@ShadowCommander ShadowCommander left a comment

Choose a reason for hiding this comment

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

It'd probably be better to just EntityQueryEnumerator<FollowerComponent, GhostComponent, ActorComponent> and then check isAdmin. Then keep a tally dictionary or something.

@Tayrtahn Tayrtahn marked this pull request as draft May 19, 2024 18:23
@Tayrtahn Tayrtahn marked this pull request as ready for review May 19, 2024 18:51
@Tayrtahn
Copy link
Contributor Author

So, checking IsAdmin isn't great, since it excludes all admins who are ghosts, even if they're just regular ghosts and not aghosts. Unless that's desired, I'm sticking with basing it on CanGhostInteract. I did switch it over to better leverage EntityQueryEnumerator for filtering though.

@github-actions github-actions bot added the Status: Needs Review This PR requires new reviews before it can be merged. label May 19, 2024
@ShadowCommander
Copy link
Member

ShadowCommander commented May 19, 2024

If an admin is a regular ghost and playing the game as a player then they will (on Wizden at least) run deadmin, so they won't count as admin anymore to IsAdmin.

Content.Shared/Follower/FollowerSystem.cs Outdated Show resolved Hide resolved
Content.Shared/Follower/FollowerSystem.cs Outdated Show resolved Hide resolved
Content.Shared/Follower/FollowerSystem.cs Outdated Show resolved Hide resolved
@ShadowCommander
Copy link
Member

Should be the last two changes. Tested it and everything works.

Tayrtahn and others added 2 commits May 20, 2024 08:39
Co-authored-by: ShadowCommander <shadowjjt@gmail.com>
Co-authored-by: ShadowCommander <shadowjjt@gmail.com>
Copy link
Contributor Author

@Tayrtahn Tayrtahn left a comment

Choose a reason for hiding this comment

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

Mobile edit magic

Content.Shared/Follower/FollowerSystem.cs Outdated Show resolved Hide resolved
@ShadowCommander ShadowCommander merged commit 8995810 into space-wizards:master May 20, 2024
11 checks passed
@Tayrtahn Tayrtahn deleted the ghostnado-fixes branch May 20, 2024 17:14
Titian3 pushed a commit to Titian3/space-station-14 that referenced this pull request May 24, 2024
…s#28120)

* Fixed non-ghosts and admins counting toward most followed

* Redone to better leverage EntityQueryEnumerator

* Remember to test your code before you commit it, kids

* Review revisions

* Update Content.Shared/Follower/FollowerSystem.cs

Co-authored-by: ShadowCommander <shadowjjt@gmail.com>

* Update Content.Shared/Follower/FollowerSystem.cs

Co-authored-by: ShadowCommander <shadowjjt@gmail.com>

* Update Content.Shared/Follower/FollowerSystem.cs

* Clean up

---------

Co-authored-by: ShadowCommander <shadowjjt@gmail.com>
Co-authored-by: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Review This PR requires new reviews before it can be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

anomaly cores counted in most following Admin Ghosts should not be counted in "Warp to Most Followed"
4 participants