Skip to content

Commit

Permalink
include touchy flag for position checks to prevent skipping over non-…
Browse files Browse the repository at this point in the history
…solid touchy things
  • Loading branch information
nstlaurent committed Jun 13, 2024
1 parent 40e0727 commit 9c22392
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Core/World/Entities/Definition/Flags/EntityFlags.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Helion.Models;
using System;

namespace Helion.World.Entities.Definition.Flags;

Expand All @@ -8,6 +7,7 @@ public struct EntityFlags
public const int SpecialFlag = FlagValue.Flag1;
public const int SolidFlag = FlagValue.Flag2;
public const int ShootableFlag = FlagValue.Flag3;
public const int TouchyFlag = FlagValue.Flag24;

public int Flags1;
public int Flags2;
Expand Down
5 changes: 3 additions & 2 deletions Core/World/Physics/PhysicsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,8 @@ private void StackedEntityMoveZ(Entity entity)
}
}

private const int PositionValidFlags = EntityFlags.SpecialFlag | EntityFlags.SolidFlag | EntityFlags.ShootableFlag;
private const int PositionValidFlags1 = EntityFlags.SpecialFlag | EntityFlags.SolidFlag | EntityFlags.ShootableFlag;
private const int PositionValidFlags2 = EntityFlags.TouchyFlag;

public unsafe bool IsPositionValid(Entity entity, double x, double y, TryMoveData tryMove)
{
Expand Down Expand Up @@ -1166,7 +1167,7 @@ public unsafe bool IsPositionValid(Entity entity, double x, double y, TryMoveDat

nextEntity.BlockmapCount = checkCounter;

if ((nextEntity.Flags.Flags1 & PositionValidFlags) == 0)
if ((nextEntity.Flags.Flags1 & PositionValidFlags1) == 0 && (nextEntity.Flags.Flags2 & PositionValidFlags2) == 0)
continue;

var blockDist = nextEntity.Radius + entity.Radius;
Expand Down

0 comments on commit 9c22392

Please sign in to comment.