player now checks tile data via collider RID
This commit is contained in:
parent
9f1a7f5235
commit
e6909833e9
1 changed files with 5 additions and 3 deletions
|
|
@ -310,10 +310,12 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
|
|||
if (collision.GetCollider() is not TileMapLayer tileMapLayer)
|
||||
continue;
|
||||
|
||||
var collisionPos = collision.GetPosition();
|
||||
var mapCoords = tileMapLayer.GlobalToMap(collisionPos);
|
||||
// This is legal because spikes and other options with attached tile data
|
||||
// live on a layer without physics chunking.
|
||||
var colliderRid = collision.GetColliderRid();
|
||||
var cellCoords = tileMapLayer.GetCoordsForBodyRid(colliderRid);
|
||||
|
||||
if (tileMapLayer.GetCellTileData(mapCoords) is not { } tileData)
|
||||
if (tileMapLayer.GetCellTileData(cellCoords) is not { } tileData)
|
||||
continue;
|
||||
|
||||
if (!tileData.HasCustomData("damage")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue