namespace Content.Shared.Access.Components
{
[RegisterComponent, NetworkedComponent]
+ [AutoGenerateComponentState]
[Access(typeof(SharedIdCardSystem), typeof(SharedPDASystem), typeof(SharedAgentIdCardSystem))]
- public sealed class IdCardComponent : Component
+ public sealed partial class IdCardComponent : Component
{
[DataField("fullName")]
+ [AutoNetworkedField]
[Access(typeof(SharedIdCardSystem), typeof(SharedPDASystem), typeof(SharedAgentIdCardSystem),
Other = AccessPermissions.ReadWrite)] // FIXME Friends
public string? FullName;
[DataField("jobTitle")]
+ [AutoNetworkedField]
public string? JobTitle;
}
-
- [Serializable, NetSerializable]
- public sealed class IdCardComponentState : ComponentState
- {
- public string? FullName;
- public string? JobTitle;
-
- public IdCardComponentState(string? fullName, string? jobTitle)
- {
- FullName = fullName;
- JobTitle = jobTitle;
- }
- }
}
{
[Dependency] private readonly InventorySystem _inventorySystem = default!;
- public override void Initialize()
- {
- base.Initialize();
-
- SubscribeLocalEvent<IdCardComponent, ComponentGetState>(OnComponentGetState);
- SubscribeLocalEvent<IdCardComponent, ComponentHandleState>(OnComponentHandleState);
- }
-
- private void OnComponentGetState(EntityUid uid, IdCardComponent component, ref ComponentGetState args)
- {
- args.State = new IdCardComponentState(component.FullName, component.JobTitle);
- }
-
- private void OnComponentHandleState(EntityUid uid, IdCardComponent component, ref ComponentHandleState args)
- {
- if (args.Current is IdCardComponentState state)
- {
- component.FullName = state.FullName;
- component.JobTitle = state.JobTitle;
- }
- }
-
/// <summary>
/// Attempt to find an ID card on an entity. This will look in the entity itself, in the entity's hands, and
/// in the entity's inventory.
</ItemGroup>
<Import Project="..\RobustToolbox\MSBuild\Robust.Properties.targets" />
+ <Import Project="..\RobustToolbox\MSBuild\Robust.CompNetworkGenerator.targets" />
</Project>
namespace Content.Shared.Parallax.Biomes;
-[RegisterComponent, NetworkedComponent]
-public sealed class BiomeComponent : Component
+[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)]
+public sealed partial class BiomeComponent : Component
{
public FastNoiseLite Noise = new();
[ViewVariables(VVAccess.ReadWrite), DataField("seed")]
+ [AutoNetworkedField]
public int Seed;
[ViewVariables(VVAccess.ReadWrite),
DataField("prototype", customTypeSerializer: typeof(PrototypeIdSerializer<BiomePrototype>))]
+ [AutoNetworkedField]
public string BiomePrototype = "Grasslands";
// TODO: Need to flag tiles as not requiring custom data anymore, e.g. if we spawn an ent and don't unspawn it.
public override void Initialize()
{
base.Initialize();
- SubscribeLocalEvent<BiomeComponent, ComponentGetState>(OnBiomeGetState);
- SubscribeLocalEvent<BiomeComponent, ComponentHandleState>(OnBiomeHandleState);
+ SubscribeLocalEvent<BiomeComponent, AfterAutoHandleStateEvent>(OnBiomeAfterHandleState);
}
- private void OnBiomeHandleState(EntityUid uid, BiomeComponent component, ref ComponentHandleState args)
+ private void OnBiomeAfterHandleState(EntityUid uid, BiomeComponent component, ref AfterAutoHandleStateEvent args)
{
- if (args.Current is not BiomeComponentState state)
- return;
-
- component.Seed = state.Seed;
- component.BiomePrototype = state.Prototype;
component.Noise.SetSeed(component.Seed);
}
- private void OnBiomeGetState(EntityUid uid, BiomeComponent component, ref ComponentGetState args)
- {
- args.State = new BiomeComponentState(component.Seed, component.BiomePrototype);
- }
-
protected T Pick<T>(List<T> collection, float value)
{
DebugTools.Assert(value is >= 0f and <= 1f);
// Domain warps require separate noise
}
-
- [Serializable, NetSerializable]
- private sealed class BiomeComponentState : ComponentState
- {
- public int Seed;
- public string Prototype;
-
- public BiomeComponentState(int seed, string prototype)
- {
- Seed = seed;
- Prototype = prototype;
- }
- }
}
RobustToolbox\MSBuild\Robust.Trimming.targets = RobustToolbox\MSBuild\Robust.Trimming.targets
RobustToolbox\MSBuild\Robust.Platform.props = RobustToolbox\MSBuild\Robust.Platform.props
RobustToolbox\MSBuild\Robust.Configurations.props = RobustToolbox\MSBuild\Robust.Configurations.props
+ RobustToolbox\MSBuild\Robust.CompNetworkGenerator.targets = RobustToolbox\MSBuild\Robust.CompNetworkGenerator.targets
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{806ED41A-411B-4B3B-BEB6-DEC6DCA4C205}"
RobustToolbox\RELEASE-NOTES.md = RobustToolbox\RELEASE-NOTES.md
EndProjectSection
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Robust.Shared.CompNetworkGenerator", "RobustToolbox\Robust.Shared.CompNetworkGenerator\Robust.Shared.CompNetworkGenerator.csproj", "{07CA34A1-1D37-4771-A2E3-495A1044AE0B}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
{424445D4-F5D9-4CA9-A435-0A36E8AA28F3}.DebugOpt|Any CPU.Build.0 = DebugOpt|Any CPU
{424445D4-F5D9-4CA9-A435-0A36E8AA28F3}.Tools|Any CPU.ActiveCfg = Tools|Any CPU
{424445D4-F5D9-4CA9-A435-0A36E8AA28F3}.Tools|Any CPU.Build.0 = Tools|Any CPU
+ {07CA34A1-1D37-4771-A2E3-495A1044AE0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {07CA34A1-1D37-4771-A2E3-495A1044AE0B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {07CA34A1-1D37-4771-A2E3-495A1044AE0B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {07CA34A1-1D37-4771-A2E3-495A1044AE0B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {07CA34A1-1D37-4771-A2E3-495A1044AE0B}.DebugOpt|Any CPU.ActiveCfg = DebugOpt|Any CPU
+ {07CA34A1-1D37-4771-A2E3-495A1044AE0B}.DebugOpt|Any CPU.Build.0 = DebugOpt|Any CPU
+ {07CA34A1-1D37-4771-A2E3-495A1044AE0B}.Tools|Any CPU.ActiveCfg = Tools|Any CPU
+ {07CA34A1-1D37-4771-A2E3-495A1044AE0B}.Tools|Any CPU.Build.0 = Tools|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
{8A21C7CA-2EB8-40E5-8043-33582C06D139} = {83B4CBBA-547A-42F0-A7CD-8A67D93196CE}
{952AAF2A-DF63-4A7D-8094-3453893EBA80} = {83B4CBBA-547A-42F0-A7CD-8A67D93196CE}
{A965CB3B-FD31-44AF-8872-85ABA436098D} = {83B4CBBA-547A-42F0-A7CD-8A67D93196CE}
+ {07CA34A1-1D37-4771-A2E3-495A1044AE0B} = {83B4CBBA-547A-42F0-A7CD-8A67D93196CE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {AA37ED9F-F8D6-468E-A101-658AD605B09A}