mirror of
https://github.com/cliffe/BreakEscape.git
synced 2026-02-21 11:18:08 +00:00
Improved lockpicking success handling for doors and containers
This commit is contained in:
23
index.html
23
index.html
@@ -3324,14 +3324,27 @@
|
||||
// Add this function before the pin creation loop
|
||||
function checkWinCondition() {
|
||||
if (gameState.currentBindingIndex >= numPins) {
|
||||
// Update the lockable object's state to be unlocked but not collected
|
||||
if (lockable.scenarioData) {
|
||||
console.log('Lock picked successfully:', lockable);
|
||||
|
||||
// For doors, we need to check properties and handle differently
|
||||
if (lockable && lockable.properties && lockable.properties.locked) {
|
||||
console.log('Unlocking door tile:', lockable);
|
||||
unlockDoor(lockable, lockable.layer);
|
||||
alert("Lock successfully picked! The door is now unlocked.");
|
||||
}
|
||||
// For containers and other lockable items
|
||||
else if (lockable.scenarioData) {
|
||||
console.log('Unlocking container:', lockable.scenarioData);
|
||||
lockable.scenarioData.locked = false;
|
||||
lockable.scenarioData.isUnlockedButNotCollected = true;
|
||||
|
||||
if (lockable.scenarioData.contents) {
|
||||
lockable.scenarioData.isUnlockedButNotCollected = true;
|
||||
alert("Lock successfully picked! You can now interact with it to collect the contents.");
|
||||
} else {
|
||||
alert("Lock successfully picked!");
|
||||
}
|
||||
}
|
||||
|
||||
unlockTarget(lockable, 'door', lockable.layer);
|
||||
alert("Lock successfully picked! You can now interact with it to collect the contents.");
|
||||
document.body.removeChild(iframe);
|
||||
if (currentScene && currentScene.input && currentScene.input.mouse) {
|
||||
currentScene.input.mouse.enabled = true;
|
||||
|
||||
Reference in New Issue
Block a user