Non-gibbing demiplanes (#1607)

* safe demiplanes

* damage
This commit is contained in:
Red
2025-08-01 14:09:05 +03:00
committed by GitHub
parent e31f3a7d77
commit 9384623604
7 changed files with 40 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
using Content.Server.Body.Systems;
using Content.Shared._CP14.Demiplane.Components;
using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
using Content.Shared.Mobs.Systems;
using Content.Shared.SSDIndicator;
@@ -11,7 +12,7 @@ public sealed partial class CP14DemiplaneSystem
private TimeSpan _nextCheckTime = TimeSpan.Zero;
[Dependency] private readonly MobStateSystem _mobState = default!;
[Dependency] private readonly BodySystem _body = default!;
[Dependency] private readonly DamageableSystem _damageable = default!;
private void InitStabilization()
{
@@ -79,15 +80,18 @@ public sealed partial class CP14DemiplaneSystem
public void DeleteDemiplane(Entity<CP14DemiplaneComponent> demiplane, bool safe = false)
{
var query = EntityQueryEnumerator<CP14DemiplaneStabilizerComponent, TransformComponent>();
var query = EntityQueryEnumerator<CP14DemiplaneForceExtractComponent, TransformComponent>();
while (query.MoveNext(out var uid, out var stabilizer, out var xform))
while (query.MoveNext(out var uid, out var extract, out var xform))
{
if (TryTeleportOutDemiplane(demiplane, uid))
{
if (!safe)
_body.GibBody(uid);
}
if (!extract.Enabled)
continue;
if (!TryTeleportOutDemiplane(demiplane, uid))
continue;
if (!safe)
_damageable.TryChangeDamage(uid, extract.ExtractDamage);
}
QueueDel(demiplane);

View File

@@ -49,7 +49,7 @@ public sealed partial class CP14RoundEndSystem : EntitySystem
if (_roundEndMoment > _timing.CurTime)
return;
_demiplane.DeleteAllDemiplanes(safe: false);
_demiplane.DeleteAllDemiplanes();
_chatSystem.DispatchGlobalAnnouncement(Loc.GetString("cp14-round-end"),
announcementSound: new SoundPathSpecifier("/Audio/_CP14/Announce/event_boom.ogg"));
_roundEnd.EndRound();

View File

@@ -0,0 +1,22 @@
using Content.Shared.Damage;
namespace Content.Shared._CP14.Demiplane.Components;
/// <summary>
/// When closing the demiplane, all entities with this component will be thrown out instead of being deleted.
/// </summary>
[RegisterComponent, Access(typeof(CP14SharedDemiplaneSystem))]
public sealed partial class CP14DemiplaneForceExtractComponent : Component
{
[DataField]
public bool Enabled = true;
[DataField]
public DamageSpecifier ExtractDamage = new()
{
DamageDict = new()
{
{ "Blunt", 111 },
}
};
}

View File

@@ -67,8 +67,7 @@
types:
CP14ManaDepletion: 1
- type: CP14ZLevelMover
- type: CP14DemiplaneStabilizer # teleports gods outside when the demiplane closes
enabled: false
- type: CP14DemiplaneForceExtract
- type: UserInterface
interfaces:
enum.CP14ReligionEntityUiKey.Key:

View File

@@ -213,6 +213,7 @@
- type: Tag
tags:
- FootstepSound
- type: CP14DemiplaneForceExtract
- type: CP14DemiplaneStabilizer
requireAlive: true
- type: CP14IgnitionModifier

View File

@@ -112,6 +112,8 @@
- type: Inventory
templateId: CP14Human
- type: TransferMindOnGib
- type: CP14DemiplaneForceExtract
enabled: false
- type: CP14DemiplaneStabilizer
enabled: false
- type: GhostTakeoverAvailable