Skip to content

Commit 4410466

Browse files
committed
EnterVehiclePositionにInboundsチェックを追加
1 parent 54e40b9 commit 4410466

4 files changed

Lines changed: 14 additions & 12 deletions

File tree

‎About/About.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
このModはVehicle Frameworkを使用した車両に、床や建築物を建設可能なマップを載せるためのフレームワークMODです。
88
這個模組是 **Vehicle Framework** 的擴展,讓車輛能夠變成一張可建造的地圖,你可以在上面蓋地板、建築,打造屬於自己的移動基地!
99
</description>
10-
<modVersion IgnoreIfNoMatchingField="True">1.6.188</modVersion>
10+
<modVersion IgnoreIfNoMatchingField="True">1.6.189</modVersion>
1111
<url>https://github.com/oelsart/VehicleMapFramework</url>
1212
<supportedVersions>
1313
<li>1.5</li>

‎Source/VehicleMapFramework/MapComponents/VehicleSectionLayerManager.cs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.Linq;
43
using SmashTools;
54
using VehicleMapFramework.VMF_HarmonyPatches;
65
using Verse;

‎Source/VehicleMapFramework/Utilities/CrossMapReachabilityUtility.cs‎

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System.Collections.Generic;
2-
using System.Diagnostics;
1+
using System.Diagnostics;
32
using System.Linq;
43
using System.Runtime.CompilerServices;
54
using SmashTools;
@@ -95,18 +94,23 @@ public static IntVec3 EnterVehiclePosition(TargetInfo enterSpot, out int dist, V
9594
var cell = enterSpot.Cell.ToBaseMapCoord(vehicle);
9695
var faceCell = enterSpot.HasThing ? enterSpot.Thing.BaseFullRotation().FacingCell : enterSpot.Cell.BaseFullDirectionToInsideMap(vehicle).FacingCell;
9796

98-
dist = 1;
99-
while ((cell - (faceCell * dist)).GetThingList(vehicle.Map).Contains(vehicle))
97+
dist = 0;
98+
IntVec3 cell2;
99+
do
100100
{
101101
dist++;
102-
}
102+
cell2 = cell - faceCell * dist;
103+
if (!cell2.InBounds(vehicle.Map))
104+
{
105+
dist = 0;
106+
return IntVec3.Invalid;
107+
}
108+
} while (cell2.GetThingList(vehicle.Map).Contains(vehicle));
103109
if (enterSpot.Thing is Building_VehicleRamp && dist < 2) dist++;
104110

105-
var result = cell - (faceCell * dist);
106111
if (enterer != null)
107-
{
108-
result -= faceCell * enterer.HalfLength();
109-
}
112+
dist += enterer.HalfLength();
113+
var result = cell - faceCell * dist;
110114
return result;
111115
}
112116

‎Source/VehicleMapFramework/VMF_HarmonyPatches/Patches_VehicleFramework.cs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
using Verse.AI.Group;
1818
using Verse.Sound;
1919
using static VehicleMapFramework.MethodInfoCache;
20-
using static VehicleMapFramework.ModCompat.VehicleFramework;
2120
using Transform = SmashTools.Rendering.Transform;
2221

2322
namespace VehicleMapFramework.VMF_HarmonyPatches;

0 commit comments

Comments
 (0)