Donk co. microwave + microwave tweaks (#28951)
* THE syndie microwave * Always burn to explode microwave when copying * Make it so copying ids stop when the microwave is goign to explode * Made explosion destroy the board and spit out the machine parts * Move logic is MicrowaveSystem, make metal cooking use the same logic * Fix passing the wrong malfunction time * Shuttle cannot escape aggressive branding * Always make it explode with an id * Forgot to invert bool, move it after fry chance
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Body.Systems;
|
||||
using Content.Server.Chemistry.Containers.EntitySystems;
|
||||
using Content.Server.Construction;
|
||||
@@ -15,6 +16,7 @@ using Content.Shared.Body.Part;
|
||||
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;
|
||||
@@ -36,6 +38,7 @@ using System.Linq;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Timing;
|
||||
using Content.Shared.Stacks;
|
||||
using Content.Server.Construction.Components;
|
||||
|
||||
namespace Content.Server.Kitchen.EntitySystems
|
||||
{
|
||||
@@ -61,6 +64,7 @@ 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";
|
||||
@@ -408,6 +412,23 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
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>
|
||||
@@ -425,7 +446,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
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.
|
||||
}
|
||||
|
||||
@@ -532,7 +553,8 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user