Pointing arrow changes (#11097)

This commit is contained in:
metalgearsloth
2022-09-17 00:37:15 +10:00
committed by GitHub
parent 9aa8a674bf
commit 14d48f4306
10 changed files with 115 additions and 151 deletions

View File

@@ -24,7 +24,7 @@ using Robust.Shared.Timing;
namespace Content.Server.Pointing.EntitySystems
{
[UsedImplicitly]
internal sealed class PointingSystem : EntitySystem
internal sealed class PointingSystem : SharedPointingSystem
{
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
@@ -128,7 +128,12 @@ namespace Content.Server.Pointing.EntitySystems
_rotateToFaceSystem.TryFaceCoordinates(player, mapCoords.Position);
var arrow = EntityManager.SpawnEntity("pointingarrow", mapCoords);
var arrow = EntityManager.SpawnEntity("PointingArrow", mapCoords);
if (TryComp<PointingArrowComponent>(arrow, out var pointing))
{
pointing.EndTime = _gameTiming.CurTime + TimeSpan.FromSeconds(4);
}
if (EntityQuery<PointingArrowAngeringComponent>().FirstOrDefault() != null)
{
@@ -231,10 +236,28 @@ namespace Content.Server.Pointing.EntitySystems
public override void Update(float frameTime)
{
foreach (var component in EntityManager.EntityQuery<PointingArrowComponent>(true))
var currentTime = _gameTiming.CurTime;
foreach (var component in EntityQuery<PointingArrowComponent>(true))
{
component.Update(frameTime);
Update(component, currentTime);
}
}
private void Update(PointingArrowComponent component, TimeSpan currentTime)
{
// TODO: That pause PR
if (component.EndTime > currentTime)
return;
if (component.Rogue)
{
RemComp<PointingArrowComponent>(component.Owner);
EnsureComp<RoguePointingArrowComponent>(component.Owner);
return;
}
Del(component.Owner);
}
}
}

View File

@@ -61,7 +61,7 @@ namespace Content.Server.Pointing.EntitySystems
if (component.Chasing is not {Valid: true} chasing || Deleted(chasing))
{
EntityManager.QueueDeleteEntity(uid);
return;
continue;
}
component.TurningDelay -= frameTime;
@@ -73,10 +73,10 @@ namespace Content.Server.Pointing.EntitySystems
var adjusted = angle.Degrees + 90;
var newAngle = Angle.FromDegrees(adjusted);
transform.LocalRotation = newAngle;
transform.WorldRotation = newAngle;
UpdateAppearance(uid, component, transform);
return;
continue;
}
transform.WorldRotation += Angle.FromDegrees(20);
@@ -91,8 +91,10 @@ namespace Content.Server.Pointing.EntitySystems
if (component.ChasingTime > 0)
{
return;
continue;
}
_explosion.QueueExplosion(uid, ExplosionSystem.DefaultExplosionPrototypeId, 50, 3, 10);
EntityManager.QueueDeleteEntity(uid);
}