Temp fix table clickable bounds (#6206)

* Temp fix table clickable bounds

* Fix single instance clickable data

* Consolidate table clickable bounds
This commit is contained in:
ShadowCommander
2022-01-17 18:02:20 -08:00
committed by GitHub
parent 76b4455053
commit 7d30bff5ea
2 changed files with 35 additions and 25 deletions

View File

@@ -18,7 +18,7 @@ namespace Content.Client.Clickable
[Dependency] private readonly IClickMapManager _clickMapManager = default!;
[ViewVariables] [DataField("bounds")] private DirBoundData _data = DirBoundData.Default;
[ViewVariables] [DataField("bounds")] private DirBoundData? _data;
/// <summary>
/// Used to check whether a click worked.
@@ -47,6 +47,8 @@ namespace Content.Client.Clickable
var found = false;
var worldRotation = transform.WorldRotation;
if (_data != null)
{
if (_data.All.Contains(localPos))
{
found = true;
@@ -55,8 +57,12 @@ namespace Content.Client.Clickable
{
// TODO: diagonal support?
var modAngle = sprite.NoRotation ? SpriteComponent.CalcRectWorldAngle(worldRotation, 4) : Angle.Zero;
var dir = sprite.EnableDirectionOverride ? sprite.DirectionOverride : worldRotation.GetCardinalDir();
var modAngle = sprite.NoRotation
? SpriteComponent.CalcRectWorldAngle(worldRotation, 4)
: Angle.Zero;
var dir = sprite.EnableDirectionOverride
? sprite.DirectionOverride
: worldRotation.GetCardinalDir();
modAngle += dir.ToAngle();
@@ -76,6 +82,7 @@ namespace Content.Client.Clickable
found = true;
}
}
}
if (!found)
{

View File

@@ -17,3 +17,6 @@
key: state
base: state_
- type: Climbable
- type: Clickable
bounds:
all: "-0.5,-0.5,0.5,0.5"