From: Verm <32827189+Vermidia@users.noreply.github.com> Date: Sat, 15 Jun 2024 03:00:00 +0000 (-0500) Subject: Donk co. microwave + microwave tweaks (#28951) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=41a081d5efa0050b44f3200cdaecde16eab2bc78;p=space-station-14.git 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 --- diff --git a/Content.Server/Access/Systems/IdCardSystem.cs b/Content.Server/Access/Systems/IdCardSystem.cs index 47388d1a6f..b49bc55d1b 100644 --- a/Content.Server/Access/Systems/IdCardSystem.cs +++ b/Content.Server/Access/Systems/IdCardSystem.cs @@ -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(args.Microwave, out var micro) || micro.Broken) + return; if (TryComp(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}"); + } } } diff --git a/Content.Server/Kitchen/Components/MicrowaveComponent.cs b/Content.Server/Kitchen/Components/MicrowaveComponent.cs index 815ba8f521..1d26f68cae 100644 --- a/Content.Server/Kitchen/Components/MicrowaveComponent.cs +++ b/Content.Server/Kitchen/Components/MicrowaveComponent.cs @@ -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; + + /// + /// If this microwave can give ids accesses without exploding + /// + [DataField, ViewVariables(VVAccess.ReadWrite)] + public bool CanMicrowaveIdsSafely = true; } public sealed class BeingMicrowavedEvent : HandledEntityEventArgs diff --git a/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs b/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs index c69ed49d50..eefa539149 100644 --- a/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs +++ b/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs @@ -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] private const string MalfunctionSpark = "Spark"; @@ -408,6 +412,23 @@ namespace Content.Server.Kitchen.EntitySystems return component.Storage.ContainedEntities.Any(); } + /// + /// Explodes the microwave internally, turning it into a broken state, destroying its board, and spitting out its machine parts + /// + /// + public void Explode(Entity ent) + { + ent.Comp.Broken = true; // Make broken so we stop processing stuff + _explosion.TriggerExplosive(ent); + if (TryComp(ent, out var machine)) + { + _container.CleanContainer(machine.BoardContainer); + _container.EmptyContainer(machine.PartContainer); + } + + _adminLogger.Add(LogType.Action, LogImpact.Medium, + $"{ToPrettyString(ent)} exploded from unsafe cooking!"); + } /// /// Handles the attempted cooking of unsafe objects /// @@ -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); diff --git a/Resources/Maps/Nonstations/nukieplanet.yml b/Resources/Maps/Nonstations/nukieplanet.yml index 4d1172198c..35e00358ec 100644 --- a/Resources/Maps/Nonstations/nukieplanet.yml +++ b/Resources/Maps/Nonstations/nukieplanet.yml @@ -10994,7 +10994,7 @@ entities: - type: Transform pos: 18.918644,6.663283 parent: 104 -- proto: KitchenMicrowave +- proto: SyndicateMicrowave entities: - uid: 10 components: diff --git a/Resources/Maps/Shuttles/infiltrator.yml b/Resources/Maps/Shuttles/infiltrator.yml index 55955bfeea..fb2045d701 100644 --- a/Resources/Maps/Shuttles/infiltrator.yml +++ b/Resources/Maps/Shuttles/infiltrator.yml @@ -3607,7 +3607,7 @@ entities: - type: Transform pos: 3.5,-3.5 parent: 1 -- proto: KitchenMicrowave +- proto: SyndicateMicrowave entities: - uid: 497 components: diff --git a/Resources/Prototypes/Entities/Structures/Machines/microwave.yml b/Resources/Prototypes/Entities/Structures/Machines/microwave.yml index 994269f71b..3b6fbf7f5f 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/microwave.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/microwave.yml @@ -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 + + diff --git a/Resources/Textures/Structures/Machines/microwave_syndie.rsi/meta.json b/Resources/Textures/Structures/Machines/microwave_syndie.rsi/meta.json new file mode 100644 index 0000000000..932ea0c482 --- /dev/null +++ b/Resources/Textures/Structures/Machines/microwave_syndie.rsi/meta.json @@ -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" + } + ] + } \ No newline at end of file diff --git a/Resources/Textures/Structures/Machines/microwave_syndie.rsi/mw.png b/Resources/Textures/Structures/Machines/microwave_syndie.rsi/mw.png new file mode 100644 index 0000000000..cdad6aaf28 Binary files /dev/null and b/Resources/Textures/Structures/Machines/microwave_syndie.rsi/mw.png differ diff --git a/Resources/Textures/Structures/Machines/microwave_syndie.rsi/mw0.png b/Resources/Textures/Structures/Machines/microwave_syndie.rsi/mw0.png new file mode 100644 index 0000000000..532e4e63ac Binary files /dev/null and b/Resources/Textures/Structures/Machines/microwave_syndie.rsi/mw0.png differ diff --git a/Resources/Textures/Structures/Machines/microwave_syndie.rsi/mw_running_unlit.png b/Resources/Textures/Structures/Machines/microwave_syndie.rsi/mw_running_unlit.png new file mode 100644 index 0000000000..b751f308a6 Binary files /dev/null and b/Resources/Textures/Structures/Machines/microwave_syndie.rsi/mw_running_unlit.png differ diff --git a/Resources/Textures/Structures/Machines/microwave_syndie.rsi/mw_unlit.png b/Resources/Textures/Structures/Machines/microwave_syndie.rsi/mw_unlit.png new file mode 100644 index 0000000000..11e691d031 Binary files /dev/null and b/Resources/Textures/Structures/Machines/microwave_syndie.rsi/mw_unlit.png differ diff --git a/Resources/Textures/Structures/Machines/microwave_syndie.rsi/mwb.png b/Resources/Textures/Structures/Machines/microwave_syndie.rsi/mwb.png new file mode 100644 index 0000000000..8d6462c92e Binary files /dev/null and b/Resources/Textures/Structures/Machines/microwave_syndie.rsi/mwb.png differ diff --git a/Resources/Textures/Structures/Machines/microwave_syndie.rsi/mwbloody0.png b/Resources/Textures/Structures/Machines/microwave_syndie.rsi/mwbloody0.png new file mode 100644 index 0000000000..a51302a253 Binary files /dev/null and b/Resources/Textures/Structures/Machines/microwave_syndie.rsi/mwbloody0.png differ diff --git a/Resources/Textures/Structures/Machines/microwave_syndie.rsi/mwbloody1.png b/Resources/Textures/Structures/Machines/microwave_syndie.rsi/mwbloody1.png new file mode 100644 index 0000000000..8cfdf34281 Binary files /dev/null and b/Resources/Textures/Structures/Machines/microwave_syndie.rsi/mwbloody1.png differ diff --git a/Resources/Textures/Structures/Machines/microwave_syndie.rsi/mwo.png b/Resources/Textures/Structures/Machines/microwave_syndie.rsi/mwo.png new file mode 100644 index 0000000000..7545ff0035 Binary files /dev/null and b/Resources/Textures/Structures/Machines/microwave_syndie.rsi/mwo.png differ