-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0d7ca83
commit 3c05122
Showing
88 changed files
with
664 additions
and
627 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
27 changes: 17 additions & 10 deletions
27
NitroxClient/Communication/Packets/Processors/EntityMetadataUpdateProcessor.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 |
---|---|---|
@@ -1,23 +1,30 @@ | ||
using NitroxClient.Communication.Packets.Processors.Abstract; | ||
using NitroxClient.Communication.Packets.Processors.Abstract; | ||
using NitroxClient.GameLogic.Spawning.Metadata; | ||
using NitroxClient.GameLogic.Spawning.Metadata.Processor.Abstract; | ||
using NitroxClient.MonoBehaviours; | ||
using NitroxModel.DataStructures.Util; | ||
using NitroxModel.Helper; | ||
using NitroxModel.Packets; | ||
using UnityEngine; | ||
|
||
namespace NitroxClient.Communication.Packets.Processors | ||
namespace NitroxClient.Communication.Packets.Processors; | ||
|
||
public class EntityMetadataUpdateProcessor : ClientPacketProcessor<EntityMetadataUpdate> | ||
{ | ||
public class EntityMetadataUpdateProcessor : ClientPacketProcessor<EntityMetadataUpdate> | ||
private readonly EntityMetadataManager entityMetadataManager; | ||
|
||
public EntityMetadataUpdateProcessor(EntityMetadataManager entityMetadataManager) | ||
{ | ||
this.entityMetadataManager = entityMetadataManager; | ||
} | ||
|
||
public override void Process(EntityMetadataUpdate update) | ||
{ | ||
public override void Process(EntityMetadataUpdate update) | ||
{ | ||
GameObject gameObject = NitroxEntity.RequireObjectFrom(update.Id); | ||
GameObject gameObject = NitroxEntity.RequireObjectFrom(update.Id); | ||
|
||
Optional<EntityMetadataProcessor> metadataProcessor = EntityMetadataProcessor.FromMetaData(update.NewValue); | ||
Validate.IsTrue(metadataProcessor.HasValue, $"No processor found for EntityMetadata of type {update.NewValue.GetType()}"); | ||
Optional<IEntityMetadataProcessor> metadataProcessor = entityMetadataManager.FromMetaData(update.NewValue); | ||
Validate.IsTrue(metadataProcessor.HasValue, $"No processor found for EntityMetadata of type {update.NewValue.GetType()}"); | ||
|
||
metadataProcessor.Value.ProcessMetadata(gameObject, update.NewValue); | ||
} | ||
metadataProcessor.Value.ProcessMetadata(gameObject, update.NewValue); | ||
} | ||
} |
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
Oops, something went wrong.