]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Donk co. microwave + microwave tweaks (#28951)
authorVerm <32827189+Vermidia@users.noreply.github.com>
Sat, 15 Jun 2024 03:00:00 +0000 (22:00 -0500)
committerGitHub <noreply@github.com>
Sat, 15 Jun 2024 03:00:00 +0000 (23:00 -0400)
* 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

15 files changed:
Content.Server/Access/Systems/IdCardSystem.cs
Content.Server/Kitchen/Components/MicrowaveComponent.cs
Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs
Resources/Maps/Nonstations/nukieplanet.yml
Resources/Maps/Shuttles/infiltrator.yml
Resources/Prototypes/Entities/Structures/Machines/microwave.yml
Resources/Textures/Structures/Machines/microwave_syndie.rsi/meta.json [new file with mode: 0644]
Resources/Textures/Structures/Machines/microwave_syndie.rsi/mw.png [new file with mode: 0644]
Resources/Textures/Structures/Machines/microwave_syndie.rsi/mw0.png [new file with mode: 0644]
Resources/Textures/Structures/Machines/microwave_syndie.rsi/mw_running_unlit.png [new file with mode: 0644]
Resources/Textures/Structures/Machines/microwave_syndie.rsi/mw_unlit.png [new file with mode: 0644]
Resources/Textures/Structures/Machines/microwave_syndie.rsi/mwb.png [new file with mode: 0644]
Resources/Textures/Structures/Machines/microwave_syndie.rsi/mwbloody0.png [new file with mode: 0644]
Resources/Textures/Structures/Machines/microwave_syndie.rsi/mwbloody1.png [new file with mode: 0644]
Resources/Textures/Structures/Machines/microwave_syndie.rsi/mwo.png [new file with mode: 0644]

index 47388d1a6fd2aafde8883664ccf2e13d7a7d185e..b49bc55d1be67af1843a0ec8b9d7e5801244ac1f 100644 (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}");
+
         }
     }
 }
index 815ba8f521322cc14b659a3fe0cc042b05d7a887..1d26f68cae89be05ff9c93c04228d44240a888bb 100644 (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
index c69ed49d50a67c8868ab56979adf505c72d06818..eefa539149b021b25c317c2c2e68f05176e37d60 100644 (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);
index 4d1172198cabae45e169cee1b8fef99327d0451e..35e00358ec5668996ecd9161e3b146cef536dbf1 100644 (file)
@@ -10994,7 +10994,7 @@ entities:
     - type: Transform
       pos: 18.918644,6.663283
       parent: 104
-- proto: KitchenMicrowave
+- proto: SyndicateMicrowave
   entities:
   - uid: 10
     components:
index 55955bfeeac86b6b435edfe0294a99a18ae6450b..fb2045d7018549b2a15f4f7b6f360c263e54761f 100644 (file)
@@ -3607,7 +3607,7 @@ entities:
     - type: Transform
       pos: 3.5,-3.5
       parent: 1
-- proto: KitchenMicrowave
+- proto: SyndicateMicrowave
   entities:
   - uid: 497
     components:
index 994269f71b4d84bac200dce6b7b8c7a9957d8926..3b6fbf7f5f774719a3cf48ed34ba328ea1667e4d 100644 (file)
   - 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 (file)
index 0000000..932ea0c
--- /dev/null
@@ -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 (file)
index 0000000..cdad6aa
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 (file)
index 0000000..532e4e6
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 (file)
index 0000000..b751f30
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 (file)
index 0000000..11e691d
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 (file)
index 0000000..8d6462c
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 (file)
index 0000000..a51302a
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 (file)
index 0000000..8cfdf34
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 (file)
index 0000000..7545ff0
Binary files /dev/null and b/Resources/Textures/Structures/Machines/microwave_syndie.rsi/mwo.png differ