DevourerComponent.cs 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. using Content.Shared.Chemistry.Reagent;
  2. using Content.Shared.Whitelist;
  3. using Robust.Shared.Audio;
  4. using Robust.Shared.Containers;
  5. using Robust.Shared.GameStates;
  6. using Robust.Shared.Prototypes;
  7. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
  8. namespace Content.Shared.Devour.Components;
  9. [RegisterComponent, NetworkedComponent]
  10. [Access(typeof(SharedDevourSystem))]
  11. public sealed partial class DevourerComponent : Component
  12. {
  13. [DataField("devourAction", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
  14. public string? DevourAction = "ActionDevour";
  15. [DataField("devourActionEntity")]
  16. public EntityUid? DevourActionEntity;
  17. [ViewVariables(VVAccess.ReadWrite), DataField("soundDevour")]
  18. public SoundSpecifier? SoundDevour = new SoundPathSpecifier("/Audio/Effects/demon_consume.ogg")
  19. {
  20. Params = AudioParams.Default.WithVolume(-3f),
  21. };
  22. [DataField("devourTime")]
  23. public float DevourTime = 3f;
  24. /// <summary>
  25. /// The amount of time it takes to devour something
  26. /// <remarks>
  27. /// NOTE: original intended design was to increase this proportionally with damage thresholds, but those proved quite difficult to get consistently. right now it devours the structure at a fixed timer.
  28. /// </remarks>
  29. /// </summary>
  30. [DataField("structureDevourTime")]
  31. public float StructureDevourTime = 10f;
  32. [ViewVariables(VVAccess.ReadWrite), DataField("soundStructureDevour")]
  33. public SoundSpecifier? SoundStructureDevour = new SoundPathSpecifier("/Audio/Machines/airlock_creaking.ogg")
  34. {
  35. Params = AudioParams.Default.WithVolume(-3f),
  36. };
  37. /// <summary>
  38. /// Where the entities go when it devours them, empties when it is butchered.
  39. /// </summary>
  40. public Container Stomach = default!;
  41. [ViewVariables(VVAccess.ReadWrite), DataField("shouldStoreDevoured")]
  42. public bool ShouldStoreDevoured = true;
  43. [ViewVariables(VVAccess.ReadWrite), DataField("whitelist")]
  44. public EntityWhitelist? Whitelist = new()
  45. {
  46. Components = new[]
  47. {
  48. "MobState",
  49. }
  50. };
  51. /// <summary>
  52. /// The chemical ID injected upon devouring
  53. /// </summary>
  54. [DataField("chemical", customTypeSerializer: typeof(PrototypeIdSerializer<ReagentPrototype>))]
  55. public string Chemical = "Ichor";
  56. /// <summary>
  57. /// The amount of ichor injected per devour
  58. /// </summary>
  59. [ViewVariables(VVAccess.ReadWrite), DataField("healRate")]
  60. public float HealRate = 15f;
  61. /// <summary>
  62. /// The favorite food not only feeds you, but also heals
  63. /// </summary>
  64. [DataField("foodPreference")]
  65. public FoodPreference FoodPreference = FoodPreference.All;
  66. }