Added the same MAC address to the scanner as the tablet

This commit is contained in:
Damian-I
2025-02-18 16:29:37 +00:00
parent 5ae7000adb
commit 791230c72c
2 changed files with 35 additions and 28 deletions

View File

@@ -36,15 +36,18 @@
"name": "Tablet Device",
"takeable": true,
"locked": true,
"lockType": "pin",
"requires": "1234",
"observations": "A locked tablet device"
"lockType": "bluetooth",
"requires": "00:11:22:33:44:55",
"mac": "00:11:22:33:44:55",
"observations": "A locked tablet device that requires Bluetooth pairing"
},
{
"type": "bluetooth_scanner",
"name": "Bluetooth Scanner",
"takeable": true,
"observations": "A device for detecting nearby Bluetooth signals"
"observations": "A device for detecting nearby Bluetooth signals",
"canScanBluetooth": true,
"mac": "00:11:22:33:44:55"
}
]
},

View File

@@ -222,9 +222,8 @@
this.load.image('safe', 'assets/objects/safe.png');
this.load.image('book', 'assets/objects/book.png');
this.load.image('workstation', 'assets/objects/workstation.png');
this.load.image('bluetooth_scanner', 'assets/objects/bluetooth_scanner.png');
this.load.image('tablet', 'assets/objects/tablet.png');
this.load.image('bluetooth_scanner', 'assets/objects/bluetooth_scanner.png');
this.load.json('gameScenarioJSON', 'assets/scenarios/ceo_exfil.json');
gameScenario = this.cache.json.get('gameScenarioJSON');
@@ -1406,10 +1405,22 @@
}
const data = sprite.scenarioData;
let message = `${data.name}\n\n`;
message += `Observations: ${data.observations}\n\n`;
// Check if this is an unlocked container that hasn't been collected yet
if (data.isUnlockedButNotCollected && data.contents) {
let message = `You found the following items:\n`;
// Check for locked state in scenarioData
if (data.locked === true) {
console.log('Item is locked:', data);
handleUnlock(sprite, 'item');
return;
}
if (data.readable && data.text) {
message += `Text: ${data.text}\n\n`;
}
if (data.contents && data.contents.length > 0) {
message += `You found the following items:\n`;
data.contents.forEach(item => {
message += `- ${item.name}\n`;
});
@@ -1425,27 +1436,12 @@
addToInventory(contentSprite);
}
});
// Clear contents after adding to inventory
data.contents = [];
data.isUnlockedButNotCollected = false;
return;
}
// Check for locked state in scenarioData
if (data.locked === true) {
console.log('Item is locked:', data);
handleUnlock(sprite, 'item');
return;
}
let message = `${data.name}\n\n`;
message += `Observations: ${data.observations}\n\n`;
if (data.readable && data.text) {
message += `Text: ${data.text}\n\n`;
}
if (data.takeable) {
message += `This item can be taken\n\n`;
@@ -1842,7 +1838,7 @@
}
}
// Modify the unlockTarget function
// Generic unlock function
function unlockTarget(lockable, type, layer) {
if (type === 'door') {
if (!layer) {
@@ -1857,15 +1853,23 @@
// Set new state for containers with contents
if (lockable.scenarioData.contents) {
lockable.scenarioData.isUnlockedButNotCollected = true;
return; // Return early to prevent automatic collection
}
} else {
lockable.locked = false;
if (lockable.contents) {
lockable.isUnlockedButNotCollected = true;
return; // Return early to prevent automatic collection
}
}
// If the item has contents, make them accessible
if (lockable.scenarioData?.contents) {
lockable.scenarioData.contents.forEach(item => {
const sprite = createInventorySprite(item);
if (sprite) {
addToInventory(sprite);
}
});
}
}
}