using Content.Shared.DeviceLinking;
using Content.Shared.Item;
using Content.Shared.Kitchen.EntitySystems;
using Content.Shared.Temperature.Components;
using Content.Shared.Whitelist;
using Robust.Shared.Audio;
using Robust.Shared.Containers;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
namespace Content.Shared.Kitchen.Components;
///
/// A component applied to microwaves, which are used to heat entities/solutions
/// and produce microwave recipes.
///
[RegisterComponent]
[Access(typeof(MicrowaveSystem))]
[NetworkedComponent, AutoGenerateComponentState(fieldDeltas: true, raiseAfterAutoHandleState: true)]
public sealed partial class MicrowaveComponent : Component
{
///
/// A multiplier applied to all microwave cooking timers.
///
///
/// If you set a microwave for 30 seconds, but have a CookTimeMultiplier of 0.5,
/// recipes will be processed as if you're portioning for 30 seconds, but the
/// microwave's timer will take 15 seconds instead. So, if you have a recipe with
/// a cookTime of 10 seconds, you can still make that recipe 3 at a time.
///
/// Note that faster cooking times make the microwave less useful for actual heating
/// (temperature) as thermal energy added to the contents is based on elapsed time.
///
[DataField]
public float CookTimeMultiplier = 1;
///
/// A multiplier for heat added to the contents of a microwave every cook cycle.
///
///
/// The formula is (elapsed time between dt * ).
///
[DataField]
public float DeltaHeat = 100;
///
/// A multiplier for added heat on entities with a .
///
[DataField]
public float ObjectHeatMultiplier = 100;
///
/// An entity that is produced when an item is melted in the microwave.
///
///
/// The microwave will burn items that pass the .
///
[DataField]
public EntProtoId FailureResult = "FoodBadRecipe";
#region Audio
///
/// A sound that is played when the microwave is activated.
///
[DataField]
public SoundSpecifier BeginCookingSound = new SoundPathSpecifier("/Audio/Machines/microwave_start_beep.ogg");
///
/// A sound that is played when the microwave finishes.
///
///
/// Beep... beep... beep
///
[DataField]
public SoundSpecifier FoodDoneSound = new SoundPathSpecifier("/Audio/Machines/microwave_done_beep.ogg");
///
/// A sound that is played when a player navigates the microwave's UI - for example, selecting
/// a new cooking time.
///
[DataField]
public SoundSpecifier ClickSound = new SoundPathSpecifier("/Audio/Machines/machine_switch.ogg")
{
Params = AudioParams.Default.AddVolume(-2),
};
///
/// The humming sound played when a microwave is actively cooking.
///
[DataField]
public SoundSpecifier LoopingSound = new SoundPathSpecifier("/Audio/Machines/microwave_loop.ogg");
#endregion Audio
///
/// An audio stream for the microwave's "cooking" hum.
///
[DataField]
public EntityUid? PlayingStream;
///
/// Whether or not this microwave is broken.
///
[DataField]
[AutoNetworkedField]
public bool Broken;
///
/// A port used to activate the microwave via remote signal.
///
[DataField]
public ProtoId OnPort = "On";
///
/// The currently-selected cook time, in seconds. This must be a multiple of 5 (or 0).
///
///
/// The cook times for all recipes should be divisible by 5, with a minimum of 1 second.
/// For right now, I don't think any recipe cook time should be greater than 60 seconds.
///
[DataField]
[AutoNetworkedField]
[Access(typeof(MicrowaveSystem), Other = AccessPermissions.ReadExecute)]
public uint CurrentCookTimerTime;
///
/// The index of the currently-selected "cook time" button.
///
[DataField]
[AutoNetworkedField]
public int CurrentCookTimeButtonIndex;
///
/// The maximum number of seconds a microwave can be set to.
/// This is currently only used for validation and the client does not check this.
///
[DataField]
public uint MaxCookTime = 30;
///
/// The max temperature that this microwave can heat objects to.
///
[DataField]
public float TemperatureUpperThreshold = 373.15f;
///
/// The microwave's contents container.
///
public Container Storage = default!;
///
/// The ID of the storage container for the microwave.
///
[DataField]
public string ContainerId = "microwave_entity_container";
///
/// How many items the microwave can hold.
///
[DataField]
public int Capacity = 10;
///
/// The largest item size that can fit in the microwave.
///
[DataField]
public ProtoId MaxItemSize = "Normal";
///
/// How frequently the microwave can malfunction while active.
///
[DataField]
public TimeSpan MalfunctionInterval = TimeSpan.FromSeconds(1.0f);
///
/// How frequently the microwave can update (process cooking cycle) while active.
///
[DataField]
public TimeSpan UpdateInterval = TimeSpan.FromSeconds(1.0f);
///
/// Chance of an explosion occurring when we microwave a metallic object.
///
///
/// This is rolled every .
///
[DataField]
public float ExplosionChance = 0.1f;
///
/// Chance of lightning occurring when we microwave a metallic object.
///
///
/// This is rolled every .
///
[DataField]
public float LightningChance = 0.75f;
///
/// If this microwave can give ID cards new accesses without exploding.
///
[DataField]
public bool CanMicrowaveIdsSafely = true;
///
/// Entities that fulfill this whitelist will cause the microwave to malfunction
/// on activation. By default, this is metal objects.
///
[DataField]
public EntityWhitelist? MalfunctionWhenCookedWhitelist = new()
{
Tags = new() { "Metal" }
};
///
/// Entities that fulfill this whitelist will create a burned mess when microwaved.
/// By default, this is plastic objects.
///
[DataField]
public EntityWhitelist? BurnWhenCookedWhitelist = new()
{
Tags = new() { "Plastic" }
};
///
/// A "spark" entity spawned when this microwave malfunctions.
///
[DataField]
public EntProtoId MalfunctionSpark = "Spark";
}