Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions Data/Base.rte/Devices/Tools/Constructor/Constructor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,19 @@ function Update(self)
end
else
for i = 1, self.RoundsFired do
local trace = Vector(self.digLength, 0):RadRotate(angle + RangeRand(-1, 1) * self.spreadRange);
local digPos = ConstructorTerrainRay(self.MuzzlePos, trace, 0);

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

if not diggingAir then
local digWeightTotal = 0;
local totalVel = Vector();
local found = 0;
Expand Down Expand Up @@ -609,4 +617,4 @@ function Update(self)
elseif self.cursor then
self.cursor = nil;
end
end
end