From 02cbeee6dc362821bef1998999e5710ed3d275da Mon Sep 17 00:00:00 2001 From: Ed <96445749+TheShuEd@users.noreply.github.com> Date: Fri, 6 Dec 2024 17:16:38 +0300 Subject: [PATCH] Demiplane fixes (#632) * limit demiplace wshwooshing by interaction range, fix global gibbing * Update base.yml * fix #521 --- .../_CP14/Demiplane/CP14DemiplanSystem.Stabilization.cs | 4 ++-- Content.Server/_CP14/Demiplane/CP14DemiplaneSystem.cs | 1 + .../DemiplaneTraveling/CP14DemiplaneTravelingSystem.cs | 9 +++++++-- .../Prototypes/_CP14/Entities/Mobs/Species/base.yml | 8 ++++++-- .../_CP14/Entities/Objects/Specific/Alchemy/tools.yml | 3 +++ .../Prototypes/_CP14/Entities/Objects/Tools/bucket.yml | 1 + 6 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Content.Server/_CP14/Demiplane/CP14DemiplanSystem.Stabilization.cs b/Content.Server/_CP14/Demiplane/CP14DemiplanSystem.Stabilization.cs index a5fc47347f..42b4bb5b7d 100644 --- a/Content.Server/_CP14/Demiplane/CP14DemiplanSystem.Stabilization.cs +++ b/Content.Server/_CP14/Demiplane/CP14DemiplanSystem.Stabilization.cs @@ -67,8 +67,8 @@ public sealed partial class CP14DemiplaneSystem while (query.MoveNext(out var uid, out var stabilizer, out var xform)) { - TryTeleportOutDemiplane(demiplane, uid); - _body.GibBody(uid); + if (TryTeleportOutDemiplane(demiplane, uid)) + _body.GibBody(uid); } QueueDel(demiplane); diff --git a/Content.Server/_CP14/Demiplane/CP14DemiplaneSystem.cs b/Content.Server/_CP14/Demiplane/CP14DemiplaneSystem.cs index 3c5ac99340..5e1a82e58c 100644 --- a/Content.Server/_CP14/Demiplane/CP14DemiplaneSystem.cs +++ b/Content.Server/_CP14/Demiplane/CP14DemiplaneSystem.cs @@ -44,6 +44,7 @@ public sealed partial class CP14DemiplaneSystem : CP14SharedDemiplaneSystem UpdateGeneration(frameTime); UpdateStabilization(frameTime); } + /// /// Teleports the entity inside the demiplane, to one of the random entry points. /// diff --git a/Content.Server/_CP14/DemiplaneTraveling/CP14DemiplaneTravelingSystem.cs b/Content.Server/_CP14/DemiplaneTraveling/CP14DemiplaneTravelingSystem.cs index c0e74c38c3..f0cafc0693 100644 --- a/Content.Server/_CP14/DemiplaneTraveling/CP14DemiplaneTravelingSystem.cs +++ b/Content.Server/_CP14/DemiplaneTraveling/CP14DemiplaneTravelingSystem.cs @@ -1,4 +1,5 @@ using Content.Server._CP14.Demiplane; +using Content.Server.Interaction; using Content.Server.Mind; using Content.Server.Popups; using Content.Shared._CP14.Demiplane; @@ -19,8 +20,8 @@ public sealed partial class CP14DemiplaneTravelingSystem : EntitySystem [Dependency] private readonly EntityLookupSystem _lookup = default!; [Dependency] private readonly MindSystem _mind = default!; [Dependency] private readonly IRobustRandom _random = default!; - [Dependency] private readonly PopupSystem _popup = default!; [Dependency] private readonly SharedAudioSystem _audio = default!; + [Dependency] private readonly InteractionSystem _interaction = default!; public override void Initialize() { @@ -43,6 +44,7 @@ public sealed partial class CP14DemiplaneTravelingSystem : EntitySystem passWay.NextTimeTeleport = _timing.CurTime + passWay.Delay; + //Get all teleporting entities HashSet teleportedEnts = new(); var nearestEnts = _lookup.GetEntitiesInRange(uid, passWay.Radius); foreach (var ent in nearestEnts) @@ -53,6 +55,9 @@ public sealed partial class CP14DemiplaneTravelingSystem : EntitySystem if (!_mind.TryGetMind(ent, out var mindId, out var mind)) continue; + if (!_interaction.InRangeUnobstructed(ent, uid)) + continue; + teleportedEnts.Add(ent); } @@ -61,6 +66,7 @@ public sealed partial class CP14DemiplaneTravelingSystem : EntitySystem teleportedEnts.Remove(_random.Pick(teleportedEnts)); } + //Aaaand teleport it var map = Transform(uid).MapUid; if (TryComp(map, out var demiplan)) { @@ -101,7 +107,6 @@ public sealed partial class CP14DemiplaneTravelingSystem : EntitySystem private void RadiusMapInit(Entity radiusPassWay, ref MapInitEvent args) { radiusPassWay.Comp.NextTimeTeleport = _timing.CurTime + radiusPassWay.Comp.Delay; - //Popup caution here } private void OnOpenRiftInteractDoAfter(Entity passWay, ref CP14DemiplanPasswayUseDoAfter args) diff --git a/Resources/Prototypes/_CP14/Entities/Mobs/Species/base.yml b/Resources/Prototypes/_CP14/Entities/Mobs/Species/base.yml index f185fdb1bf..933db1d4ba 100644 --- a/Resources/Prototypes/_CP14/Entities/Mobs/Species/base.yml +++ b/Resources/Prototypes/_CP14/Entities/Mobs/Species/base.yml @@ -136,15 +136,19 @@ - TemporaryBlindness - Pacified - StaminaModifier - - type: ComplexInteraction + - Flashed + - RadiationProtection + - Drowsiness + - Adrenaline - type: Body prototype: CP14Human requiredLegs: 2 - type: Identity - type: Hands + - type: ComplexInteraction - type: Inventory - type: InventorySlots - - type: FloatingVisuals + #- type: FloatingVisuals - type: Climbing - type: Cuffable - type: Ensnareable diff --git a/Resources/Prototypes/_CP14/Entities/Objects/Specific/Alchemy/tools.yml b/Resources/Prototypes/_CP14/Entities/Objects/Specific/Alchemy/tools.yml index 7bc46e5142..3e3cd857b3 100644 --- a/Resources/Prototypes/_CP14/Entities/Objects/Specific/Alchemy/tools.yml +++ b/Resources/Prototypes/_CP14/Entities/Objects/Specific/Alchemy/tools.yml @@ -46,6 +46,7 @@ solutionName: vat injectOnly: false ignoreMobs: true + ignoreClosed: false minTransferAmount: 10 maxTransferAmount: 100 transferAmount: 15 @@ -138,6 +139,7 @@ solutionName: mortar injectOnly: false ignoreMobs: true + ignoreClosed: false minTransferAmount: 1 maxTransferAmount: 10 transferAmount: 5 @@ -209,6 +211,7 @@ solutionName: vial injectOnly: false ignoreMobs: true + ignoreClosed: false minTransferAmount: 0.25 maxTransferAmount: 1 transferAmount: 0.25 diff --git a/Resources/Prototypes/_CP14/Entities/Objects/Tools/bucket.yml b/Resources/Prototypes/_CP14/Entities/Objects/Tools/bucket.yml index c6f412d4e1..f0ed26a970 100644 --- a/Resources/Prototypes/_CP14/Entities/Objects/Tools/bucket.yml +++ b/Resources/Prototypes/_CP14/Entities/Objects/Tools/bucket.yml @@ -25,6 +25,7 @@ solutionName: bucket injectOnly: false ignoreMobs: true + ignoreClosed: false minTransferAmount: 1 maxTransferAmount: 50 transferAmount: 50