Remove field: from DataField attributes (#3932)

This commit is contained in:
DrSmugleaf
2021-05-04 15:37:16 +02:00
committed by GitHub
parent 85f3871536
commit ad3b7fe97d
84 changed files with 228 additions and 242 deletions

View File

@@ -12,7 +12,7 @@ namespace Content.Server.GameObjects.Components.AI
// These are immutable so any dynamic changes aren't saved back over.
// AiFactionSystem will just read these and then store them.
[ViewVariables]
[field: DataField("id", required: true)]
[DataField("id", required: true)]
public string ID { get; } = default!;
[DataField("hostile")]

View File

@@ -34,7 +34,7 @@ namespace Content.Server.GameObjects.Components.Access
/// List of access lists to check allowed against. For an access check to pass
/// there has to be an access list that is a subset of the access in the checking list.
/// </summary>
[field: DataField("access")]
[DataField("access")]
[ViewVariables]
public List<HashSet<string>> AccessLists { get; } = new();

View File

@@ -24,7 +24,7 @@ namespace Content.Server.GameObjects.Components
/// Minimum time to wait before saying a new ad, in seconds. Has to be larger than or equal to 1.
/// </summary>
[ViewVariables]
[field: DataField("minWait")]
[DataField("minWait")]
private int MinWait { get; } = 480; // 8 minutes
/// <summary>
@@ -32,10 +32,10 @@ namespace Content.Server.GameObjects.Components
/// to <see cref="MinWait"/>
/// </summary>
[ViewVariables]
[field: DataField("maxWait")]
[DataField("maxWait")]
private int MaxWait { get; } = 600; // 10 minutes
[field: DataField("pack")]
[DataField("pack")]
private string PackPrototypeId { get; } = string.Empty;
private List<string> _advertisements = new();

View File

@@ -1,7 +1,6 @@
#nullable enable
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.Atmos;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Log;
@@ -45,7 +44,7 @@ namespace Content.Server.GameObjects.Components.Atmos
private bool _fixAirBlockedDirectionInitialize = true;
[ViewVariables]
[field: DataField("noAirWhenFullyAirBlocked")]
[DataField("noAirWhenFullyAirBlocked")]
public bool NoAirWhenFullyAirBlocked { get; } = true;
[ViewVariables(VVAccess.ReadWrite)]

View File

@@ -13,7 +13,7 @@ namespace Content.Server.GameObjects.Components.BarSign
private string _name = "";
[ViewVariables]
[field: DataField("id", required: true)]
[DataField("id", required: true)]
public string ID { get; } = default!;

View File

@@ -17,8 +17,8 @@ using Robust.Shared.Player;
using Robust.Shared.Players;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components
{
@@ -38,7 +38,7 @@ namespace Content.Server.GameObjects.Components
public int Charges { get; set; }
[ViewVariables(VVAccess.ReadWrite)]
[field: DataField("capacity")]
[DataField("capacity")]
public int Capacity { get; set; } = 30;
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(CrayonUiKey.Key);

View File

@@ -14,7 +14,7 @@ namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Triggers
[DataDefinition]
public class OrTrigger : IThresholdTrigger
{
[field: DataField("triggers")]
[DataField("triggers")]
public List<IThresholdTrigger> Triggers { get; } = new();
public bool Reached(IDamageableComponent damageable, DestructibleSystem system)

View File

@@ -1,11 +1,11 @@
#nullable enable
using System.Threading;
using Content.Shared.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.ViewVariables;
using System.Threading;
namespace Content.Server.GameObjects.Components.Engineering
{
@@ -16,7 +16,7 @@ namespace Content.Server.GameObjects.Components.Engineering
public override uint? NetID => ContentNetIDs.DISASSEMBLE_ON_ACTIVATE;
[ViewVariables]
[field: DataField("prototype", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
[DataField("prototype", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string? Prototype { get; }
[ViewVariables]

View File

@@ -15,7 +15,7 @@ namespace Content.Server.GameObjects.Components.Engineering
public override uint? NetID => ContentNetIDs.SPAWN_AFTER_INTERACT;
[ViewVariables]
[field: DataField("prototype", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
[DataField("prototype", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string? Prototype { get; }
[ViewVariables]

View File

@@ -1,20 +1,17 @@
#nullable enable
using System.Threading.Tasks;
using Content.Server.GameObjects.Components.Chemistry;
using Content.Server.GameObjects.EntitySystems.DoAfter;
using Content.Shared.Chemistry;
using Content.Shared.Interfaces;
using Content.Shared.Interfaces.GameObjects.Components;
using Content.Shared.Utility;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
using Robust.Shared.Serialization;
using System.Threading.Tasks;
using Content.Server.GameObjects.EntitySystems.DoAfter;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Player;
using Robust.Shared.ViewVariables;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Fluids
{
@@ -52,7 +49,7 @@ namespace Content.Server.GameObjects.Components.Fluids
// Picking up a puddle requires multiple clicks
// Dumping in a bucket requires 1 click
// Long-term you'd probably use a cooldown and start the pickup once we have some form of global cooldown
[field: DataField("pickup_amount")]
[DataField("pickup_amount")]
public ReagentUnit PickupAmount { get; } = ReagentUnit.New(5);
[DataField("pickup_sound")]

View File

@@ -22,22 +22,22 @@ namespace Content.Server.GameObjects.Components.Interactable
{
[DataField("behavior")] public ToolQuality Behavior { get; private set; } = ToolQuality.None;
[field: DataField("state")]
[DataField("state")]
public string State { get; } = string.Empty;
[field: DataField("texture")]
[DataField("texture")]
public string Texture { get; } = string.Empty;
[field: DataField("sprite")]
[DataField("sprite")]
public string Sprite { get; } = string.Empty;
[field: DataField("useSound")]
[DataField("useSound")]
public string Sound { get; } = string.Empty;
[field: DataField("useSoundCollection")]
[DataField("useSoundCollection")]
public string SoundCollection { get; } = string.Empty;
[field: DataField("changeSound")]
[DataField("changeSound")]
public string ChangeSound { get; } = string.Empty;
}

View File

@@ -24,7 +24,7 @@ namespace Content.Server.GameObjects.Components.MachineLinking
/// 0 is unlimited range
/// </summary>
[ViewVariables]
[field: DataField("range")]
[DataField("range")]
public float Range { get; private set; } = 10;
[DataField("signalReceivers")] private List<EntityUid> _receiverIds = new();

View File

@@ -19,7 +19,7 @@ namespace Content.Server.GameObjects.Components.Markers
private string? _jobId;
[field: ViewVariables(VVAccess.ReadWrite)]
[field: DataField("spawn_type")]
[DataField("spawn_type")]
public SpawnPointType SpawnType { get; } = SpawnPointType.Unset;
public JobPrototype? Job => string.IsNullOrEmpty(_jobId) ? null : _prototypeManager.Index<JobPrototype>(_jobId);

View File

@@ -16,7 +16,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
public override string Name => "CreamPie";
[ViewVariables(VVAccess.ReadWrite)]
[field: DataField("paralyzeTime")]
[DataField("paralyzeTime")]
public float ParalyzeTime { get; set; } = 1f;
public void PlaySound()

View File

@@ -3,10 +3,8 @@ using Content.Server.GameObjects.Components.Mobs;
using Content.Shared.Damage;
using Content.Shared.GameObjects.Components.Damage;
using Content.Shared.GameObjects.Components.Projectiles;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Collision;
using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Player;
@@ -32,7 +30,7 @@ namespace Content.Server.GameObjects.Components.Projectiles
set => _damages = value;
}
[field: DataField("deleteOnCollide")]
[DataField("deleteOnCollide")]
public bool DeleteOnCollide { get; } = true;
// Get that juicy FPS hit sound

View File

@@ -15,7 +15,7 @@ namespace Content.Server.GameObjects.Components.Research
/// Whether new recipes can be added to this database or not.
/// </summary>
[ViewVariables]
[field: DataField("static")]
[DataField("static")]
public bool Static { get; private set; } = false;
public override ComponentState GetComponentState(ICommonSession player)

View File

@@ -47,28 +47,28 @@ namespace Content.Server.GameObjects.Components.Strap
/// <summary>
/// The change in position to the strapped mob
/// </summary>
[field: DataField("position")]
[DataField("position")]
public StrapPosition Position { get; } = StrapPosition.None;
/// <summary>
/// The sound to be played when a mob is buckled
/// </summary>
[ViewVariables]
[field: DataField("buckleSound")]
[DataField("buckleSound")]
public string BuckleSound { get; } = "/Audio/Effects/buckle.ogg";
/// <summary>
/// The sound to be played when a mob is unbuckled
/// </summary>
[ViewVariables]
[field: DataField("unbuckleSound")]
[DataField("unbuckleSound")]
public string UnbuckleSound { get; } = "/Audio/Effects/unbuckle.ogg";
/// <summary>
/// ID of the alert to show when buckled
/// </summary>
[ViewVariables]
[field: DataField("buckledAlertType")]
[DataField("buckledAlertType")]
public AlertType BuckledAlertType { get; } = AlertType.Buckled;
/// <summary>

View File

@@ -26,7 +26,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
public override string Name => "Ammo";
[field: DataField("caliber")]
[DataField("caliber")]
public BallisticCaliber Caliber { get; } = BallisticCaliber.Unspecified;
public bool Spent
@@ -53,7 +53,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
/// <summary>
/// Used for something that is deleted when the projectile is retrieved
/// </summary>
[field: DataField("caseless")]
[DataField("caseless")]
public bool Caseless { get; }
// Rather than managing bullet / case state seemed easier to just have 2 toggles
@@ -62,26 +62,26 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
/// <summary>
/// For shotguns where they might shoot multiple entities
/// </summary>
[field: DataField("projectilesFired")]
[DataField("projectilesFired")]
public int ProjectilesFired { get; } = 1;
[DataField("projectile")]
private string? _projectileId;
// How far apart each entity is if multiple are shot
[field: DataField("ammoSpread")]
[DataField("ammoSpread")]
public float EvenSpreadAngle { get; } = default;
/// <summary>
/// How fast the shot entities travel
/// </summary>
[field: DataField("ammoVelocity")]
[DataField("ammoVelocity")]
public float Velocity { get; } = 20f;
[DataField("muzzleFlash")]
private string _muzzleFlashSprite = "Objects/Weapons/Guns/Projectiles/bullet_muzzle.png";
[field: DataField("soundCollectionEject")]
[DataField("soundCollectionEject")]
public string? SoundCollectionEject { get; } = "CasingEject";
void ISerializationHooks.AfterDeserialization()

View File

@@ -39,7 +39,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
}
private const int DefaultCapacity = 6;
[field: DataField("capacity")]
[DataField("capacity")]
public override int Capacity { get; } = DefaultCapacity;
// Even a point having a chamber? I guess it makes some of the below code cleaner

View File

@@ -10,7 +10,6 @@ using Content.Shared.GameObjects.Components.Damage;
using Content.Shared.GameObjects.Components.Weapons.Ranged;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.Asynchronous;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
@@ -51,7 +50,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
[DataField("allSelectors")]
private FireRateSelector _allRateSelectors;
[field: DataField("fireRate")]
[DataField("fireRate")]
public override float FireRate { get; } = 2f;
// _lastFire is when we actually fired (so if we hold the button then recoil doesn't build up if we're not firing)
@@ -93,14 +92,14 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
[DataField("ammoSpreadRatio")]
public float SpreadRatio { get; private set; }
[field: DataField("canMuzzleFlash")]
[DataField("canMuzzleFlash")]
public bool CanMuzzleFlash { get; } = true;
// Sounds
[field: DataField("soundGunshot")]
[DataField("soundGunshot")]
public string? SoundGunshot { get; set; }
[field: DataField("soundEmpty")]
[DataField("soundEmpty")]
public string SoundEmpty { get; } = "/Audio/Weapons/Guns/Empty/empty.ogg";
void ISerializationHooks.BeforeSerialization()