Mime cleanup (#8433)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user