Ranged weapon firing does not depend on DefaultGrid anymore.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Content.Shared.GameObjects.Components.Weapons.Ranged;
|
||||
using Content.Shared.GameObjects.Components.Weapons.Ranged;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Weapons.Ranged
|
||||
{
|
||||
@@ -30,9 +31,9 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged
|
||||
FireRateSelector = rangedState.FireRateSelector;
|
||||
}
|
||||
|
||||
public void SyncFirePos(GridCoordinates worldPos)
|
||||
public void SyncFirePos(GridId targetGrid, Vector2 targetPosition)
|
||||
{
|
||||
SendNetworkMessage(new FirePosComponentMessage(worldPos));
|
||||
SendNetworkMessage(new FirePosComponentMessage(targetGrid, targetPosition));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ using Robust.Shared.Input;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.Interfaces.Timing;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Client.GameObjects.EntitySystems
|
||||
{
|
||||
@@ -96,9 +97,13 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
var worldPos = _eyeManager.ScreenToMap(_inputManager.MouseScreenPosition);
|
||||
|
||||
if (!_mapManager.TryFindGridAt(worldPos, out var grid))
|
||||
grid = _mapManager.GetDefaultGrid(worldPos.MapId);
|
||||
|
||||
weapon.SyncFirePos(grid.MapToGrid(worldPos));
|
||||
{
|
||||
weapon.SyncFirePos(GridId.Invalid, worldPos.Position);
|
||||
}
|
||||
else
|
||||
{
|
||||
weapon.SyncFirePos(grid.Index, grid.MapToGrid(worldPos).Position);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user