Pointing coordinate fixes.

This commit is contained in:
Vera Aguilera Puerto
2021-08-06 18:27:37 +02:00
parent 91efe64a45
commit 6bd6b9789a
4 changed files with 20 additions and 5 deletions

View File

@@ -89,6 +89,7 @@ namespace Content.Server.Pointing.EntitySystems
public bool TryPoint(ICommonSession? session, EntityCoordinates coords, EntityUid uid)
{
var mapCoords = coords.ToMap(EntityManager);
var player = (session as IPlayerSession)?.ContentData()?.Mind?.CurrentEntity;
if (player == null)
{
@@ -115,14 +116,14 @@ namespace Content.Server.Pointing.EntitySystems
if (_actionBlockerSystem.CanChangeDirection(player))
{
var diff = coords.ToMapPos(EntityManager) - player.Transform.MapPosition.Position;
var diff = mapCoords.Position - player.Transform.MapPosition.Position;
if (diff.LengthSquared > 0.01f)
{
player.Transform.LocalRotation = new Angle(diff);
}
}
var arrow = EntityManager.SpawnEntity("pointingarrow", coords);
var arrow = EntityManager.SpawnEntity("pointingarrow", mapCoords);
var layer = (int) VisibilityFlags.Normal;
if (player.TryGetComponent(out VisibilityComponent? playerVisibility))
@@ -160,8 +161,14 @@ namespace Content.Server.Pointing.EntitySystems
}
else
{
var tileRef = _mapManager.GetGrid(coords.GetGridId(EntityManager)).GetTileRef(coords);
var tileDef = _tileDefinitionManager[tileRef.Tile.TypeId];
TileRef? tileRef = null;
if (_mapManager.TryFindGridAt(mapCoords, out var grid))
{
tileRef = grid.GetTileRef(grid.WorldToTile(mapCoords.Position));
}
var tileDef = _tileDefinitionManager[tileRef?.Tile.TypeId ?? 0];
selfMessage = Loc.GetString("pointing-system-point-at-tile", ("tileName", tileDef.DisplayName));

View File

@@ -1690,7 +1690,7 @@ Entries:
situations.', type: Fix}
id: 301
time: '2021-08-06T15:53:48.856573+00:00'
- author: Your_Name_Here
- author: Zumorica
changes:
- {message: Fixes pickup animation not showing under certain conditions., type: Fix}
id: 302

View File

@@ -0,0 +1,4 @@
author: Zumorica
changes:
- type: Fix # One of the following: Add, Remove, Tweak, Fix
message: Fix pointing at an item in your inventory resulting in the pointing arrow playing a weird animation.

View File

@@ -0,0 +1,4 @@
author: Zumorica
changes:
- type: Fix # One of the following: Add, Remove, Tweak, Fix
message: Fix bug where you couldn't point at space.