Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Content.Client/Entry/IgnoredComponents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ public static class IgnoredComponents
"Artifact",
"RandomArtifactSprite",
"EnergySword",
"DeleteAfterTime",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont you need to remove InvisibleWall too

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or i guess that was never an issue because this wasnt actually in yaml

"MeleeSound",
"RangedDamageSound",
"DoorRemote",
Expand Down
12 changes: 0 additions & 12 deletions Content.Server/Abilities/Mime/InvisibleWallComponent.cs

This file was deleted.

34 changes: 11 additions & 23 deletions Content.Server/Abilities/Mime/MimePowersSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,16 @@ public override void Initialize()
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));
}
Expand Down Expand Up @@ -77,14 +66,14 @@ private void OnInvisibleWall(EntityUid uid, MimePowersComponent component, Invis
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?
{
Expand All @@ -93,10 +82,9 @@ private void OnInvisibleWall(EntityUid uid, MimePowersComponent component, Invis
}
}
_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;
}

Expand Down
15 changes: 15 additions & 0 deletions Content.Server/Delete/DeleteAfterTimeComponent.cs
Original file line number Diff line number Diff line change
@@ -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 changes: 18 additions & 0 deletions Content.Server/Delete/DeleteAfterTimeSystem.cs
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
10 changes: 6 additions & 4 deletions Resources/Prototypes/Entities/Structures/Walls/walls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -665,7 +665,7 @@
behaviors:
- !type:DoActsBehavior
acts: [ "Destruction" ]

- type: entity
parent: WallVaultAlien
id: WallVaultRock
Expand All @@ -677,7 +677,7 @@
- type: Icon
sprite: Structures/Walls/vault.rsi
state: rockvault

- type: entity
parent: WallVaultAlien
id: WallVaultSandstone
Expand All @@ -697,6 +697,8 @@
id: WallInvisible
name: Invisible Wall
components:
- type: DeleteAfterTime
despawnTime: 30
- type: Tag
tags:
- Wall
Expand All @@ -711,4 +713,4 @@
- FullTileMask
layer:
- GlassLayer
- type: Airtight
- type: Airtight