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
32 changes: 18 additions & 14 deletions Data/Base.rte/Devices/Tools/Constructor/Constructor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,8 @@ function Update(self)

if cursorMovement:MagnitudeIsGreaterThan(0) then
self.cursor = self.cursor + (mouseControlled and cursorMovement or cursorMovement:SetMagnitude(self.cursorMoveSpeed * (aiming and 0.5 or 1)));

SceneMan:ForceBounds(self.cursor);
end

local precise = not mouseControlled and aiming;
Expand Down Expand Up @@ -562,21 +564,23 @@ function Update(self)
for x = 1, cellSize do
for y = 1, cellSize do
local pos = Vector(startPos.X + x, startPos.Y + y);
local strengthRatio = SceneMan:GetMaterialFromID(SceneMan:GetTerrMatter(pos.X, pos.Y)).StructuralIntegrity/self.digStrength;
if strengthRatio < 1 and SceneMan:GetMOIDPixel(pos.X, pos.Y) == rte.NoMOID then
local name = "";
if bx + x == 0 or bx + x == self.buildList[1][4] - 1 or by + y == 0 or by + y == self.buildList[1][4] - 1 then
name = "Base.rte/Constructor Border Tile " .. math.random(4);
else
name = "Base.rte/Constructor Tile " .. math.random(16);
end

local terrainObject = CreateTerrainObject(name);
terrainObject.Pos = pos;
SceneMan:AddSceneObject(terrainObject);
if SceneMan:IsWithinBounds(pos.X, pos.Y, 0) then
local strengthRatio = SceneMan:GetMaterialFromID(SceneMan:GetTerrMatter(pos.X, pos.Y)).StructuralIntegrity/self.digStrength;
if strengthRatio < 1 and SceneMan:GetMOIDPixel(pos.X, pos.Y) == rte.NoMOID then
local name = "";
if bx + x == 0 or bx + x == self.buildList[1][4] - 1 or by + y == 0 or by + y == self.buildList[1][4] - 1 then
name = "Base.rte/Constructor Border Tile " .. math.random(4);
else
name = "Base.rte/Constructor Tile " .. math.random(16);
end

didBuild = true;
totalCost = 1 - strengthRatio;
local terrainObject = CreateTerrainObject(name);
terrainObject.Pos = pos;
SceneMan:AddSceneObject(terrainObject);

didBuild = true;
totalCost = 1 - strengthRatio;
end
end
end
end
Expand Down