Adds TimedDespawn component to Invisible Walls, nukes DeleteAfterTime (#8528)

* Adds TimedDelete component to Invisible Walls

* Removes Delete After Time
This commit is contained in:
keronshb
2022-05-30 01:06:50 -04:00
committed by GitHub
parent cf7a14788b
commit 355e044119
3 changed files with 2 additions and 35 deletions

View File

@@ -1,15 +0,0 @@
namespace Content.Server.Delete
{
/// <summary>
/// Deletes the entity after the specified period of time.
/// </summary>
[RegisterComponent]
public sealed class DeleteAfterTimeComponent : Component
{
[ViewVariables(VVAccess.ReadWrite), DataField("accumulator")]
public float Accumulator = 0f;
[ViewVariables(VVAccess.ReadWrite), DataField("despawnTime")]
public TimeSpan DespawnTime = TimeSpan.FromSeconds(30);
}
}

View File

@@ -1,18 +0,0 @@
namespace Content.Server.Delete;
public sealed class DeleteAfterTimeSystem : EntitySystem
{
public override void Update(float frameTime)
{
base.Update(frameTime);
foreach (var comp in EntityQuery<DeleteAfterTimeComponent>())
{
comp.Accumulator += frameTime;
if (comp.Accumulator < comp.DespawnTime.TotalSeconds)
continue;
QueueDel(comp.Owner);
}
}
}

View File

@@ -697,8 +697,8 @@
id: WallInvisible
name: Invisible Wall
components:
- type: DeleteAfterTime
despawnTime: 30
- type: TimedDespawn
lifetime: 30
- type: Tag
tags:
- Wall