Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

Commit

Permalink
bounds fix in CompShieldField
Browse files Browse the repository at this point in the history
  • Loading branch information
Taranchuk committed May 15, 2022
1 parent 82386ad commit 3a91ec2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
Binary file modified 1.3/Assemblies/VFECore.dll
Binary file not shown.
25 changes: 15 additions & 10 deletions Source/VFECore/VFECore/Comps/ThingComps/CompShieldField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,13 @@ public IEnumerable<Thing> ThingsWithinRadius
{
foreach (var cell in coveredCells)
{
var thingList = cell.GetThingList(HostThing.Map);
for (int i = 0; i < thingList.Count; i++)
if (cell.InBounds(HostThing.Map))
{
yield return thingList[i];
var thingList = cell.GetThingList(HostThing.Map);
for (int i = 0; i < thingList.Count; i++)
{
yield return thingList[i];
}
}
}
}
Expand All @@ -165,16 +168,18 @@ public IEnumerable<Thing> ThingsWithinScanArea
{
get
{

foreach (var cell in scanCells)
{
var thingList = cell.GetThingList(HostThing.Map);
for (int i = 0; i < thingList.Count; i++)
if (cell.InBounds(HostThing.Map))
{
var thing = thingList[i];
var distance = Vector3.Distance(this.HostThing.TrueCenter().Yto0(), thing.TrueCenter().Yto0());
if (distance <= ShieldRadius)
yield return thing;
var thingList = cell.GetThingList(HostThing.Map);
for (int i = 0; i < thingList.Count; i++)
{
var thing = thingList[i];
var distance = Vector3.Distance(this.HostThing.TrueCenter().Yto0(), thing.TrueCenter().Yto0());
if (distance <= ShieldRadius)
yield return thing;
}
}
}
}
Expand Down

0 comments on commit 3a91ec2

Please sign in to comment.