Revert "Fix some friend access violations by allowing others access. (#8594) (#8703)

This commit is contained in:
Pieter-Jan Briers
2022-06-07 13:44:31 +02:00
committed by GitHub
parent c5f7c61041
commit cecf87997b
162 changed files with 169 additions and 197 deletions

View File

@@ -7,11 +7,10 @@ namespace Content.Shared.Access.Components
/// Simple mutable access provider found on ID cards and such.
/// </summary>
[RegisterComponent]
[Access(typeof(AccessSystem))]
[Friend(typeof(AccessSystem))]
public sealed class AccessComponent : Component
{
[DataField("tags", customTypeSerializer: typeof(PrototypeIdHashSetSerializer<AccessLevelPrototype>))]
[Access(typeof(AccessSystem), Other = AccessPermissions.ReadExecute)] // FIXME Friends
public HashSet<string> Tags = new();
[DataField("groups", customTypeSerializer: typeof(PrototypeIdHashSetSerializer<AccessGroupPrototype>))]

View File

@@ -6,15 +6,13 @@ namespace Content.Shared.Access.Components
// TODO BUI NETWORKING if ever clients can open their own BUI's (id card console, pda), then this data should be
// networked.
[RegisterComponent]
[Access(typeof(SharedIdCardSystem), typeof(SharedPDASystem), typeof(SharedAgentIdCardSystem))]
[Friend(typeof(SharedIdCardSystem), typeof(SharedPDASystem), typeof(SharedAgentIdCardSystem))]
public sealed class IdCardComponent : Component
{
[DataField("originalOwnerName")]
public string OriginalOwnerName = default!;
[DataField("fullName")]
[Access(typeof(SharedIdCardSystem), typeof(SharedPDASystem), typeof(SharedAgentIdCardSystem),
Other = AccessPermissions.ReadWrite)] // FIXME Friends
public string? FullName;
[DataField("jobTitle")]

View File

@@ -6,11 +6,10 @@ namespace Content.Shared.Actions;
[NetworkedComponent]
[RegisterComponent]
[Access(typeof(SharedActionsSystem))]
[Friend(typeof(SharedActionsSystem))]
public sealed class ActionsComponent : Component
{
[ViewVariables]
[Access(typeof(SharedActionsSystem), Other = AccessPermissions.ReadExecute)] // FIXME Friends
public SortedSet<ActionType> Actions = new();
}

View File

@@ -2,7 +2,7 @@
namespace Content.Shared.Administration;
[RegisterComponent, Access(typeof(AdminFrozenSystem))]
[RegisterComponent, Friend(typeof(AdminFrozenSystem))]
[NetworkedComponent]
public sealed class AdminFrozenComponent : Component
{

View File

@@ -7,7 +7,7 @@ using Robust.Shared.Serialization;
namespace Content.Shared.CharacterAppearance.Components
{
[RegisterComponent]
[Access(typeof(SharedHumanoidAppearanceSystem), typeof(SharedMagicMirrorComponent))]
[Friend(typeof(SharedHumanoidAppearanceSystem), typeof(SharedMagicMirrorComponent))]
[NetworkedComponent]
public sealed class HumanoidAppearanceComponent : Component
{

View File

@@ -8,7 +8,7 @@ namespace Content.Shared.Chat.TypingIndicator;
/// Added automatically when player poses entity.
/// </summary>
[RegisterComponent, NetworkedComponent]
[Access(typeof(SharedTypingIndicatorSystem))]
[Friend(typeof(SharedTypingIndicatorSystem))]
public sealed class TypingIndicatorComponent : Component
{
/// <summary>

View File

@@ -3,7 +3,7 @@ using Robust.Shared.Serialization;
namespace Content.Shared.Clothing;
[RegisterComponent, NetworkedComponent, Access(typeof(ClothingSpeedModifierSystem))]
[RegisterComponent, NetworkedComponent, Friend(typeof(ClothingSpeedModifierSystem))]
public sealed class ClothingSpeedModifierComponent : Component
{
[DataField("walkModifier", required: true)] [ViewVariables(VVAccess.ReadWrite)]

View File

@@ -8,7 +8,7 @@ namespace Content.Shared.Clothing.Components;
/// attached to, rather than being dumped on the floor or something like that. Intended for use with hardsuits and
/// hardsuit helmets.
/// </summary>
[Access(typeof(ToggleableClothingSystem))]
[Friend(typeof(ToggleableClothingSystem))]
[RegisterComponent]
public sealed class AttachedClothingComponent : Component
{

View File

@@ -11,7 +11,7 @@ namespace Content.Shared.Clothing.Components;
/// This component gives an item an action that will equip or un-equip some clothing. Intended for use with
/// hardsuits and hardsuit helmets.
/// </summary>
[Access(typeof(ToggleableClothingSystem))]
[Friend(typeof(ToggleableClothingSystem))]
[RegisterComponent]
public sealed class ToggleableClothingComponent : Component
{

View File

@@ -5,7 +5,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototy
namespace Content.Shared.Construction.Components
{
[RegisterComponent, Access(typeof(SharedAnchorableSystem))]
[RegisterComponent, Friend(typeof(SharedAnchorableSystem))]
public sealed class AnchorableComponent : Component
{
[DataField("tool", customTypeSerializer: typeof(PrototypeIdSerializer<ToolQualityPrototype>))]

View File

@@ -25,12 +25,12 @@ namespace Content.Shared.Construction.Steps
public override bool EntityValid(EntityUid uid, IEntityManager entityManager)
{
return entityManager.TryGetComponent(uid, out SharedStackComponent? stack) && stack.StackTypeId == MaterialPrototypeId && stack.Count >= Amount;
return entityManager.TryGetComponent(uid, out SharedStackComponent? stack) && stack.StackTypeId.Equals(MaterialPrototypeId) && stack.Count >= Amount;
}
public bool EntityValid(EntityUid entity, [NotNullWhen(true)] out SharedStackComponent? stack)
{
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out SharedStackComponent? otherStack) && otherStack.StackTypeId == MaterialPrototypeId && otherStack.Count >= Amount)
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out SharedStackComponent? otherStack) && otherStack.StackTypeId.Equals(MaterialPrototypeId) && otherStack.Count >= Amount)
stack = otherStack;
else
stack = null;

View File

@@ -13,7 +13,7 @@ namespace Content.Shared.Containers.ItemSlots
/// insert/eject interactions.
/// </summary>
[RegisterComponent]
[Access(typeof(ItemSlotsSystem))]
[Friend(typeof(ItemSlotsSystem))]
public sealed class ItemSlotsComponent : Component
{
/// <summary>
@@ -60,7 +60,7 @@ namespace Content.Shared.Containers.ItemSlots
/// insert/eject sounds.
/// </summary>
[DataDefinition]
[Access(typeof(ItemSlotsSystem))]
[Friend(typeof(ItemSlotsSystem))]
public sealed class ItemSlot
{
[DataField("whitelist")]
@@ -86,7 +86,6 @@ namespace Content.Shared.Containers.ItemSlots
/// of the currently held or currently inserted entity instead.
/// </remarks>
[DataField("name", readOnly: true)]
[Access(typeof(ItemSlotsSystem), Other = AccessPermissions.ReadWriteExecute)] // FIXME Friends
public string Name = string.Empty;
/// <summary>
@@ -98,7 +97,6 @@ namespace Content.Shared.Containers.ItemSlots
/// when mapping.
/// </remarks>
[DataField("startingItem", readOnly: true, customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
[Access(typeof(ItemSlotsSystem), Other = AccessPermissions.ReadWriteExecute)] // FIXME Friends
public string? StartingItem;
/// <summary>

View File

@@ -3,7 +3,7 @@ using Robust.Shared.Serialization;
namespace Content.Shared.Crayon
{
[NetworkedComponent, ComponentProtoName("Crayon"), Access(typeof(SharedCrayonSystem))]
[NetworkedComponent, ComponentProtoName("Crayon"), Friend(typeof(SharedCrayonSystem))]
public abstract class SharedCrayonComponent : Component
{
public string SelectedState { get; set; } = string.Empty;

View File

@@ -16,7 +16,7 @@ namespace Content.Shared.Damage
/// </remarks>
[RegisterComponent]
[NetworkedComponent()]
[Access(typeof(DamageableSystem))]
[Friend(typeof(DamageableSystem))]
public sealed class DamageableComponent : Component
{
/// <summary>
@@ -24,7 +24,6 @@ namespace Content.Shared.Damage
/// If null, all damage types will be supported.
/// </summary>
[DataField("damageContainer", customTypeSerializer: typeof(PrototypeIdSerializer<DamageContainerPrototype>))]
[Access(typeof(DamageableSystem), Other = AccessPermissions.ReadExecute)] // FIXME Friends
public string? DamageContainerID;
/// <summary>
@@ -47,7 +46,6 @@ namespace Content.Shared.Damage
/// </remarks>
[DataField("damage")]
[ViewVariables(VVAccess.ReadWrite)]
[Access(typeof(DamageableSystem), Other = AccessPermissions.ReadExecute)] // FIXME Friends
public DamageSpecifier Damage = new();
/// <summary>
@@ -62,9 +60,7 @@ namespace Content.Shared.Damage
/// <summary>
/// The sum of all damages in the DamageableComponent.
/// </summary>
[ViewVariables]
[Access(typeof(DamageableSystem), Other = AccessPermissions.ReadExecute)] // FIXME Friends
public FixedPoint2 TotalDamage;
[ViewVariables] public FixedPoint2 TotalDamage;
// Really these shouldn't be here. OnExplosion() and RadiationAct() should be handled elsewhere.
[ViewVariables]

View File

@@ -1,7 +1,7 @@
namespace Content.Shared.Decals
{
[RegisterComponent]
[Access(typeof(SharedDecalSystem))]
[Friend(typeof(SharedDecalSystem))]
public sealed class DecalGridComponent : Component
{
[DataField("chunkCollection", serverOnly: true)]

View File

@@ -3,7 +3,7 @@ using Robust.Shared.Serialization;
namespace Content.Shared.Electrocution
{
[Access(typeof(SharedElectrocutionSystem))]
[Friend(typeof(SharedElectrocutionSystem))]
[RegisterComponent, NetworkedComponent]
public sealed class InsulatedComponent : Component
{

View File

@@ -3,7 +3,7 @@ using Robust.Shared.Serialization;
namespace Content.Shared.Flash
{
[NetworkedComponent, Access(typeof(SharedFlashSystem))]
[NetworkedComponent, Friend(typeof(SharedFlashSystem))]
public abstract class SharedFlashableComponent : Component
{
public float Duration { get; set; }

View File

@@ -11,7 +11,7 @@ namespace Content.Shared.Foldable;
/// </remarks>
[RegisterComponent]
[NetworkedComponent]
[Access(typeof(SharedFoldableSystem))]
[Friend(typeof(SharedFoldableSystem))]
public sealed class FoldableComponent : Component
{
[DataField("folded")]

View File

@@ -6,7 +6,7 @@ namespace Content.Shared.Follower.Components;
/// <summary>
/// Attached to entities that are currently being followed by a ghost.
/// </summary>
[RegisterComponent, Access(typeof(FollowerSystem))]
[RegisterComponent, Friend(typeof(FollowerSystem))]
[NetworkedComponent]
public sealed class FollowedComponent : Component
{

View File

@@ -3,7 +3,7 @@ using Robust.Shared.GameStates;
namespace Content.Shared.Follower.Components;
[RegisterComponent]
[Access(typeof(FollowerSystem))]
[Friend(typeof(FollowerSystem))]
[NetworkedComponent]
public sealed class FollowerComponent : Component
{

View File

@@ -1,7 +1,7 @@
namespace Content.Shared.Friction
{
[RegisterComponent]
[Access(typeof(SharedTileFrictionController))]
[Friend(typeof(SharedTileFrictionController))]
public sealed class TileFrictionModifierComponent : Component
{
/// <summary>

View File

@@ -4,7 +4,7 @@ using Robust.Shared.Serialization;
namespace Content.Shared.Instruments;
[NetworkedComponent, Access(typeof(SharedInstrumentSystem))]
[NetworkedComponent, Friend(typeof(SharedInstrumentSystem))]
public abstract class SharedInstrumentComponent : Component
{
[ViewVariables]
@@ -26,7 +26,6 @@ public abstract class SharedInstrumentComponent : Component
public bool RespectMidiLimits { get; set; } = true;
[ViewVariables(VVAccess.ReadWrite)]
[Access(typeof(SharedInstrumentSystem), Other = AccessPermissions.ReadWrite)] // FIXME Friends
public bool DirtyRenderer { get; set; }
}

View File

@@ -3,7 +3,7 @@ using Robust.Shared.Serialization;
namespace Content.Shared.Jittering
{
[Access(typeof(SharedJitteringSystem))]
[Friend(typeof(SharedJitteringSystem))]
[RegisterComponent, NetworkedComponent]
public sealed class JitteringComponent : Component
{

View File

@@ -12,7 +12,7 @@ namespace Content.Shared.Light.Component;
/// </remarks>
[NetworkedComponent]
[RegisterComponent]
[Access(typeof(SharedRgbLightControllerSystem))]
[Friend(typeof(SharedRgbLightControllerSystem))]
public sealed class RgbLightControllerComponent : Robust.Shared.GameObjects.Component
{
[DataField("cycleRate")]

View File

@@ -4,7 +4,7 @@ using Robust.Shared.GameStates;
namespace Content.Shared.Movement.Components
{
[RegisterComponent]
[NetworkedComponent, Access(typeof(MovementSpeedModifierSystem))]
[NetworkedComponent, Friend(typeof(MovementSpeedModifierSystem))]
public sealed class MovementSpeedModifierComponent : Component
{
public const float DefaultBaseWalkSpeed = 3.0f;

View File

@@ -3,7 +3,7 @@ using Content.Shared.Sound;
namespace Content.Shared.Nutrition.Components
{
[Access(typeof(SharedCreamPieSystem))]
[Friend(typeof(SharedCreamPieSystem))]
[RegisterComponent]
public sealed class CreamPieComponent : Component
{

View File

@@ -3,7 +3,7 @@ using Robust.Shared.Serialization;
namespace Content.Shared.Nutrition.Components
{
[Access(typeof(SharedCreamPieSystem))]
[Friend(typeof(SharedCreamPieSystem))]
[RegisterComponent]
public sealed class CreamPiedComponent : Component
{

View File

@@ -8,7 +8,7 @@ namespace Content.Shared.Pinpointer
/// </summary>
[RegisterComponent]
[NetworkedComponent]
[Access(typeof(SharedPinpointerSystem))]
[Friend(typeof(SharedPinpointerSystem))]
public sealed class PinpointerComponent : Component
{
// TODO: Type serializer oh god

View File

@@ -4,7 +4,7 @@ using Robust.Shared.Serialization;
namespace Content.Shared.Placeable
{
[RegisterComponent, NetworkedComponent]
[Access(typeof(PlaceableSurfaceSystem))]
[Friend(typeof(PlaceableSurfaceSystem))]
public sealed class PlaceableSurfaceComponent : Component
{
[ViewVariables]

View File

@@ -7,7 +7,7 @@ namespace Content.Shared.Pulling.Components
{
// Before you try to add another type than SharedPullingStateManagementSystem, consider the can of worms you may be opening!
[NetworkedComponent()]
[Access(typeof(SharedPullingStateManagementSystem))]
[Friend(typeof(SharedPullingStateManagementSystem))]
[RegisterComponent]
public sealed class SharedPullableComponent : Component
{
@@ -26,7 +26,6 @@ namespace Content.Shared.Pulling.Components
public bool BeingPulled => Puller != null;
[Access(typeof(SharedPullingStateManagementSystem), Other = AccessPermissions.ReadExecute)] // FIXME Friends
public EntityCoordinates? MovingTo { get; set; }
public override ComponentState GetComponentState()

View File

@@ -1,7 +1,7 @@
namespace Content.Shared.Pulling.Components
{
[RegisterComponent]
[Access(typeof(SharedPullingStateManagementSystem))]
[Friend(typeof(SharedPullingStateManagementSystem))]
public sealed class SharedPullerComponent : Component
{
// Before changing how this is updated, please see SharedPullerSystem.RefreshMovementSpeed

View File

@@ -4,7 +4,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototy
namespace Content.Shared.Stacks
{
[NetworkedComponent, Access(typeof(SharedStackSystem))]
[NetworkedComponent, Friend(typeof(SharedStackSystem))]
public abstract class SharedStackComponent : Component, ISerializationHooks
{
[ViewVariables(VVAccess.ReadWrite)]

View File

@@ -3,7 +3,7 @@ using Robust.Shared.GameStates;
namespace Content.Shared.Standing
{
[Access(typeof(StandingStateSystem))]
[Friend(typeof(StandingStateSystem))]
[RegisterComponent, NetworkedComponent]
public sealed class StandingStateComponent : Component
{

View File

@@ -5,7 +5,7 @@ namespace Content.Shared.StatusEffect
{
[RegisterComponent]
[NetworkedComponent]
[Access(typeof(StatusEffectsSystem))]
[Friend(typeof(StatusEffectsSystem))]
public sealed class StatusEffectsComponent : Component
{
[ViewVariables]

View File

@@ -5,7 +5,7 @@ namespace Content.Shared.StepTrigger;
[RegisterComponent]
[NetworkedComponent]
[Access(typeof(StepTriggerSystem))]
[Friend(typeof(StepTriggerSystem))]
public sealed class StepTriggerComponent : Component
{
/// <summary>
@@ -41,7 +41,7 @@ public sealed class StepTriggerComponent : Component
}
[RegisterComponent]
[Access(typeof(StepTriggerSystem))]
[Friend(typeof(StepTriggerSystem))]
public sealed class StepTriggerActiveComponent : Component
{

View File

@@ -16,7 +16,7 @@ namespace Content.Shared.Storage.Components
/// tags: [Cigarette]
/// </code>
[RegisterComponent]
[Access(typeof(SharedItemCounterSystem))]
[Friend(typeof(SharedItemCounterSystem))]
public sealed class ItemCounterComponent : Component
{
[DataField("count", required: true)]

View File

@@ -4,7 +4,7 @@ using Robust.Shared.Serialization;
namespace Content.Shared.Storage.Components
{
[RegisterComponent]
[Access(typeof(SharedItemMapperSystem))]
[Friend(typeof(SharedItemMapperSystem))]
public sealed class ItemMapperComponent : Component, ISerializationHooks
{
[DataField("mapLayers")] public readonly Dictionary<string, SharedMapLayerData> MapLayers = new();

View File

@@ -6,7 +6,7 @@ namespace Content.Shared.Stunnable
{
[RegisterComponent]
[NetworkedComponent]
[Access(typeof(SharedStunSystem))]
[Friend(typeof(SharedStunSystem))]
public sealed class KnockedDownComponent : Component
{
[DataField("helpInterval")]

View File

@@ -5,7 +5,7 @@ namespace Content.Shared.Stunnable
{
[RegisterComponent]
[NetworkedComponent]
[Access(typeof(SharedStunSystem))]
[Friend(typeof(SharedStunSystem))]
public sealed class SlowedDownComponent : Component
{
public float SprintSpeedModifier { get; set; } = 0.5f;

View File

@@ -2,7 +2,7 @@ using Robust.Shared.GameStates;
namespace Content.Shared.Stunnable
{
[Access(typeof(SharedStunSystem))]
[Friend(typeof(SharedStunSystem))]
[RegisterComponent, NetworkedComponent]
public sealed class StunnedComponent : Component
{

View File

@@ -10,7 +10,7 @@ namespace Content.Shared.SubFloor
/// <seealso cref="P:Content.Shared.Maps.ContentTileDefinition.IsSubFloor" />
[NetworkedComponent]
[RegisterComponent]
[Access(typeof(SharedSubFloorHideSystem))]
[Friend(typeof(SharedSubFloorHideSystem))]
public sealed class SubFloorHideComponent : Component
{
/// <summary>
@@ -47,7 +47,6 @@ namespace Content.Shared.SubFloor
/// The entities this subfloor is revealed by.
/// </summary>
[ViewVariables]
[Access(typeof(SharedSubFloorHideSystem), Other = AccessPermissions.ReadWriteExecute)] // FIXME Friends
public HashSet<EntityUid> RevealedBy { get; set; } = new();
}
}

View File

@@ -3,12 +3,11 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototy
namespace Content.Shared.Tag
{
[RegisterComponent, Access(typeof(TagSystem))]
[RegisterComponent, Friend(typeof(TagSystem))]
public sealed class TagComponent : Component, ISerializationHooks
{
[ViewVariables]
[DataField("tags", customTypeSerializer: typeof(PrototypeIdHashSetSerializer<TagPrototype>))]
[Access(typeof(TagSystem), Other = AccessPermissions.ReadExecute)] // FIXME Friends
public readonly HashSet<string> Tags = new();
}
}