Skip to content

Commit 1055805

Browse files
committed
Make Constructor try to find pixels to dig up to 5 times
1 parent e7f64c3 commit 1055805

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

Data/Base.rte/Devices/Tools/Constructor/Constructor.lua

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,11 +326,19 @@ function Update(self)
326326
end
327327
else
328328
for i = 1, self.RoundsFired do
329-
local trace = Vector(self.digLength, 0):RadRotate(angle + RangeRand(-1, 1) * self.spreadRange);
330-
local digPos = ConstructorTerrainRay(self.MuzzlePos, trace, 0);
331329

332-
if SceneMan:GetTerrMatter(digPos.X, digPos.Y) ~= rte.airID then
330+
local trace, digPos, diggingAir
331+
for _ = 1, 5 do
332+
-- Try up to 5 times to find a pixel to dig
333+
trace = Vector(self.digLength, 0):RadRotate(angle + RangeRand(-1, 1) * self.spreadRange);
334+
digPos = ConstructorTerrainRay(self.MuzzlePos, trace, 0);
335+
diggingAir = SceneMan:GetTerrMatter(digPos.X, digPos.Y) == rte.airID
336+
if not diggingAir then
337+
break
338+
end
339+
end
333340

341+
if not diggingAir then
334342
local digWeightTotal = 0;
335343
local totalVel = Vector();
336344
local found = 0;
@@ -609,4 +617,4 @@ function Update(self)
609617
elseif self.cursor then
610618
self.cursor = nil;
611619
end
612-
end
620+
end

0 commit comments

Comments
 (0)