Skip to content

Commit

Permalink
Code change to allow unlocking of artifacts
Browse files Browse the repository at this point in the history
Previously thought to not overwrite locks, but now it can if locks are present. If no locks are present then assume no lock detection and do not modify the existing lock statuses
  • Loading branch information
AiZm8 committed Dec 18, 2024
1 parent abaf29a commit 450ccda
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libs/gi/db/src/Database/DataManagers/ArtifactDataManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ export class ArtifactDataManager extends DataManager<
result.artifacts.import = artifacts.length
const idsToRemove = new Set(this.values.map((a) => a.id))
const hasEquipment = artifacts.some((a) => a.location)
const hasLock = artifacts.some((a) => a.lock)
artifacts.forEach((a): void => {
const art = this.validate(a)
if (!art) {
Expand Down Expand Up @@ -216,7 +217,7 @@ export class ArtifactDataManager extends DataManager<
...art,
location: hasEquipment ? art.location : match.location,
// Preserve existing lock state for artifacts reported as unlocked or when the scanner doesn't detect locks ("lock": false JSON)
lock: art.lock === false ? match.lock : art.lock,
lock: hasLock ? art.lock : match.lock,
}
}
}
Expand Down

0 comments on commit 450ccda

Please sign in to comment.