Mime cleanup (#8433)
This commit is contained in:
@@ -349,6 +349,7 @@ namespace Content.Client.Entry
|
||||
"Artifact",
|
||||
"RandomArtifactSprite",
|
||||
"EnergySword",
|
||||
"DeleteAfterTime",
|
||||
"MeleeSound",
|
||||
"RangedDamageSound",
|
||||
"DoorRemote",
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
namespace Content.Server.Abilities.Mime
|
||||
{
|
||||
// Tracks invisible wall despawning
|
||||
[RegisterComponent]
|
||||
public sealed class InvisibleWallComponent : Component
|
||||
{
|
||||
[DataField("accumulator")]
|
||||
public float Accumulator = 0f;
|
||||
[DataField("despawnTime")]
|
||||
public TimeSpan DespawnTime = TimeSpan.FromSeconds(30);
|
||||
}
|
||||
}
|
||||
@@ -28,27 +28,16 @@ namespace Content.Server.Abilities.Mime
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
base.Update(frameTime);
|
||||
/// Queue to despawn invis walls
|
||||
foreach (var invisWall in EntityQuery<InvisibleWallComponent>())
|
||||
{
|
||||
invisWall.Accumulator += frameTime;
|
||||
if (invisWall.Accumulator < invisWall.DespawnTime.TotalSeconds)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
EntityManager.QueueDeleteEntity(invisWall.Owner);
|
||||
}
|
||||
/// Queue to track whether mimes can retake vows yet
|
||||
// Queue to track whether mimes can retake vows yet
|
||||
foreach (var mime in EntityQuery<MimePowersComponent>())
|
||||
{
|
||||
if (!mime.VowBroken || mime.ReadyToRepent)
|
||||
return;
|
||||
continue;
|
||||
|
||||
mime.Accumulator += frameTime;
|
||||
if (mime.Accumulator < mime.VowCooldown.TotalSeconds)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
mime.ReadyToRepent = true;
|
||||
_popupSystem.PopupEntity(Loc.GetString("mime-ready-to-repent"), mime.Owner, Filter.Entities(mime.Owner));
|
||||
}
|
||||
@@ -77,14 +66,14 @@ namespace Content.Server.Abilities.Mime
|
||||
return;
|
||||
|
||||
var xform = Transform(uid);
|
||||
/// Get the tile in front of the mime
|
||||
// Get the tile in front of the mime
|
||||
var offsetValue = xform.LocalRotation.ToWorldVec().Normalized;
|
||||
var coords = xform.Coordinates.Offset(offsetValue).SnapToGrid();
|
||||
/// Check there are no walls or mobs there
|
||||
var coords = xform.Coordinates.Offset(offsetValue).SnapToGrid(EntityManager);
|
||||
// Check there are no walls or mobs there
|
||||
foreach (var entity in coords.GetEntitiesInTile())
|
||||
{
|
||||
IPhysBody? physics = null; /// We use this to check if it's impassable
|
||||
if ((HasComp<MobStateComponent>(entity) && entity != uid) || /// Is it a mob?
|
||||
IPhysBody? physics = null; // We use this to check if it's impassable
|
||||
if ((HasComp<MobStateComponent>(entity) && entity != uid) || // Is it a mob?
|
||||
((Resolve(entity, ref physics, false) && (physics.CollisionLayer & (int) CollisionGroup.Impassable) != 0) // Is it impassable?
|
||||
&& !(TryComp<DoorComponent>(entity, out var door) && door.State != DoorState.Closed))) // Is it a door that's open and so not actually impassable?
|
||||
{
|
||||
@@ -93,10 +82,9 @@ namespace Content.Server.Abilities.Mime
|
||||
}
|
||||
}
|
||||
_popupSystem.PopupEntity(Loc.GetString("mime-invisible-wall-popup", ("mime", uid)), uid, Filter.Pvs(uid));
|
||||
/// Make sure we set the invisible wall to despawn properly
|
||||
var wall = EntityManager.SpawnEntity(component.WallPrototype, coords);
|
||||
EnsureComp<InvisibleWallComponent>(wall);
|
||||
/// Handle args so cooldown works
|
||||
// Make sure we set the invisible wall to despawn properly
|
||||
Spawn(component.WallPrototype, coords);
|
||||
// Handle args so cooldown works
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
|
||||
15
Content.Server/Delete/DeleteAfterTimeComponent.cs
Normal file
15
Content.Server/Delete/DeleteAfterTimeComponent.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
18
Content.Server/Delete/DeleteAfterTimeSystem.cs
Normal file
18
Content.Server/Delete/DeleteAfterTimeSystem.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -649,7 +649,7 @@
|
||||
parent: WallBase
|
||||
id: WallVaultAlien
|
||||
name: alien vault wall
|
||||
description: A mysterious ornate looking wall. There may be ancient dangers inside.
|
||||
description: A mysterious ornate looking wall. There may be ancient dangers inside.
|
||||
components:
|
||||
- type: Sprite
|
||||
sprite: Structures/Walls/vault.rsi
|
||||
@@ -665,7 +665,7 @@
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: [ "Destruction" ]
|
||||
|
||||
|
||||
- type: entity
|
||||
parent: WallVaultAlien
|
||||
id: WallVaultRock
|
||||
@@ -677,7 +677,7 @@
|
||||
- type: Icon
|
||||
sprite: Structures/Walls/vault.rsi
|
||||
state: rockvault
|
||||
|
||||
|
||||
- type: entity
|
||||
parent: WallVaultAlien
|
||||
id: WallVaultSandstone
|
||||
@@ -697,6 +697,8 @@
|
||||
id: WallInvisible
|
||||
name: Invisible Wall
|
||||
components:
|
||||
- type: DeleteAfterTime
|
||||
despawnTime: 30
|
||||
- type: Tag
|
||||
tags:
|
||||
- Wall
|
||||
@@ -711,4 +713,4 @@
|
||||
- FullTileMask
|
||||
layer:
|
||||
- GlassLayer
|
||||
- type: Airtight
|
||||
- type: Airtight
|
||||
|
||||
Reference in New Issue
Block a user