From 6c60821469e2cd1859ee97359f8ad9c05a96bcae Mon Sep 17 00:00:00 2001 From: nak Date: Mon, 16 Mar 2026 19:46:35 +0000 Subject: [PATCH] Fix continuous triggering of buying shapes with controller --- scripts/shelfShape.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/scripts/shelfShape.js b/scripts/shelfShape.js index 03e598a..ed2b1fa 100644 --- a/scripts/shelfShape.js +++ b/scripts/shelfShape.js @@ -164,7 +164,7 @@ spawnClone(); notify("Spawned " + _shapeId + " (" + (live + 1) + "/" + owned + " active)"); - _busy = false; + // _busy stays true until trigger release (stopNearTrigger/stopFarTrigger/clickUpOnEntity) }); }); } @@ -175,9 +175,16 @@ _entityID = entityID; }; - this.clickDownOnEntity = function () { - onClickDown(); - }; + // Mouse + this.clickDownOnEntity = function () { onClickDown(); }; + this.clickUpOnEntity = function () { _busy = false; }; + + // Controller — near (<0.3m) and far (>0.3m) + // Requires "Triggerable" checkbox enabled on the entity. + this.startNearTrigger = function () { onClickDown(); }; + this.stopNearTrigger = function () { _busy = false; }; + this.startFarTrigger = function () { onClickDown(); }; + this.stopFarTrigger = function () { _busy = false; }; this.unload = function () { _token = null;