mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-04 02:57:08 +02:00
* ComponentNames are not sent over the network when components are created. * Removed ComponentStates array from EntityState, now the state is stored directly inside the CompChange struct. * Remove the unnecessary NetID property from ComponentState. * Remove Component.NetworkSynchronizeExistence. * Change GetNetComponents to return both the component and the component NetId. * Remove public usages of the Component.NetID property. * Adds the NetIDAttribute that can be applied to components. * Removed Component.NetID. * Revert changes to GetComponentState and how prediction works. * Adds component netID automatic generation. * Modifies ClientConsoleHost so that commands can be called before Initialize(). * Completely remove static NetIds. * Renamed NetIDAttribute to NetworkedComponentAttribute. * Fixing unit tests.
50 lines
1.4 KiB
C#
50 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Robust.Shared.Enums;
|
|
using Robust.Shared.GameStates;
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
|
using Robust.Shared.ViewVariables;
|
|
|
|
namespace Robust.Shared.GameObjects.Components.Localization
|
|
{
|
|
/// <summary>
|
|
/// Overrides grammar attributes specified in prototypes or localization files.
|
|
/// </summary>
|
|
[RegisterComponent]
|
|
[NetworkedComponent()]
|
|
public class GrammarComponent : Component
|
|
{
|
|
public override string Name => "Grammar";
|
|
|
|
[ViewVariables]
|
|
[DataField("attributes")]
|
|
public Dictionary<string, string> Attributes { get; } = new();
|
|
|
|
[ViewVariables]
|
|
public Gender? Gender
|
|
{
|
|
get => Attributes.TryGetValue("gender", out var g) ? Enum.Parse<Gender>(g, true) : null;
|
|
set
|
|
{
|
|
if (value.HasValue)
|
|
Attributes["gender"] = value.Value.ToString();
|
|
else
|
|
Attributes.Remove("gender");
|
|
}
|
|
}
|
|
|
|
[ViewVariables]
|
|
public bool? ProperNoun
|
|
{
|
|
get => Attributes.TryGetValue("proper", out var g) ? bool.Parse(g) : null;
|
|
set
|
|
{
|
|
if (value.HasValue)
|
|
Attributes["proper"] = value.Value.ToString();
|
|
else
|
|
Attributes.Remove("proper");
|
|
}
|
|
}
|
|
}
|
|
}
|