Fix keycard mismatch and typo in locked-door message
Inventory stored keycards under their full item_id (keycard_red) while Room.locked_by/has_keycard checked against the plain color (red), so the Waffentresor always reported itself as locked even with the keycard in hand. Also fixes "rede Keycard" -> "rote Keycard".
This commit is contained in:
1 parent
46116f7f4b
commit
d4fd5561c2
2 files changed
+6
-2
No files matched your search
@@ -78,7 +78,8 @@ class Inventory:
|
||||
|
||||
def add(self, item, count=1):
|
||||
if item.kind == "key":
|
||||
self.keycards.add(item.item_id)
|
||||
color = item.item_id.removeprefix("keycard_")
|
||||
self.keycards.add(color)
|
||||
return
|
||||
if item.kind == "fragment":
|
||||
self.crucible_fragments += count
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
from doom_matrix.engine.ui import Colors, slow_print, menu, section_title
|
||||
from doom_matrix.engine import cheats
|
||||
|
||||
KEYCARD_COLOR_DE = {"red": "rote", "blue": "blaue", "yellow": "gelbe"}
|
||||
|
||||
|
||||
class Room:
|
||||
def __init__(self, room_id, name, description, exits=None, item_ids=None,
|
||||
@@ -98,7 +100,8 @@ class Hub:
|
||||
_, target_id = exit_keys[idx]
|
||||
target = self.rooms.get(target_id)
|
||||
if target and target.locked_by and not player.inventory.has_keycard(target.locked_by):
|
||||
slow_print(f"\n{Colors.RED}Diese Tuer benoetigt eine {target.locked_by}e Keycard.{Colors.END}")
|
||||
color_de = KEYCARD_COLOR_DE.get(target.locked_by, target.locked_by)
|
||||
slow_print(f"\n{Colors.RED}Diese Tuer benoetigt eine {color_de} Keycard.{Colors.END}")
|
||||
return None
|
||||
self.current_id = target_id
|
||||
return None
|
||||
|
||||
Reference in new issue
Block a user