Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Xilophor/LethalNetworkAPI
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.0.0
Choose a base ref
...
head repository: Xilophor/LethalNetworkAPI
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref

Commits on Jul 20, 2024

  1. Fix Invalid binary data stream error

    Xilophor committed Jul 20, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    Xilophor Ryan Gregory
    Copy the full SHA
    c560e11 View commit details

Commits on Jul 22, 2024

  1. Verified

    This commit was signed with the committer’s verified signature.
    Xilophor Ryan Gregory
    Copy the full SHA
    fb5c7fd View commit details
  2. Verified

    This commit was signed with the committer’s verified signature.
    Xilophor Ryan Gregory
    Copy the full SHA
    4542672 View commit details
  3. Update CHANGELOG.md

    Xilophor committed Jul 22, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    Xilophor Ryan Gregory
    Copy the full SHA
    8c89ed8 View commit details

Commits on Jul 24, 2024

  1. Verified

    This commit was signed with the committer’s verified signature.
    Xilophor Ryan Gregory
    Copy the full SHA
    44114b3 View commit details
  2. Network Variable Implementation

    Xilophor committed Jul 24, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    Xilophor Ryan Gregory
    Copy the full SHA
    286d772 View commit details

Commits on Jul 26, 2024

  1. Verified

    This commit was signed with the committer’s verified signature.
    Xilophor Ryan Gregory
    Copy the full SHA
    80e5e0a View commit details
  2. Fix memory deallocation error

    Xilophor committed Jul 26, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    Xilophor Ryan Gregory
    Copy the full SHA
    76cd1a5 View commit details
  3. Update CHANGELOG.md

    Xilophor committed Jul 26, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    Xilophor Ryan Gregory
    Copy the full SHA
    e342828 View commit details
  4. whoops, accidentally removed a thing

    Xilophor committed Jul 26, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    Xilophor Ryan Gregory
    Copy the full SHA
    62c6ebe View commit details

Commits on Jul 30, 2024

  1. Fix Shutdown Error

    Xilophor committed Jul 30, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    Xilophor Ryan Gregory
    Copy the full SHA
    6c10c6e View commit details
  2. Fix clients dropping values for uninitialized network variables

    Xilophor committed Jul 30, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    Xilophor Ryan Gregory
    Copy the full SHA
    db7e8de View commit details

Commits on Aug 16, 2024

  1. Fixed ConnectedClients; Updated Errors; Optimized Message Sending

    Xilophor committed Aug 16, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    Xilophor Ryan Gregory
    Copy the full SHA
    308de1e View commit details

Commits on Aug 27, 2024

  1. Verified

    This commit was signed with the committer’s verified signature.
    Xilophor Ryan Gregory
    Copy the full SHA
    7b8f0fe View commit details
  2. Add support for LobbyCompatibility

    Xilophor committed Aug 27, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    Xilophor Ryan Gregory
    Copy the full SHA
    52036ca View commit details

Commits on Sep 7, 2024

  1. Update User File Template

    Xilophor committed Sep 7, 2024
    Copy the full SHA
    72991b6 View commit details
  2. Minor Refactoring/Using Cleanup

    Xilophor committed Sep 7, 2024
    Copy the full SHA
    801a973 View commit details
  3. Copy the full SHA
    a0ed7be View commit details
  4. Add error "handling" to OnNetworkStartCallback

    Xilophor committed Sep 7, 2024
    Copy the full SHA
    cffd352 View commit details
  5. Add more Debug Context

    Xilophor committed Sep 7, 2024
    Copy the full SHA
    1674b85 View commit details
  6. Copy the full SHA
    b24c4bc View commit details
  7. Potentially fix bug with IsConnected(?)

    Xilophor committed Sep 7, 2024
    Copy the full SHA
    e758ba8 View commit details

Commits on Sep 9, 2024

  1. Copy the full SHA
    df87025 View commit details
  2. Merge remote-tracking branch 'origin/main'

    Xilophor committed Sep 9, 2024
    Copy the full SHA
    f88a094 View commit details
  3. Revert "Merge remote-tracking branch 'origin/main'"

    This reverts commit f88a094, reversing
    changes made to df87025.
    Xilophor committed Sep 9, 2024
    Copy the full SHA
    c1cfc75 View commit details
  4. Change LogFatal to LogError

    Xilophor committed Sep 9, 2024
    Copy the full SHA
    a43bff9 View commit details
  5. Update CHANGELOG.md

    Xilophor committed Sep 9, 2024
    Copy the full SHA
    a3a08d6 View commit details
  6. Change OnNetworkStart to subscribe to OnClientConnected

    The client isn't declared as approved & listening before previous subscribed callbacks
    Xilophor committed Sep 9, 2024
    Copy the full SHA
    56fd05b View commit details
  7. Updated CHANGELOG.md

    Xilophor committed Sep 9, 2024
    Copy the full SHA
    c491e72 View commit details

Commits on Sep 12, 2024

  1. Fix bug when leaving a lobby

    Occured when the client was previously a host of a lobby
    Xilophor committed Sep 12, 2024
    Copy the full SHA
    fe76387 View commit details

Commits on Sep 13, 2024

  1. Update CHANGELOG.md

    Xilophor committed Sep 13, 2024
    Copy the full SHA
    eadeda8 View commit details
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -10,4 +10,6 @@ riderModule.iml
/LethalNetworkAPI.dll
/LethalNetworkAPI.zip
/TestMod/
dist/
dist/

!*.template.*.user
64 changes: 64 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -7,6 +7,70 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [v3.3.1]

### Fixed
- Fixed error occuring when disconnecting from a lobby when you were previously a host in the game session.

## [v3.3.0]

### Added
- `LNetworkUtils.OnNetworkStartCallback` - This event will run when the server/client starts up.

### Changed
- Minor Internal Refactoring

## [v3.2.1]

### Added
- Support for LobbyCompatibility; this will ensure that the server and clients are using the same version of this API.

### Fixed
- Fixed `IsConnected` not working properly.

## [v3.2.0]

### Changed
- Improved error messages.
- Changed internal backend to be more optimal and only use Networking and Serialization when necessary.

### Fixed
- Fixed `SendOtherClients` not sending to the server.
- Fixed `LNetworkUtils.AllConnectedClients` not including the server.

## [v3.1.1]

### Fixed
- Fixed Shutdown error for `UnnamedMessageHandler`.
- Fixed `LNetworkVariable` update error when the variable has not yet been created on the client.

## [v3.1.0]

### Added
- Added `LNetworkVariable` - replaces `LethalNetworkVariable`.
- Added `LNetworkVariableWritePerms` enum to control the write permissions of the variable.
- Added `UpdateOwner` method to update the owner of the variable.
- Added `Dispose` method to dispose of the variable.

### Fixed
- Fixed clients not sending events/messages/variable updates to other clients.

## [v3.0.3]

### Fixed
- NGO `ConnectedClients should only be accessed on the server` error.

## [v3.0.2]

### Fixed
- Some built-in types not serializing properly.
- NGO `InvalidOperationException` during disconnecting if a `LethalNetworkVariable` is used.

## [v3.0.1]

### Fixed
- `InvalidOperationException: Invalid binary data stream` error.

## [v3.0.0]

### Added
9 changes: 7 additions & 2 deletions LethalNetworkAPI/Internal/EMessageType.cs
Original file line number Diff line number Diff line change
@@ -9,10 +9,15 @@ internal enum EMessageType
Event = 0b0000_0001, // 1
Message = 0b0000_0010, // 2
Variable = 0b0000_0100, // 4
[Obsolete] SyncedEvent = 0b0000_1000, // 8
SyncedEvent = 0b0000_1000, // 8

ServerMessage = 0b0001_0000, // 16
ClientMessage = 0b0010_0000, // 32
ClientMessageToClient = 0b0100_0000, // 64
Request = 0b1000_0000, // 128
Request = 0b1000_0000, // 128

DataUpdate = 0b0001_0000, // 16
OwnershipUpdate = 0b0010_0000, // 32
//ForceUpdate = 0b0100_0000, // 64
UpdateClientList = 0b1000_0000, // 128
}
27 changes: 27 additions & 0 deletions LethalNetworkAPI/Internal/LNetworkVariableBase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
namespace LethalNetworkAPI.Internal;

using System.Linq;
using Unity.Netcode;

/// <remarks>Internal Class</remarks>
public abstract class LNetworkVariableBase
{
internal string Identifier { get; init; }

Check warning on line 9 in LethalNetworkAPI/Internal/LNetworkVariableBase.cs

GitHub Actions / build

Non-nullable property 'Identifier' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

Check warning on line 9 in LethalNetworkAPI/Internal/LNetworkVariableBase.cs

GitHub Actions / build

Non-nullable property 'Identifier' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

Check warning on line 9 in LethalNetworkAPI/Internal/LNetworkVariableBase.cs

GitHub Actions / build

Non-nullable property 'Identifier' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

Check warning on line 9 in LethalNetworkAPI/Internal/LNetworkVariableBase.cs

GitHub Actions / build

Non-nullable property 'Identifier' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

Check warning on line 9 in LethalNetworkAPI/Internal/LNetworkVariableBase.cs

GitHub Actions / build

Non-nullable property 'Identifier' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
internal LNetworkVariableWritePerms WritePerms { get; init; }
internal ulong[]? OwnerClients { get; set; }

internal abstract void ReceiveUpdate(object? data);
internal abstract void ResetValue();
internal abstract bool IsDirty();
internal abstract void ResetDirty();
internal abstract object? GetValue();

internal bool CanWrite() =>
this.WritePerms switch
{
LNetworkVariableWritePerms.Owner => this.OwnerClients != null && this.OwnerClients.Contains(NetworkManager.Singleton.LocalClientId),
LNetworkVariableWritePerms.Server => NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost,
LNetworkVariableWritePerms.Everyone => true,
_ => false
};
}
6 changes: 4 additions & 2 deletions LethalNetworkAPI/Internal/MessageData.cs
Original file line number Diff line number Diff line change
@@ -7,15 +7,17 @@ namespace LethalNetworkAPI.Internal;
internal record MessageData(
[property: OdinSerialize] string Identifier,
[property: OdinSerialize] EMessageType MessageType,
[property: OdinSerialize] object? Data = null
[property: OdinSerialize] object? Data = null,
[property: OdinSerialize] ulong[]? TargetClients = null
);

#else

internal record MessageData(
string Identifier,
EMessageType MessageType,
object? Data = null
object? Data = null,
ulong[]? TargetClients = null
);

#endif
Loading