Fix pickup animation incorrect coordinate usage.
Animation finalPosition was world position, while initialPosition was local position.
This commit is contained in:
@@ -11,7 +11,7 @@ namespace Content.Client.Animations
|
|||||||
{
|
{
|
||||||
public static class ReusableAnimations
|
public static class ReusableAnimations
|
||||||
{
|
{
|
||||||
public static void AnimateEntityPickup(IEntity entity, EntityCoordinates initialPosition, Vector2 finalPosition)
|
public static void AnimateEntityPickup(IEntity entity, MapCoordinates initialPosition, Vector2 finalPosition)
|
||||||
{
|
{
|
||||||
var animatableClone = entity.EntityManager.SpawnEntity("clientsideclone", initialPosition);
|
var animatableClone = entity.EntityManager.SpawnEntity("clientsideclone", initialPosition);
|
||||||
animatableClone.Name = entity.Name;
|
animatableClone.Name = entity.Name;
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ namespace Content.Client.Storage
|
|||||||
for (var i = 0; msg.StoredEntities.Count > i; i++)
|
for (var i = 0; msg.StoredEntities.Count > i; i++)
|
||||||
{
|
{
|
||||||
var entityId = msg.StoredEntities[i];
|
var entityId = msg.StoredEntities[i];
|
||||||
var initialPosition = msg.EntityPositions[i];
|
var initialPosition = msg.EntityPositions[i].ToMap(Owner.EntityManager);
|
||||||
|
|
||||||
if (Owner.EntityManager.TryGetEntity(entityId, out var entity))
|
if (Owner.EntityManager.TryGetEntity(entityId, out var entity))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -86,15 +86,15 @@ namespace Content.Server.Hands.Components
|
|||||||
|
|
||||||
protected override void HandlePickupAnimation(IEntity entity)
|
protected override void HandlePickupAnimation(IEntity entity)
|
||||||
{
|
{
|
||||||
var pickupDirection = Owner.Transform.WorldPosition;
|
var pickupDirection = Owner.Transform.MapPosition.Position;
|
||||||
|
|
||||||
var outermostEntity = entity;
|
var outermostEntity = entity;
|
||||||
while (outermostEntity.TryGetContainer(out var container)) //TODO: Use WorldPosition instead of this loop
|
while (outermostEntity.TryGetContainer(out var container)) //TODO: Use WorldPosition instead of this loop
|
||||||
outermostEntity = container.Owner;
|
outermostEntity = container.Owner;
|
||||||
|
|
||||||
var initialPosition = outermostEntity.Transform.Coordinates;
|
var initialPosition = outermostEntity.Transform.MapPosition;
|
||||||
|
|
||||||
if (pickupDirection == initialPosition.ToMapPos(Owner.EntityManager))
|
if (pickupDirection == initialPosition.Position)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Owner.EntityManager.EntityNetManager!.SendSystemNetworkMessage(
|
Owner.EntityManager.EntityNetManager!.SendSystemNetworkMessage(
|
||||||
|
|||||||
@@ -923,10 +923,10 @@ namespace Content.Shared.Hands.Components
|
|||||||
public class PickupAnimationMessage : EntityEventArgs
|
public class PickupAnimationMessage : EntityEventArgs
|
||||||
{
|
{
|
||||||
public EntityUid EntityUid { get; }
|
public EntityUid EntityUid { get; }
|
||||||
public EntityCoordinates InitialPosition { get; }
|
public MapCoordinates InitialPosition { get; }
|
||||||
public Vector2 PickupDirection { get; }
|
public Vector2 PickupDirection { get; }
|
||||||
|
|
||||||
public PickupAnimationMessage(EntityUid entityUid, Vector2 pickupDirection, EntityCoordinates initialPosition)
|
public PickupAnimationMessage(EntityUid entityUid, Vector2 pickupDirection, MapCoordinates initialPosition)
|
||||||
{
|
{
|
||||||
EntityUid = entityUid;
|
EntityUid = entityUid;
|
||||||
PickupDirection = pickupDirection;
|
PickupDirection = pickupDirection;
|
||||||
|
|||||||
4
Resources/Changelog/Parts/pickup.yml
Normal file
4
Resources/Changelog/Parts/pickup.yml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
author: Your_Name_Here
|
||||||
|
changes:
|
||||||
|
- type: Fix # One of the following: Add, Remove, Tweak, Fix
|
||||||
|
message: Fixes pickup animation not showing under certain conditions.
|
||||||
Reference in New Issue
Block a user