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:
Verm
2024-06-14 22:00:00 -05:00
committed by GitHub
parent 7d0798cea5
commit 41a081d5ef
15 changed files with 99 additions and 6 deletions

View File

@@ -9,6 +9,7 @@ using Content.Shared.Database;
using Content.Shared.Popups;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Content.Server.Kitchen.EntitySystems;
namespace Content.Server.Access.Systems;
@@ -18,6 +19,7 @@ public sealed class IdCardSystem : SharedIdCardSystem
[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()
{
@@ -27,12 +29,13 @@ public sealed class IdCardSystem : SharedIdCardSystem
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)
{
@@ -49,6 +52,14 @@ public sealed class IdCardSystem : SharedIdCardSystem
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)
{
@@ -73,6 +84,7 @@ public sealed class IdCardSystem : SharedIdCardSystem
_adminLogger.Add(LogType.Action, LogImpact.Medium,
$"{ToPrettyString(args.Microwave)} added {random.ID} access to {ToPrettyString(uid):entity}");
}
}
}

View File

@@ -101,6 +101,12 @@ namespace Content.Server.Kitchen.Components
/// Chance of lightning occurring when we microwave a metallic object
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float LightningChance = .75f;
/// <summary>
/// If this microwave can give ids accesses without exploding
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public bool CanMicrowaveIdsSafely = true;
}
public sealed class BeingMicrowavedEvent : HandledEntityEventArgs

View File

@@ -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);

View File

@@ -10994,7 +10994,7 @@ entities:
- type: Transform
pos: 18.918644,6.663283
parent: 104
- proto: KitchenMicrowave
- proto: SyndicateMicrowave
entities:
- uid: 10
components:

View File

@@ -3607,7 +3607,7 @@ entities:
- type: Transform
pos: 3.5,-3.5
parent: 1
- proto: KitchenMicrowave
- proto: SyndicateMicrowave
entities:
- uid: 497
components:

View File

@@ -105,3 +105,21 @@
- type: GuideHelp
guides:
- Chef
- type: entity
id: SyndicateMicrowave
parent: KitchenMicrowave
name: donk co. microwave
description: So advanced, it can cook donk-pockets in a mere 2.5 seconds!
components:
- type: Microwave
cookTimeMultiplier: 0.5
capacity: 10
canMicrowaveIdsSafely: false
explosionChance: 0.3
- type: Sprite
sprite: Structures/Machines/microwave_syndie.rsi
drawdepth: SmallObjects
snapCardinals: true

View File

@@ -0,0 +1,35 @@
{
"version": 1,
"size": {
"x": 32,
"y": 32
},
"license": "CC-BY-SA-3.0",
"copyright": "Taken from /tg/station at commit 9065b811726ae52be5d1889f436c01a24efbf47a, edited by github user @Flareguy for Space Station 14, modified by Vermidia",
"states": [
{
"name": "mw"
},
{
"name": "mw_unlit"
},
{
"name": "mw0"
},
{
"name": "mw_running_unlit"
},
{
"name": "mwb"
},
{
"name": "mwbloody0"
},
{
"name": "mwbloody1"
},
{
"name": "mwo"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 836 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 825 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 947 B