Skip to content

Commit

Permalink
fix!: fixing messages being sent to unauthenticated players
Browse files Browse the repository at this point in the history
BREAKING CHANGE: updating to mirage 149.1.0
  • Loading branch information
James-Frowen committed May 6, 2024
1 parent 9f84b37 commit dea4da5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 40 deletions.
2 changes: 1 addition & 1 deletion Assets/NetworkPositionSync/Runtime/SyncPositionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ internal void SendUpdateToAll(double time)
{
payload = writer.ToArraySegment()
};
Server.SendToAll(msg, excludeLocalPlayer: true, MessageChannel);
Server.SendToAll(msg, authenticatedOnly: true, excludeLocalPlayer: true, MessageChannel);
}
}

Expand Down
35 changes: 0 additions & 35 deletions Assets/NetworkPositionSync/Runtime/SyncSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
using Mirage;
using Mirage.Serialization;
using UnityEngine;
using static JamesFrowen.PositionSync.SyncPacker;

namespace JamesFrowen.PositionSync
{
Expand Down Expand Up @@ -151,41 +150,7 @@ internal bool TryUnpackNext(PooledNetworkReader reader, out NetworkBehaviour.Id
return false;
}
}



/// <summary>
/// Packs a float using <see cref="ZigZag"/> and <see cref="VarIntBlocksPacker"/>
/// </summary>
public sealed class VarDoublePacker
{
private readonly int _blockSize;
private readonly double _precision;
private readonly double _inversePrecision;

public VarDoublePacker(double precision, int blockSize)
{
_precision = precision;
_blockSize = blockSize;
_inversePrecision = 1 / precision;
}

public void Pack(NetworkWriter writer, double value)
{
var scaled = (long)Math.Round(value * _inversePrecision);
var zig = ZigZag.Encode(scaled);
VarIntBlocksPacker.Pack(writer, zig, _blockSize);
}

public double Unpack(NetworkReader reader)
{
var zig = VarIntBlocksPacker.Unpack(reader, _blockSize);
var scaled = ZigZag.Decode(zig);
return scaled * _precision;
}
}
}

//[Serializable]
//public class SyncSettingsDebug
//{
Expand Down
4 changes: 2 additions & 2 deletions Assets/NetworkPositionSync/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"url": "https://github.com/James-Frowen/NetworkPositionSync.git"
},
"dependencies": {
"com.miragenet.mirage": "141.0.2"
"com.miragenet.mirage": "149.1.0"
},
"samples": []
}
}
4 changes: 2 additions & 2 deletions Packages/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"dependencies": {
"com.miragenet.mirage": "141.0.2",
"com.miragenet.mirage": "149.1.0",
"com.unity.collab-proxy": "1.15.12",
"com.unity.ide.rider": "2.0.7",
"com.unity.ide.visualstudio": "2.0.14",
Expand Down Expand Up @@ -52,4 +52,4 @@
]
}
]
}
}

0 comments on commit dea4da5

Please sign in to comment.