Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added beacon name sync #959

Merged
merged 10 commits into from
Apr 5, 2020

Conversation

Measurity
Copy link
Collaborator

@Measurity Measurity commented Mar 12, 2020

  • Added beacon sync
  • Added beacon persist to server for new players or reconnecting players
  • Fixes a locking issue
  • Fixed equipment helper checking for null on component types instead of doing it 'the unity way'
  • Removed unused GenericNode class
  • Fixed code styling for array initializers
  • Refactored and added defensive checks to player stats UI so that it doesn't crash if elements go missing (due to gamemode change)

Suppressed the ping/beacon rename packet on initial sync so that connecting players don't fire beacon rename packets.

Initially I used PingManager.onRenamed event but doing it this way would deviate from the standard patching mechanism so I went with a patch instead.

@Measurity Measurity force-pushed the beacon-name-sync branch 2 times, most recently from 90f06ba to 3301427 Compare March 22, 2020 18:53
@Measurity Measurity marked this pull request as ready for review March 30, 2020 21:13

do
// Some packets should not fire during game session join but only afterwards so that initialized/spawned game objects don't trigger packet sending again.
using (packetSender.Suppress<PingRenamed>())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add this closer to the code that invokes this?

Comment on lines +27 to +42
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;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log the ones that are error?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None of these have to be errors. And this information doesn't seem useful most of the time. I wish we had some .Trace() or just disable logs from this class by default.

NitroxClient/GameLogic/ChatUI/PlayerChat.cs Show resolved Hide resolved
NitroxClient/Unity/Helper/GameObjectHelper.cs Outdated Show resolved Hide resolved
NitroxServer/Player.cs Outdated Show resolved Hide resolved
public string Name { get; }

[ProtoMember(3)]
public byte[] BeaconGameObjectSerialized { get; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do all pings have beacons?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, all beacons have pings.

@Sunrunner37 Sunrunner37 merged commit 54f167b into SubnauticaNitrox:master Apr 5, 2020
@Measurity Measurity deleted the beacon-name-sync branch May 14, 2020 01:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants