using Content.Shared.Popups;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
+using Content.Server.Kitchen.EntitySystems;
namespace Content.Server.Access.Systems;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
+ [Dependency] private readonly MicrowaveSystem _microwave = default!;
public override void Initialize()
{
private void OnMicrowaved(EntityUid uid, IdCardComponent component, BeingMicrowavedEvent args)
{
- if (!component.CanMicrowave)
- return;
+ if (!component.CanMicrowave || !TryComp<MicrowaveComponent>(args.Microwave, out var micro) || micro.Broken)
+ return;
if (TryComp<AccessComponent>(uid, out var access))
{
float randomPick = _random.NextFloat();
+
// if really unlucky, burn card
if (randomPick <= 0.15f)
{
EntityManager.QueueDeleteEntity(uid);
return;
}
+
+ //Explode if the microwave can't handle it
+ if (!micro.CanMicrowaveIdsSafely)
+ {
+ _microwave.Explode((args.Microwave, micro));
+ return;
+ }
+
// If they're unlucky, brick their ID
if (randomPick <= 0.25f)
{
_adminLogger.Add(LogType.Action, LogImpact.Medium,
$"{ToPrettyString(args.Microwave)} added {random.ID} access to {ToPrettyString(uid):entity}");
+
}
}
}
+using Content.Server.Administration.Logs;
using Content.Server.Body.Systems;
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Server.Construction;
using Content.Shared.Chemistry.Components.SolutionManager;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Construction.EntitySystems;
+using Content.Shared.Database;
using Content.Shared.Destructible;
using Content.Shared.FixedPoint;
using Content.Shared.Interaction;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
using Content.Shared.Stacks;
+using Content.Server.Construction.Components;
namespace Content.Server.Kitchen.EntitySystems
{
[Dependency] private readonly SharedItemSystem _item = default!;
[Dependency] private readonly SharedStackSystem _stack = default!;
[Dependency] private readonly IPrototypeManager _prototype = default!;
+ [Dependency] private readonly IAdminLogManager _adminLogger = default!;
[ValidatePrototypeId<EntityPrototype>]
private const string MalfunctionSpark = "Spark";
return component.Storage.ContainedEntities.Any();
}
+ /// <summary>
+ /// Explodes the microwave internally, turning it into a broken state, destroying its board, and spitting out its machine parts
+ /// </summary>
+ /// <param name="ent"></param>
+ public void Explode(Entity<MicrowaveComponent> ent)
+ {
+ ent.Comp.Broken = true; // Make broken so we stop processing stuff
+ _explosion.TriggerExplosive(ent);
+ if (TryComp<MachineComponent>(ent, out var machine))
+ {
+ _container.CleanContainer(machine.BoardContainer);
+ _container.EmptyContainer(machine.PartContainer);
+ }
+
+ _adminLogger.Add(LogType.Action, LogImpact.Medium,
+ $"{ToPrettyString(ent)} exploded from unsafe cooking!");
+ }
/// <summary>
/// Handles the attempted cooking of unsafe objects
/// </summary>
ent.Comp1.MalfunctionTime = _gameTiming.CurTime + TimeSpan.FromSeconds(ent.Comp2.MalfunctionInterval);
if (_random.Prob(ent.Comp2.ExplosionChance))
{
- _explosion.TriggerExplosive(ent);
+ Explode((ent, ent.Comp2));
return; // microwave is fucked, stop the cooking.
}
activeComp.CookTimeRemaining = component.CurrentCookTimerTime * component.CookTimeMultiplier;
activeComp.TotalTime = component.CurrentCookTimerTime; //this doesn't scale so that we can have the "actual" time
activeComp.PortionedRecipe = portionedRecipe;
- component.CurrentCookTimeEnd = _gameTiming.CurTime + TimeSpan.FromSeconds(component.CurrentCookTimerTime);
+ //Scale tiems with cook times
+ component.CurrentCookTimeEnd = _gameTiming.CurTime + TimeSpan.FromSeconds(component.CurrentCookTimerTime * component.CookTimeMultiplier);
if (malfunctioning)
activeComp.MalfunctionTime = _gameTiming.CurTime + TimeSpan.FromSeconds(component.MalfunctionInterval);
UpdateUserInterfaceState(uid, component);