Fix for items dropped being rotated to world north (#26662)

* Fix rotation of dropped items

* combined world position rotation function for dumpable

* scuffed implementation?

* less scuffed?

* even less scuffed... I guess

* capital D

---------

Co-authored-by: Plykiya <plykiya@protonmail.com>
This commit is contained in:
Plykiya
2024-04-02 22:31:57 -07:00
committed by GitHub
parent e6a090419c
commit 5aadb17be7
2 changed files with 5 additions and 3 deletions

View File

@@ -134,8 +134,10 @@ public abstract partial class SharedHandsSystem
return true; return true;
} }
var (itemPos, itemRot) = TransformSystem.GetWorldPositionRotation(entity);
var origin = new MapCoordinates(itemPos, itemXform.MapID);
var target = targetDropLocation.Value.ToMap(EntityManager, TransformSystem); var target = targetDropLocation.Value.ToMap(EntityManager, TransformSystem);
TransformSystem.SetWorldPosition(itemXform, GetFinalDropCoordinates(uid, userXform.MapPosition, target)); TransformSystem.SetWorldPositionRotation(entity, GetFinalDropCoordinates(uid, origin, target), itemRot);
return true; return true;
} }

View File

@@ -159,11 +159,11 @@ public sealed class DumpableSystem : EntitySystem
{ {
dumped = true; dumped = true;
var targetPos = _transformSystem.GetWorldPosition(args.Args.Target.Value); var (targetPos, targetRot) = _transformSystem.GetWorldPositionRotation(args.Args.Target.Value);
foreach (var entity in dumpQueue) foreach (var entity in dumpQueue)
{ {
_transformSystem.SetWorldPosition(entity, targetPos + _random.NextVector2Box() / 4); _transformSystem.SetWorldPositionRotation(entity, targetPos + _random.NextVector2Box() / 4, targetRot);
} }
} }
else else