psforever / PSF-LoginServer

Emulated PlanetSide 1 world and login server by the PSForever project.
https://psforever.net
GNU General Public License v3.0
75 stars 46 forks source link

Reintroduce Squads (Not Perfect) #1157

Closed ScrawnyRonnie closed 7 months ago

ScrawnyRonnie commented 9 months ago

Turned squads back on for those so inclined to test them to see what actions cause issues with them.

Running list of known "issues" (will add things that others discover here): -Squad cards remains on screen after a squad disbands or when you log back in if you were in a squad when the client closed. Pressing Alt makes it go away. You are not actually still in the squad; it is just a UI thing that doesn't happen.

-If you join a squad while you are dead and respawning or in the middle of zoning, some things do not appear. Squad cards, numbers on map, and squad tab do not show other squad members. Squad chat is visible. This applies to both a to-be SL or a player joining an already formed squad. Leaving and rejoining fixes. As long as you are alive or just simply deconstructing UI elements appear properly.

-There is an issue with a squad Id being reused after the count is reset. See below comment. For now, the Id is not being reset anymore if no squads exist.

-Rejoining a squad can cause your client to go to the character select screen. It seems to only happen above a certain squad size (6-7+), but it doesn't happen every time.

-Squad searching has been disabled. Error detailed below.

-If the same player is invited to multiple squads and they join the first, the 2nd inviting player will see the chat message that they invited the player, but no indication that they already joined another squad. If the player then leaves the squad, the 2nd person cannot invite them again. The receiving player never receives the new invite.

-Promoting a new SL has been disabled. SL changing could sometimes cause issues that were hard to reproduce. You want to be SL? Make a new squad.

ScrawnyRonnie commented 9 months ago

Made a few changes to invite/reject behavior and what happens when a player quits/disconnects.

ScrawnyRonnie commented 8 months ago

Came across an error that happens after the squad Id counter is reset back to 1. I don't know how to fix it so for now TryResetSquadId is commented out in the only place that it is called so squad Ids will just continue to count up (they were unintentionally already doing this before I started looking at this PR). Steps to reproduce (if someone in the future looks into this and uncomments TryResetSquadId in LeaveService): 1) Create a squad - do not list it 2) Disband the squad 3) Log out of any character. Make sure no squads exist before logging so it resets back to 1 4) Create a new squad. Make sure it has the same Id as the previously created unlisted/disbanded squad. List the squad. After listing it, update the purpose and click apply to update it. You will get this error: image I am curious if some of the issues we've had with squads are due to the Id resetting so we'll see if this improves anything. Also, I don't think we'll ever get to Id 65535 before the server is restarted so it looping back to 1 shouldn't be an issue.

ScrawnyRonnie commented 8 months ago

Today someone used the squad 'Search' feature and it caused an error. I've been unable to replicate the issue. Out of precaution due to what this error caused to players that were in squads, search has been effectively disabled (I think). Error:

java.util.NoSuchElementException: null at scala.collection.concurrent.TrieMap.apply(TrieMap.scala:901) at net.psforever.services.teamwork.SquadService.net$psforever$services$teamwork$SquadService$$SearchForSquadsResults(SquadService.scala:784) at net.psforever.services.teamwork.SquadService.$anonfun$SearchForSquadsResults$1(SquadService.scala:764) at scala.collection.StrictOptimizedIterableOps.flatMap(StrictOptimizedIterableOps.scala:118) at scala.collection.StrictOptimizedIterableOps.flatMap$(StrictOptimizedIterableOps.scala:105) at scala.collection.mutable.ListBuffer.flatMap(ListBuffer.scala:39) at net.psforever.services.teamwork.SquadService.SearchForSquadsResults(SquadService.scala:764) at net.psforever.services.teamwork.SquadService.SquadActionDefinitionSearchForSquadsUsingCriteria(SquadService.scala:757) at net.psforever.services.teamwork.SquadService.SquadActionDefinitionSearchForSquadsWithParticularRole(SquadService.scala:747) at net.psforever.services.teamwork.SquadService.SquadActionDefinition(SquadService.scala:689) at net.psforever.services.teamwork.SquadService$$anonfun$receive$1.applyOrElse(SquadService.scala:217) at akka.actor.Actor.aroundReceive(Actor.scala:537) at akka.actor.Actor.aroundReceive$(Actor.scala:535) at net.psforever.services.teamwork.SquadService.aroundReceive(SquadService.scala:19) at akka.actor.ActorCell.receiveMessage(ActorCell.scala:579) at akka.actor.ActorCell.invoke(ActorCell.scala:547) at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:270) at akka.dispatch.Mailbox.run(Mailbox.scala:231) at akka.dispatch.Mailbox.exec(Mailbox.scala:243) at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

Fate-JH commented 8 months ago

Today someone used the squad 'Search' feature and it caused an error. I've been unable to replicate the issue. Out of precaution due to what this error caused to players that were in squads, search has been effectively disabled (I think). Error:

The issue is that a squad referenced in the published list does not exist in the list of all existing squads.

ScrawnyRonnie commented 8 months ago

Today someone used the squad 'Search' feature and it caused an error. I've been unable to replicate the issue. Out of precaution due to what this error caused to players that were in squads, search has been effectively disabled (I think). Error:

The issue is that a squad referenced in the published list does not exist in the list of all existing squads.

This at least confirms my speculation that things are lingering in places after a squad no longer exists. So the question is how does this happen? I added to the end of CloseSquad what I thought would remove a squad from squadFeatures and publishedLists just in case, but that attempt didn't prevent this. Is there a better way to make sure a squad that is disbanded is cleaned up everywhere?

ScrawnyRonnie commented 8 months ago

Found the answer to my previous question about squads somehow being on the publishedLists after no longer existing. It was due to a squad closing when a player logs out. The SL got the chat message that they left the squad, but not that it was disbanded. So when SL creates a new squad, lists it and someone joins, it would then repopulate the list with the old one as well. image Finally noticed when it happens by adding some console output when CloseSquad happens. I made it spit out the squad just closed as well as any that are listed. You can see that after the last squad was closed, the previous squad was in the publishedLists. image.