Remove Static Component NetIds (#4247)

* Remove the unnecessary NetID property from ComponentState.

* Remove Component.NetworkSynchronizeExistence.

* Removed Component.NetID.

* Adds component netID automatic generation.

* Removed NetIdAttribute from serverside components with no corresponding clientside registration.

* Completely remove static NetIds.

* Renamed NetIDAttribute to NetworkedComponentAttribute.

* Add GenerateNetIds calls to client and server entry points.
Add test to make sure auto generated NetIds are identical.

* Component changes when rebasing that I am too lazy to rewrite into the branch.

Co-authored-by: Vera Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
This commit is contained in:
Acruid
2021-07-12 01:32:10 -07:00
committed by GitHub
parent baeabfd936
commit 59e5cc5e3c
103 changed files with 334 additions and 429 deletions

View File

@@ -1,10 +1,10 @@
#nullable enable
#nullable enable
using System;
using Content.Shared.NetIDs;
using Content.Shared.Preferences;
using Robust.Shared.Enums;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components.Localization;
using Robust.Shared.GameStates;
using Robust.Shared.Players;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.Manager.Attributes;
@@ -12,6 +12,7 @@ using Robust.Shared.ViewVariables;
namespace Content.Shared.CharacterAppearance.Components
{
[NetworkedComponent()]
public abstract class SharedHumanoidAppearanceComponent : Component
{
private HumanoidCharacterAppearance _appearance = HumanoidCharacterAppearance.Default();
@@ -19,7 +20,6 @@ namespace Content.Shared.CharacterAppearance.Components
private Gender _gender;
public sealed override string Name => "HumanoidAppearance";
public sealed override uint? NetID => ContentNetIDs.HUMANOID_APPEARANCE;
[DataField("categoriesHair")]
[ViewVariables]
@@ -105,8 +105,7 @@ namespace Content.Shared.CharacterAppearance.Components
[NetSerializable]
private sealed class HumanoidAppearanceComponentState : ComponentState
{
public HumanoidAppearanceComponentState(HumanoidCharacterAppearance appearance, Sex sex, Gender gender) :
base(ContentNetIDs.HUMANOID_APPEARANCE)
public HumanoidAppearanceComponentState(HumanoidCharacterAppearance appearance, Sex sex, Gender gender)
{
Appearance = appearance;
Sex = sex;