forked from SubnauticaNitrox/Nitrox
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added beacon name sync (SubnauticaNitrox#959)
* Added beacon name sync * Cleaned up LiteNetLibServer register call in ServerAutoFacRegistrar.cs * Fixed locking on SerializableParsedBatches * Fixed Y opening chat while another input has focus (again) * Fixed issue where player stats would throw errors if gamemode set to creative * Cleaned up some code * Added beacon metadata persist to server * Regenerated equality members for player.cs * Explained how ShowChat functionality works or does not work * Changed IfAlive to AliveOrNull extension method
- Loading branch information
Showing
33 changed files
with
489 additions
and
247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
NitroxClient/Communication/Packets/Processors/PingRenamedProcessor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using System; | ||
using NitroxClient.Communication.Abstract; | ||
using NitroxClient.Communication.Packets.Processors.Abstract; | ||
using NitroxClient.MonoBehaviours; | ||
using NitroxModel.DataStructures.Util; | ||
using NitroxModel.Logger; | ||
using NitroxModel.Packets; | ||
using UnityEngine; | ||
|
||
namespace NitroxClient.Communication.Packets.Processors | ||
{ | ||
/// <summary> | ||
/// Only syncs pings from beacons for now. | ||
/// </summary> | ||
public class PingRenamedProcessor : ClientPacketProcessor<PingRenamed> | ||
{ | ||
private readonly IPacketSender sender; | ||
|
||
public PingRenamedProcessor(IPacketSender sender) | ||
{ | ||
this.sender = sender; | ||
} | ||
|
||
public override void Process(PingRenamed packet) | ||
{ | ||
Optional<GameObject> obj = NitroxEntity.GetObjectFrom(packet.Id); | ||
if (!obj.HasValue) | ||
{ | ||
// Not the object we're looking for. | ||
return; | ||
} | ||
Beacon beacon = obj.Value.GetComponent<Beacon>(); | ||
if (!beacon) | ||
{ | ||
// This can be ok if origin of ping instance component was not from a beacon (but from signal or other). | ||
return; | ||
} | ||
if (beacon.GetComponent<Player>()) | ||
{ | ||
// Skip over beacon component on player GameObjects | ||
return; | ||
} | ||
|
||
using (sender.Suppress<PingRenamed>()) | ||
{ | ||
beacon.beaconLabel.SetLabel(packet.Name); | ||
Log.Debug($"Received ping rename: '{packet.Name}' on object '{obj.Value.GetFullName()}' with Nitrox id: '{packet.Id}'"); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.