The player can now have simple conversations with NPCs.
This commit is contained in:
parent
e0b88e7a45
commit
e81345e793
4 changed files with 115 additions and 10 deletions
11
gamemap.py
11
gamemap.py
|
@ -190,6 +190,7 @@ class NPC(Thing):
|
|||
self.inventory = inventory
|
||||
self.customValues = customValues
|
||||
self.graphic = graphic
|
||||
self.behaveEvent = None
|
||||
|
||||
def give(self, item):
|
||||
self.inventory.append(item)
|
||||
|
@ -545,6 +546,7 @@ Entering a map through stdin will be obsolete once testing is over."""
|
|||
yaml = ruamel.yaml.YAML()
|
||||
yaml.register_class(Item)
|
||||
yaml.register_class(Useable)
|
||||
yaml.register_class(NPC)
|
||||
yaml.register_class(Door)
|
||||
yaml.register_class(MapExit)
|
||||
if infile != None:
|
||||
|
@ -553,14 +555,9 @@ Entering a map through stdin will be obsolete once testing is over."""
|
|||
info = yaml.load(f)
|
||||
except OSError as e:
|
||||
print("The file could not be read.")
|
||||
return None
|
||||
return None, nextThing
|
||||
else:
|
||||
|
||||
while tryToRead:
|
||||
try:
|
||||
data += input()
|
||||
except EOFError as e:
|
||||
tryToRead = False
|
||||
raise RuntimeError("No file was specified for loading.")
|
||||
|
||||
# Now what we do with the data
|
||||
mat = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue