Allow player movement during minigames: Update Bluetooth Scanner, Biometrics, and Lockpick Set minigames to enable player movement while the game is active by introducing a disableGameInput parameter. Refactor minigame manager to respect this parameter, enhancing gameplay experience and flexibility.

This commit is contained in:
Z. Cliffe Schreuders
2025-10-13 08:17:28 +01:00
parent 40edca9fc7
commit 92d5fb268d
5 changed files with 18 additions and 5 deletions

View File

@@ -621,6 +621,7 @@ export function startBiometricsMinigame(item) {
const params = {
title: 'Biometric Scanner',
item: item,
disableGameInput: false, // Allow player to move while scanner is open
onComplete: (success, result) => {
console.log('Biometrics minigame completed with success:', success);
}

View File

@@ -583,6 +583,7 @@ export function startBluetoothScannerMinigame(item) {
const params = {
title: 'Bluetooth Scanner',
item: item,
disableGameInput: false, // Allow player to move while scanner is open
onComplete: (success, result) => {
console.log('Bluetooth scanner minigame completed with success:', success);
}

View File

@@ -25,9 +25,18 @@ export const MinigameFramework = {
}
// Disable main game input if we have a main game scene
// (unless the minigame explicitly allows game input via disableGameInput: false)
if (this.mainGameScene && this.mainGameScene.input) {
this.mainGameScene.input.mouse.enabled = false;
this.mainGameScene.input.keyboard.enabled = false;
const shouldDisableInput = params ? (params.disableGameInput !== false) : true;
if (shouldDisableInput) {
this.mainGameScene.input.mouse.enabled = false;
this.mainGameScene.input.keyboard.enabled = false;
this.gameInputDisabled = true;
console.log('Disabled main game input for minigame');
} else {
this.gameInputDisabled = false;
console.log('Keeping main game input enabled for minigame');
}
}
// Use provided container or create one
@@ -60,10 +69,11 @@ export const MinigameFramework = {
container.remove();
}
// Re-enable main game input if we have a main game scene
if (this.mainGameScene && this.mainGameScene.input) {
// Re-enable main game input if we have a main game scene and we disabled it
if (this.mainGameScene && this.mainGameScene.input && this.gameInputDisabled) {
this.mainGameScene.input.mouse.enabled = true;
this.mainGameScene.input.keyboard.enabled = true;
this.gameInputDisabled = false;
console.log('Re-enabled main game input');
}

View File

@@ -315,6 +315,7 @@ export function startLockpickSetMinigame(item) {
const params = {
title: 'Lockpick Set',
item: item,
disableGameInput: false, // Allow player to move while viewing lockpicks
onComplete: (success, result) => {
console.log('Lockpick set minigame completed with success:', success);
}

View File

@@ -149,7 +149,7 @@ export function addToInventory(sprite) {
// Add item data
itemImg.scenarioData = sprite.scenarioData;
itemImg.name = sprite.name;
itemImg.objectId = sprite.objectId;
itemImg.objectId = 'inventory_' + sprite.objectId;
// Add click handler
itemImg.addEventListener('click', function() {