UtensilComponent.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using Content.Shared.Nutrition.EntitySystems;
  2. using Robust.Shared.Audio;
  3. using Robust.Shared.GameStates;
  4. namespace Content.Shared.Nutrition.Components
  5. {
  6. [RegisterComponent, NetworkedComponent, Access(typeof(SharedUtensilSystem))]
  7. public sealed partial class UtensilComponent : Component
  8. {
  9. [DataField("types")]
  10. private UtensilType _types = UtensilType.None;
  11. [ViewVariables]
  12. public UtensilType Types
  13. {
  14. get => _types;
  15. set
  16. {
  17. if (_types.Equals(value))
  18. return;
  19. _types = value;
  20. }
  21. }
  22. /// <summary>
  23. /// The chance that the utensil has to break with each use.
  24. /// A value of 0 means that it is unbreakable.
  25. /// </summary>
  26. [DataField("breakChance")]
  27. public float BreakChance;
  28. /// <summary>
  29. /// The sound to be played if the utensil breaks.
  30. /// </summary>
  31. [DataField("breakSound")]
  32. public SoundSpecifier BreakSound = new SoundPathSpecifier("/Audio/Items/snap.ogg");
  33. }
  34. // If you want to make a fancy output on "wrong" composite utensil use (like: you need fork and knife)
  35. // There should be Dictionary I guess (Dictionary<UtensilType, string>)
  36. [Flags]
  37. public enum UtensilType : byte
  38. {
  39. None = 0,
  40. Fork = 1,
  41. Spoon = 1 << 1,
  42. Knife = 1 << 2
  43. }
  44. }