Inline Transform

This commit is contained in:
Vera Aguilera Puerto
2021-12-03 14:20:34 +01:00
parent 69b270017b
commit a5b57c8e10
283 changed files with 742 additions and 709 deletions

View File

@@ -59,7 +59,7 @@ namespace Content.Server.Actions.Actions
{
// Fall back to a normal interaction with the entity
var player = actor.PlayerSession;
var coordinates = args.Target.Transform.Coordinates;
var coordinates = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(args.Target.Uid).Coordinates;
var target = args.Target.Uid;
EntitySystem.Get<InteractionSystem>().HandleUseInteraction(player, coordinates, target);
return;
@@ -74,7 +74,7 @@ namespace Content.Server.Actions.Actions
var random = IoCManager.Resolve<IRobustRandom>();
var system = EntitySystem.Get<MeleeWeaponSystem>();
var diff = args.Target.Transform.MapPosition.Position - args.Performer.Transform.MapPosition.Position;
var diff = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(args.Target.Uid).MapPosition.Position - IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(args.Performer.Uid).MapPosition.Position;
var angle = Angle.FromWorldVec(diff);
actions.Cooldown(ActionType.Disarm, Cooldowns.SecondsFromNow(_cooldown));
@@ -114,7 +114,7 @@ namespace Content.Server.Actions.Actions
return;
}
SoundSystem.Play(Filter.Pvs(args.Performer), DisarmSuccessSound.GetSound(), args.Performer.Transform.Coordinates, AudioHelpers.WithVariation(0.025f));
SoundSystem.Play(Filter.Pvs(args.Performer), DisarmSuccessSound.GetSound(), IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(args.Performer.Uid).Coordinates, AudioHelpers.WithVariation(0.025f));
}
}
}

View File

@@ -117,7 +117,7 @@ namespace Content.Server.Actions
targetEntityMsg.Target);
return;
}
if (!CheckRangeAndSetFacing(entity.Transform.Coordinates, player)) return;
if (!CheckRangeAndSetFacing(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).Coordinates, player)) return;
attempt.DoTargetEntityAction(player, entity);
break;
@@ -198,7 +198,7 @@ namespace Content.Server.Actions
{
// ensure it's within their clickable range
var targetWorldPos = target.ToMapPos(EntityManager);
var rangeBox = new Box2(player.Transform.WorldPosition, player.Transform.WorldPosition)
var rangeBox = new Box2(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(player.Uid).WorldPosition, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(player.Uid).WorldPosition)
.Enlarged(MaxUpdateRange);
if (!rangeBox.Contains(targetWorldPos))
{

View File

@@ -52,7 +52,7 @@ namespace Content.Server.Actions.Spells
}
// TODO: Look this is shitty and ideally a test would do it
var spawnedProto = IoCManager.Resolve<IEntityManager>().SpawnEntity(ItemProto, caster.Transform.MapPosition);
var spawnedProto = IoCManager.Resolve<IEntityManager>().SpawnEntity(ItemProto, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(caster.Uid).MapPosition);
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(spawnedProto.Uid, out ItemComponent? itemComponent))
{