Skip to content

Commit 4f85571

Browse files
authored
Merge pull request #106 from MageKing17/bugfix/constructor-instant-cancel
Fix Constructor instantly cancelling the build cursor sometimes.
2 parents ccbe88b + a53a897 commit 4f85571

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [Unreleased]
8+
9+
<details><summary><b>Fixed</b></summary>
10+
11+
- Fixed Constructor auto-cancelling build mode if you actively selected the "Order Construction" pie menu option.
12+
13+
</details>
14+
715
## [Release v6.2.0] - 2024/02/19
816

917
<details><summary><b>Added</b></summary>

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ function Create(self)
8787
self.maxFillDistance = 6; -- block distance
8888
self.tunnelFillDelay = 30000 + 30000 * (1 - ActivityMan:GetActivity().Difficulty/GameActivity.MAXDIFFICULTY);
8989

90+
self.menu_ignore = false; -- ignore the pie menu button until it's released
91+
9092
-- don't change these
9193
self.toAutoBuild = false;
9294
self.operatedByAI = false;
@@ -191,6 +193,12 @@ function Update(self)
191193
local playerControlled = actor:IsPlayerControlled();
192194
local screen = ActivityMan:GetActivity():ScreenOfPlayer(ctrl.Player);
193195

196+
if playerControlled and self.menu_ignore then
197+
if not ctrl:IsState(Controller.PIE_MENU_ACTIVE) then
198+
self.menu_ignore = false
199+
end
200+
end
201+
194202
if self.Magazine then
195203
self.Magazine.RoundCount = math.max(self.resource, 1);
196204

@@ -394,6 +402,10 @@ function Update(self)
394402
-- constructor build cursor
395403
if playerControlled then
396404
self.cursor = Vector(self.MuzzlePos.X, self.MuzzlePos.Y);
405+
-- If the player actively selected this, ignore the pie menu.
406+
if ctrl:IsState(Controller.PIE_MENU_ACTIVE) then
407+
self.menu_ignore = true;
408+
end
397409
end
398410
end
399411
local displayColorBlue = 5;
@@ -476,7 +488,7 @@ function Update(self)
476488
self.cursor.Y = actor.ViewPoint.Y + self.maxCursorDist.Y * (dist.Y < 0 and -1 or 1);
477489
end
478490

479-
if ctrl:IsState(Controller.PIE_MENU_ACTIVE) or ctrl:IsState(Controller.ACTOR_NEXT_PREP) or ctrl:IsState(Controller.ACTOR_PREV_PREP) then
491+
if (not self.menu_ignore and ctrl:IsState(Controller.PIE_MENU_ACTIVE)) or ctrl:IsState(Controller.ACTOR_NEXT_PREP) or ctrl:IsState(Controller.ACTOR_PREV_PREP) then
480492
self.cursor = nil;
481493
elseif playerControlled then
482494
-- add blocks to the build queue if the cursor is firing

0 commit comments

Comments
 (0)