MicrowaveComponent.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. using Content.Shared.Construction.Prototypes;
  2. using Content.Shared.DeviceLinking;
  3. using Content.Shared.Item;
  4. using Robust.Shared.Audio;
  5. using Robust.Shared.Containers;
  6. using Robust.Shared.Prototypes;
  7. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
  8. namespace Content.Server.Kitchen.Components
  9. {
  10. [RegisterComponent]
  11. public sealed partial class MicrowaveComponent : Component
  12. {
  13. [DataField("cookTimeMultiplier"), ViewVariables(VVAccess.ReadWrite)]
  14. public float CookTimeMultiplier = 1;
  15. [DataField("baseHeatMultiplier"), ViewVariables(VVAccess.ReadWrite)]
  16. public float BaseHeatMultiplier = 100;
  17. [DataField("objectHeatMultiplier"), ViewVariables(VVAccess.ReadWrite)]
  18. public float ObjectHeatMultiplier = 100;
  19. [DataField("failureResult", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
  20. public string BadRecipeEntityId = "FoodBadRecipe";
  21. #region audio
  22. [DataField("beginCookingSound")]
  23. public SoundSpecifier StartCookingSound = new SoundPathSpecifier("/Audio/Machines/microwave_start_beep.ogg");
  24. [DataField("foodDoneSound")]
  25. public SoundSpecifier FoodDoneSound = new SoundPathSpecifier("/Audio/Machines/microwave_done_beep.ogg");
  26. [DataField("clickSound")]
  27. public SoundSpecifier ClickSound = new SoundPathSpecifier("/Audio/Machines/machine_switch.ogg");
  28. [DataField("ItemBreakSound")]
  29. public SoundSpecifier ItemBreakSound = new SoundPathSpecifier("/Audio/Effects/clang.ogg");
  30. public EntityUid? PlayingStream;
  31. [DataField("loopingSound")]
  32. public SoundSpecifier LoopingSound = new SoundPathSpecifier("/Audio/Machines/microwave_loop.ogg");
  33. #endregion
  34. [ViewVariables]
  35. public bool Broken;
  36. [DataField, ViewVariables(VVAccess.ReadWrite)]
  37. public ProtoId<SinkPortPrototype> OnPort = "On";
  38. /// <summary>
  39. /// This is a fixed offset of 5.
  40. /// The cook times for all recipes should be divisible by 5,with a minimum of 1 second.
  41. /// For right now, I don't think any recipe cook time should be greater than 60 seconds.
  42. /// </summary>
  43. [DataField("currentCookTimerTime"), ViewVariables(VVAccess.ReadWrite)]
  44. public uint CurrentCookTimerTime = 0;
  45. /// <summary>
  46. /// Tracks the elapsed time of the current cook timer.
  47. /// </summary>
  48. [DataField, ViewVariables(VVAccess.ReadWrite)]
  49. public TimeSpan CurrentCookTimeEnd = TimeSpan.Zero;
  50. /// <summary>
  51. /// The maximum number of seconds a microwave can be set to.
  52. /// This is currently only used for validation and the client does not check this.
  53. /// </summary>
  54. [DataField("maxCookTime"), ViewVariables(VVAccess.ReadWrite)]
  55. public uint MaxCookTime = 30;
  56. /// <summary>
  57. /// The max temperature that this microwave can heat objects to.
  58. /// </summary>
  59. [DataField("temperatureUpperThreshold")]
  60. public float TemperatureUpperThreshold = 373.15f;
  61. public int CurrentCookTimeButtonIndex;
  62. public Container Storage = default!;
  63. [DataField]
  64. public string ContainerId = "microwave_entity_container";
  65. [DataField, ViewVariables(VVAccess.ReadWrite)]
  66. public int Capacity = 10;
  67. [DataField, ViewVariables(VVAccess.ReadWrite)]
  68. public ProtoId<ItemSizePrototype> MaxItemSize = "Normal";
  69. /// <summary>
  70. /// How frequently the microwave can malfunction.
  71. /// </summary>
  72. [DataField]
  73. public float MalfunctionInterval = 1.0f;
  74. /// <summary>
  75. /// Chance of an explosion occurring when we microwave a metallic object
  76. /// </summary>
  77. [DataField, ViewVariables(VVAccess.ReadWrite)]
  78. public float ExplosionChance = .1f;
  79. /// <summary>
  80. /// Chance of lightning occurring when we microwave a metallic object
  81. [DataField, ViewVariables(VVAccess.ReadWrite)]
  82. public float LightningChance = .75f;
  83. /// <summary>
  84. /// If this microwave can give ids accesses without exploding
  85. /// </summary>
  86. [DataField, ViewVariables(VVAccess.ReadWrite)]
  87. public bool CanMicrowaveIdsSafely = true;
  88. }
  89. public sealed class BeingMicrowavedEvent : HandledEntityEventArgs
  90. {
  91. public EntityUid Microwave;
  92. public EntityUid? User;
  93. public BeingMicrowavedEvent(EntityUid microwave, EntityUid? user)
  94. {
  95. Microwave = microwave;
  96. User = user;
  97. }
  98. }
  99. }