Skip to content

Commit

Permalink
Merge pull request Ash-LikeSnow#105 from BDCarrillo/master
Browse files Browse the repository at this point in the history
Negative Ent ID protection
  • Loading branch information
BDCarrillo authored Oct 21, 2024
2 parents d2f491b + 61cada2 commit 958a1db
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Data/Scripts/CoreSystems/Session/SessionUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ private void AiLoop()
}
}
}
else if (eTarget != null && eTarget.MarkedForClose || w.Target.HasTarget && w.Target.TargetObject == null && w.TargetData.EntityId >= 0 || w.DelayedTargetResetTick == Tick && w.TargetData.EntityId == 0 && w.Target.TargetObject != null)
else if (eTarget != null && eTarget.MarkedForClose || w.Target.HasTarget && w.Target.TargetObject == null && (w.TargetData.EntityId >= 0 || w.TargetData.EntityId <= -3) || w.DelayedTargetResetTick == Tick && w.TargetData.EntityId == 0 && w.Target.TargetObject != null)
{
w.Target.Reset(Tick, States.ServerReset);
}
Expand Down
2 changes: 1 addition & 1 deletion Data/Scripts/CoreSystems/Support/MiscTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ internal void ClientUpdate(Weapon w, ProtoWeaponTransferTarget tData)
}

MyEntity targetEntity = null;
if (tData.EntityId <= 0 || MyEntities.TryGetEntityById(tData.EntityId, out targetEntity, true))
if ((tData.EntityId <= 0 && tData.EntityId >= -2) || MyEntities.TryGetEntityById(tData.EntityId, out targetEntity, true))
{
TargetObject = targetEntity;

Expand Down
2 changes: 1 addition & 1 deletion Data/Scripts/CoreSystems/Ui/Targeting/TargetUiSelect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ private bool TargetExcludedFromVoxelLos(Ai ai, MyEntity target)
foreach (var m in Session.I.ActiveMarks)
{
var grid = m.Item3.TmpEntity as MyCubeGrid;
if ((grid != null || m.Item3.EntityId > 0 && MyEntities.TryGetEntityById(m.Item3.EntityId, out grid) && grid != null) && targetGrid.IsSameConstructAs(grid))
if ((grid != null || (m.Item3.EntityId > 0 || m.Item3.EntityId <= -3)&& MyEntities.TryGetEntityById(m.Item3.EntityId, out grid) && grid != null) && targetGrid.IsSameConstructAs(grid))
return true;
}
}
Expand Down

0 comments on commit 958a1db

Please sign in to comment.