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

support multiple subs for ending the round #12903

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions Barotrauma/BarotraumaServer/ServerSource/Networking/GameServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -415,16 +415,38 @@ public void Update(float deltaTime)
!c.Character.IsDead && !c.Character.IsUnconscious &&
c.Character.Submarine != Level.Loaded.EndOutpost);

//level finished if the sub is docked to the outpost
//level finished if any player sub is docked to the outpost
//or very close and someone from the crew made it inside the outpost
subAtLevelEnd =
Submarine.MainSub.DockedTo.Contains(Level.Loaded.EndOutpost) ||
(Submarine.MainSub.AtEndExit && charactersInsideOutpost > 0) ||
(charactersInsideOutpost > charactersOutsideOutpost);
if (charactersInsideOutpost > charactersOutsideOutpost)
{
subAtLevelEnd = true;
}
else
{
//all subs are checked you can have a drone/escape pod/etc dock to the outpost and end the round
foreach (var sub in Submarine.Loaded)
{
if (sub.TeamID != Submarine.MainSub.TeamID)
continue;
subAtLevelEnd =
sub.DockedTo.Contains(Level.Loaded.EndOutpost) ||
sub.AtEndExit && charactersInsideOutpost > 0);
if (subAtLevelEnd)
break;
}
}
}
else
{
subAtLevelEnd = Submarine.MainSub.AtEndExit;
//check all player subs like above
foreach (var sub in Submarine.Loaded)
{
if (sub.TeamID == Submarine.MainSub.TeamID && sub.AtEndExit)
{
subAtLevelEnd = true;
break;
}
}
}
}

Expand Down