Refactor serialization copying to use source generators (#19412)
This commit is contained in:
@@ -7,7 +7,7 @@ namespace Content.Shared.Weapons.Marker;
|
||||
/// Applies leech upon hitting a damage marker target.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed class LeechOnMarkerComponent : Component
|
||||
public sealed partial class LeechOnMarkerComponent : Component
|
||||
{
|
||||
// TODO: Can't network damagespecifiers yet last I checked.
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Content.Shared.Weapons.Melee.Components;
|
||||
|
||||
[RegisterComponent, NetworkedComponent, Access(typeof(SharedMeleeWeaponSystem))]
|
||||
public sealed class BonusMeleeAttackRateComponent : Component
|
||||
public sealed partial class BonusMeleeAttackRateComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The value added onto the attack rate of a melee weapon
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Content.Shared.Weapons.Melee.Components;
|
||||
/// This exists only for event relays and doing entity shenanigans.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent, Access(typeof(SharedMeleeWeaponSystem))]
|
||||
public sealed class BonusMeleeDamageComponent : Component
|
||||
public sealed partial class BonusMeleeDamageComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The damage that will be added.
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Content.Shared.Weapons.Melee.Components;
|
||||
/// Indicates that this meleeweapon requires wielding to be useable.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent, Access(typeof(WieldableSystem))]
|
||||
public sealed class MeleeRequiresWieldComponent : Component
|
||||
public sealed partial class MeleeRequiresWieldComponent : Component
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Content.Shared.Weapons.Melee.Components;
|
||||
/// Plays the specified sound upon receiving damage of the specified type.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed class MeleeSoundComponent : Component
|
||||
public sealed partial class MeleeSoundComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Specified sounds to apply when the entity takes damage with the specified group.
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Content.Shared.Weapons.Melee;
|
||||
/// When given to a mob lets them do unarmed attacks, or when given to an item lets someone wield it to do attacks.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed class MeleeWeaponComponent : Component
|
||||
public sealed partial class MeleeWeaponComponent : Component
|
||||
{
|
||||
// TODO: This is becoming bloated as shit.
|
||||
// This should just be its own component for alt attacks.
|
||||
|
||||
@@ -2,7 +2,7 @@ using Robust.Shared.Audio;
|
||||
|
||||
namespace Content.Shared.Weapons.Misc;
|
||||
|
||||
public abstract class BaseForceGunComponent : Component
|
||||
public abstract partial class BaseForceGunComponent : Component
|
||||
{
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("lineColor"), AutoNetworkedField]
|
||||
public Color LineColor = Color.Orange;
|
||||
|
||||
@@ -3,7 +3,7 @@ using Robust.Shared.GameStates;
|
||||
namespace Content.Shared.Weapons.Misc;
|
||||
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed class GrapplingProjectileComponent : Component
|
||||
public sealed partial class GrapplingProjectileComponent : Component
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Content.Shared.Weapons.Ranged.Components;
|
||||
/// Allows the entity to be fired from a gun.
|
||||
/// </summary>
|
||||
[RegisterComponent, Virtual]
|
||||
public class AmmoComponent : Component, IShootable
|
||||
public partial class AmmoComponent : Component, IShootable
|
||||
{
|
||||
// Muzzle flash stored on ammo because if we swap a gun to whatever we may want to override it.
|
||||
|
||||
|
||||
@@ -3,4 +3,4 @@ using Robust.Shared.GameStates;
|
||||
namespace Content.Shared.Weapons.Ranged.Components;
|
||||
|
||||
[NetworkedComponent]
|
||||
public abstract class AmmoProviderComponent : Component {}
|
||||
public abstract partial class AmmoProviderComponent : Component {}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Content.Shared.Weapons.Ranged.Components;
|
||||
|
||||
public abstract class BatteryAmmoProviderComponent : AmmoProviderComponent
|
||||
public abstract partial class BatteryAmmoProviderComponent : AmmoProviderComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// How much battery it costs to fire once.
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Content.Shared.Weapons.Ranged.Components;
|
||||
/// to an entity in the user's clothing slot.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent, Access(typeof(SharedGunSystem))]
|
||||
public sealed class ClothingSlotAmmoProviderComponent : AmmoProviderComponent
|
||||
public sealed partial class ClothingSlotAmmoProviderComponent : AmmoProviderComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// The slot that the ammo provider should be located in.
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Content.Shared.Weapons.Ranged.Components;
|
||||
/// Handles pulling entities from the given container to use as ammunition.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed class ContainerAmmoProviderComponent : AmmoProviderComponent
|
||||
public sealed partial class ContainerAmmoProviderComponent : AmmoProviderComponent
|
||||
{
|
||||
[DataField("container", required: true)]
|
||||
[ViewVariables]
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Content.Shared.Weapons.Ranged.Components;
|
||||
/// Indicates that this gun requires wielding to be useable.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent, Access(typeof(WieldableSystem))]
|
||||
public sealed class GunRequiresWieldComponent : Component
|
||||
public sealed partial class GunRequiresWieldComponent : Component
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototy
|
||||
namespace Content.Shared.Weapons.Ranged.Components;
|
||||
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed class HitscanBatteryAmmoProviderComponent : BatteryAmmoProviderComponent
|
||||
public sealed partial class HitscanBatteryAmmoProviderComponent : BatteryAmmoProviderComponent
|
||||
{
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("proto", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<HitscanPrototype>))]
|
||||
public string Prototype = default!;
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Content.Shared.Weapons.Ranged;
|
||||
/// Wrapper around a magazine (handled via ItemSlot). Passes all AmmoProvider logic onto it.
|
||||
/// </summary>
|
||||
[RegisterComponent, Virtual]
|
||||
public class MagazineAmmoProviderComponent : AmmoProviderComponent
|
||||
public partial class MagazineAmmoProviderComponent : AmmoProviderComponent
|
||||
{
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("soundAutoEject")]
|
||||
public SoundSpecifier? SoundAutoEject = new SoundPathSpecifier("/Audio/Weapons/Guns/EmptyAlarm/smg_empty_alarm.ogg");
|
||||
|
||||
@@ -5,7 +5,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototy
|
||||
namespace Content.Shared.Weapons.Ranged.Components;
|
||||
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed class ProjectileBatteryAmmoProviderComponent : BatteryAmmoProviderComponent
|
||||
public sealed partial class ProjectileBatteryAmmoProviderComponent : BatteryAmmoProviderComponent
|
||||
{
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("proto", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
||||
public string Prototype = default!;
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Content.Shared.Weapons.Ranged.Components;
|
||||
/// Recharges ammo upon the gun being cycled.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed class RechargeCycleAmmoComponent : Component
|
||||
public sealed partial class RechargeCycleAmmoComponent : Component
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Content.Shared.Weapons.Ranged.Components;
|
||||
/// Only applies if it is shot like a projectile and not if it is thrown.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed class ReflectiveComponent : Component
|
||||
public sealed partial class ReflectiveComponent : Component
|
||||
{
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("reflective")]
|
||||
public ReflectType Reflective = ReflectType.NonEnergy;
|
||||
|
||||
@@ -8,7 +8,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototy
|
||||
namespace Content.Shared.Weapons.Ranged.Components;
|
||||
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed class RevolverAmmoProviderComponent : AmmoProviderComponent
|
||||
public sealed partial class RevolverAmmoProviderComponent : AmmoProviderComponent
|
||||
{
|
||||
/*
|
||||
* Revolver has an array of its slots of which we can fire from any index.
|
||||
|
||||
@@ -6,4 +6,4 @@ namespace Content.Shared.Weapons.Ranged.Components;
|
||||
/// Shows an ItemStatus with the ammo of the gun. Adjusts based on what the ammoprovider is.
|
||||
/// </summary>
|
||||
[NetworkedComponent]
|
||||
public abstract class SharedAmmoCounterComponent : Component {}
|
||||
public abstract partial class SharedAmmoCounterComponent : Component {}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Content.Shared.Weapons.Ranged.Components;
|
||||
/// Allows this entity to bulk change revolver ammo.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed class SpeedLoaderComponent : Component
|
||||
public sealed partial class SpeedLoaderComponent : Component
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Content.Shared.Weapons.Ranged.Components;
|
||||
/// Applies UseDelay whenever the entity shoots.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent, Access(typeof(UseDelayOnShootSystem))]
|
||||
public sealed class UseDelayOnShootComponent : Component
|
||||
public sealed partial class UseDelayOnShootComponent : Component
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public sealed class HitscanPrototype : IPrototype, IShootable
|
||||
{
|
||||
[ViewVariables]
|
||||
[IdDataField]
|
||||
public string ID { get; } = default!;
|
||||
public string ID { get; private set; } = default!;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("staminaDamage")]
|
||||
public float StaminaDamage;
|
||||
|
||||
@@ -96,7 +96,7 @@ public abstract partial class SharedGunSystem
|
||||
}
|
||||
|
||||
// TODO: Actions need doing for guns anyway.
|
||||
private sealed class CycleModeEvent : InstantActionEvent
|
||||
private sealed partial class CycleModeEvent : InstantActionEvent
|
||||
{
|
||||
public SelectiveFire Mode;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user