Skip to content

Commit

Permalink
Only send locations that haven't been send yet.
Browse files Browse the repository at this point in the history
  • Loading branch information
Berserker66 committed Dec 18, 2022
1 parent 2410283 commit ca38e3f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
10 changes: 7 additions & 3 deletions mod/APState.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -336,7 +337,7 @@ static void Session_ErrorReceived(Exception e, string message)

public static void Disconnect()
{
if (Session != null && Session.Socket != null)
if (Session != null && Session.Socket != null && Session.Socket.Connected)
{
Session.Socket.Disconnect();
}
Expand Down Expand Up @@ -393,8 +394,11 @@ public static bool checkLocation(Vector3 position)

public static void SendLocID(long id)
{
ServerData.@checked.Add(id);
Task.Run(() => {Session.Locations.CompleteLocationChecksAsync(id); }).ConfigureAwait(false);
if (ServerData.@checked.Add(id))
{
Task.Run(() => {Session.Locations.CompleteLocationChecksAsync(
ServerData.@checked.Except(Session.Locations.AllLocationsChecked).ToArray()); }).ConfigureAwait(false);
}
}

public static void unlock(TechType techType)
Expand Down
9 changes: 8 additions & 1 deletion mod/Archipelago.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,15 @@
<PackageReference Include="Archipelago.MultiClient.Net" Version="4.1.2" />
</ItemGroup>

<ItemGroup>
<None Remove="mod.json" />
<Content Include="mod.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="COPY $(TargetPath) D:\SteamLibrary\steamapps\common\Subnautica\BepInEx\plugins\Archipelago\Archipelago.dll&#xD;&#xA;COPY $(TargetDir)Archipelago.MultiClient.Net.dll D:\SteamLibrary\steamapps\common\Subnautica\BepInEx\plugins\Archipelago\Archipelago.MultiClient.Net.dll" />
<Exec Command="COPY $(TargetPath) D:\SteamLibrary\steamapps\common\Subnautica\BepInEx\plugins\Archipelago\Archipelago.dll&#xD;&#xA;&#xD;&#xA;COPY $(TargetDir)Archipelago.MultiClient.Net.dll D:\SteamLibrary\steamapps\common\Subnautica\BepInEx\plugins\Archipelago\Archipelago.MultiClient.Net.dll&#xD;&#xA;&#xD;&#xA;COPY $(TargetDir)mod.json D:\SteamLibrary\steamapps\common\Subnautica\BepInEx\plugins\Archipelago\mod.json" />
</Target>

</Project>
2 changes: 1 addition & 1 deletion mod/MainPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ private void Awake()
//Common interface
public static class APWrapper
{
public const string Version = "1.3.3";
public const string Version = "1.3.4";
public static void Init()
{
// Plugin startup logic
Expand Down
2 changes: 1 addition & 1 deletion mod/mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"Id": "Archipelago",
"DisplayName": "Archipelago",
"Author": "Berserker",
"Version": "1.3.2",
"Version": "1.3.4",
"Enable": true,
"Game": "Subnautica",
"AssemblyName": "Archipelago.dll",
Expand Down

0 comments on commit ca38e3f

Please sign in to comment.