Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion resources/modinfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
],
"side": "Universal",
"description": "Stores and displays prospecting data on the map and allows sharing data between players. Based on ProspectoInfo by P3t3rix.",
"version": "2.2.1",
"version": "2.2.2-rc.1",
"requiredOnServer": false
}
6 changes: 6 additions & 0 deletions src/Client/ClientStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,13 @@ public void RequestInfo()
{
if (!IsModRunningOnServer())
{
Api.Logger.Debug("PT: Server does not seem to running?");
return;
}

if (Config.AutoShare)
{
Api.Logger.Debug("PT: Requesting data for groups");
ClientChannel.SendPacket(new PlayerRequestsInfoForGroupPacket(Constants.ALL_GROUP_ID));
ClientChannel.SendPacket(new PlayerRequestsInfoForGroupPacket(Config.ShareGroupUid));
}
Expand Down Expand Up @@ -119,9 +121,11 @@ protected void OnServerBroadcastsProspecting(ServerBroadcastsProspectingPacket p
{
if (!Config.AutoShare)
{
Api.Logger.Debug("PT: Ignoring sent data because auto sharing is disabled.");
return;
}

Api.Logger.Debug("PT: Received prospecting data.");
lock (Lock)
{
foreach (ProspectInfo info in packet.Data)
Expand All @@ -134,6 +138,7 @@ protected void OnServerBroadcastsProspecting(ServerBroadcastsProspectingPacket p
}
HasChangedSinceLastSave = true;
OnChanged?.Invoke(packet.Data);
Api.Logger.Debug("PT: Local data count now at " + Data.Count);
}
}

Expand Down Expand Up @@ -176,6 +181,7 @@ protected override void LoadProspectingDataFile()
FoundOreNames.Add(occurence.Name);
}
}
Api.Logger.Debug("PT: Loaded intial local data: " + Data.Count);
HasChangedSinceLastSave = false;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Client/ProspectorOverlayMapComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ public override void Render(GuiElementMap map, float dt)
}

map.TranslateWorldPosToViewPos(worldPos, ref viewPos);
if (viewPos.X < -2 * _chunksize
/*if (viewPos.X < -2 * _chunksize
|| viewPos.Y < -2 * _chunksize
|| viewPos.X > map.Bounds.OuterWidth + 2 * _chunksize
|| viewPos.Y > map.Bounds.OuterHeight + 2 * _chunksize)
{
// Skip rendering if part is not in map bounds.
return;
}
}*/

capi.Render.Render2DTexture(
colorTexture.TextureId,
Expand Down
3 changes: 3 additions & 0 deletions src/Server/ServerStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public virtual void PlayerSharedProspectingData(IServerPlayer fromPlayer, Player
{
if (!IsValidGroup(packet.GroupId, fromPlayer))
{
Api.Logger.Debug("PT: Not sending data because " + fromPlayer.PlayerName + " is not member of " + packet.GroupId);
// Invalid
return;
}
Expand All @@ -59,6 +60,7 @@ public virtual void PlayerSharedProspectingData(IServerPlayer fromPlayer, Player
}
ServerBroadcastsProspectingPacket broadCastPacket = new(packet.Data);

Api.Logger.Debug("PT: Broadcasting data to " + packet.GroupId);
if (packet.GroupId == Constants.ALL_GROUP_ID)
{
ServerChannel.BroadcastPacket(broadCastPacket);
Expand All @@ -68,6 +70,7 @@ public virtual void PlayerSharedProspectingData(IServerPlayer fromPlayer, Player
PlayerGroup group = Api.Groups.PlayerGroupsById.Get(packet.GroupId, null);
if (group != null)
{
Api.Logger.Debug("PT: Sending Packet to " + group.OnlinePlayers.ToArray());
ServerChannel.SendPacket(broadCastPacket, Array.ConvertAll(group.OnlinePlayers.ToArray(), i => (IServerPlayer)i));
}
}
Expand Down