BatteryWeaponFireModes refactor (#24502)

* BatteryWeaponFireModes refactor

Made the code a bit better but still needs integrating into attachments.

* murder

* Fix serialization

* weh

* weh
This commit is contained in:
metalgearsloth
2024-01-29 11:09:56 +11:00
committed by GitHub
parent 4e8b1fb0d3
commit 58b55ba06c
3 changed files with 43 additions and 59 deletions

View File

@@ -1,44 +0,0 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Content.Server.Weapons.Ranged.Systems;
namespace Content.Server.Weapons.Ranged.Components;
/// <summary>
/// Allows battery weapons to fire different types of projectiles
/// </summary>
[RegisterComponent]
[Access(typeof(BatteryWeaponFireModesSystem))]
[AutoGenerateComponentState]
public sealed partial class BatteryWeaponFireModesComponent : Component
{
/// <summary>
/// A list of the different firing modes the weapon can switch between
/// </summary>
[DataField("fireModes", required: true)]
[AutoNetworkedField]
public List<BatteryWeaponFireMode> FireModes = new();
/// <summary>
/// The currently selected firing mode
/// </summary>
[DataField("currentFireMode")]
[AutoNetworkedField]
public BatteryWeaponFireMode? CurrentFireMode = default!;
}
[DataDefinition]
public sealed partial class BatteryWeaponFireMode
{
/// <summary>
/// The projectile prototype associated with this firing mode
/// </summary>
[DataField("proto", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string Prototype = default!;
/// <summary>
/// The battery cost to fire the projectile associated with this firing mode
/// </summary>
[DataField("fireCost")]
public float FireCost = 100;
}