mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-14 19:29:36 +01:00
Fix MapCoordinate spawns using grid-relative rotation
This was an undocumented breaking change introduced by https://github.com/space-wizards/RobustToolbox/pull/5915. The behavior does not make much sense: you're specifying coordinates relative to the map, so the rotation should be relative to the map too.
This commit is contained in:
@@ -35,7 +35,7 @@ END TEMPLATE-->
|
||||
|
||||
### Breaking changes
|
||||
|
||||
*None yet*
|
||||
* Reversed an undocumented breaking change from `v267.3.0`: entity spawning with a `MapCoordinates` now takes the rotation as relative to the map again instead of relative to the grid the entity was attached to.
|
||||
|
||||
### New features
|
||||
|
||||
|
||||
@@ -366,7 +366,8 @@ namespace Robust.Shared.GameObjects
|
||||
&& meta.EntityLifeStage < EntityLifeStage.Terminating)
|
||||
{
|
||||
coords = new EntityCoordinates(gridUid, _mapSystem.WorldToLocal(gridUid, grid, coordinates.Position));
|
||||
_xforms.SetCoordinates(newEntity, transform, coords, rotation, unanchor: false);
|
||||
var relativeRotation = rotation - _xforms.GetWorldRotation(gridUid);
|
||||
_xforms.SetCoordinates(newEntity, transform, coords, relativeRotation, unanchor: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace Robust.Shared.GameObjects
|
||||
/// <param name="prototypeName">Name of the <see cref="EntityPrototype"/> to spawn.</param>
|
||||
/// <param name="coordinates">Coordinates to place the newly spawned entity.</param>
|
||||
/// <param name="overrides">Overrides to add or remove components that differ from the prototype.</param>
|
||||
/// <param name="rotation">Local rotation to set the newly spawned entity to.</param>
|
||||
/// <param name="rotation">World rotation to set the newly spawned entity to.</param>
|
||||
/// <returns>A new uninitialized entity.</returns>
|
||||
/// <remarks>If there is a grid at the <paramref name="coordinates"/>, the entity will be parented to the grid.
|
||||
/// Otherwise, it will be parented to the map.</remarks>
|
||||
|
||||
Reference in New Issue
Block a user