Skip to content

Commit

Permalink
Add an option for whether or not items are shown when received offline
Browse files Browse the repository at this point in the history
  • Loading branch information
thislooksfun committed May 10, 2024
1 parent 09d93c8 commit d2b14ee
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Archipelago.HollowKnight/Archipelago.cs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,8 @@ public ConnectionDetails OnSaveGlobal()
{
ServerUrl = MenuSettings.ServerUrl,
ServerPort = MenuSettings.ServerPort,
SlotName = MenuSettings.SlotName
SlotName = MenuSettings.SlotName,
AlwaysShowItems = MenuSettings.AlwaysShowItems,
};
}
}
Expand Down
2 changes: 2 additions & 0 deletions Archipelago.HollowKnight/ConnectionDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ public record ConnectionDetails

public string RoomSeed { get; set; }
public long Seed { get; set; }

public bool AlwaysShowItems { get; set; }
}
}
5 changes: 3 additions & 2 deletions Archipelago.HollowKnight/IC/Modules/ItemNetworkingModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,13 @@ private async Task Synchronize()
NetworkItem seen = session.Items.DequeueItem();
Archipelago.Instance.LogDebug($"Fast-forwarding past already-obtained {session.Items.GetItemName(seen.Item)} at index {i}");
}
bool silentGive = !Archipelago.Instance.MenuSettings.AlwaysShowItems;
// receive from the server any items that are pending
while (ReceiveNextItem(true)) { }
while (ReceiveNextItem(silentGive)) { }
// ensure any already-checked locations (co-op, restarting save) are marked cleared
foreach (long location in session.Locations.AllLocationsChecked)
{
MarkLocationAsChecked(location, true);
MarkLocationAsChecked(location, silentGive);
}
// send out any pending items that didn't get to the network from the previous session
long[] pendingLocations = deferredLocationChecks.ToArray();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ private static void StartOrResumeGame(bool newGame, MenuLabel errorLabel)
}
else
{
Archipelago.Instance.MenuSettings = Archipelago.Instance.ApSettings with { };
Archipelago.Instance.MenuSettings = Archipelago.Instance.ApSettings with {
AlwaysShowItems = Archipelago.Instance.MenuSettings.AlwaysShowItems
};
}
try
{
Expand Down

0 comments on commit d2b14ee

Please sign in to comment.