Fixed prefabs not correctly loading in containers. Made looking in containers more practical.
This commit is contained in:
parent
358c28d410
commit
9251886638
2 changed files with 28 additions and 3 deletions
|
@ -309,11 +309,15 @@ list of lists of tuples."""
|
||||||
return nextThing
|
return nextThing
|
||||||
elif isinstance(container, dict):
|
elif isinstance(container, dict):
|
||||||
for i in container:
|
for i in container:
|
||||||
|
if isinstance(container[i], _gt.Prefab):
|
||||||
|
container[i] = GameMap.resolvePrefab(prefabs, container[i])
|
||||||
nextThing = GameMap.addThingRecursive(GameMap.resolvePrefab(prefabs, container[i]), prefabs, nextThing)
|
nextThing = GameMap.addThingRecursive(GameMap.resolvePrefab(prefabs, container[i]), prefabs, nextThing)
|
||||||
return nextThing
|
return nextThing
|
||||||
elif isinstance(container, list):
|
elif isinstance(container, list):
|
||||||
for i in container:
|
for i in range(len(container)):
|
||||||
nextThing = GameMap.addThingRecursive(GameMap.resolvePrefab(prefabs, i), prefabs, nextThing)
|
if isinstance(container[i], _gt.Prefab):
|
||||||
|
container[i] = GameMap.resolvePrefab(prefabs, container[i])
|
||||||
|
nextThing = GameMap.addThingRecursive(container[i], prefabs, nextThing)
|
||||||
return nextThing
|
return nextThing
|
||||||
else:
|
else:
|
||||||
return nextThing
|
return nextThing
|
||||||
|
|
23
gameshell.py
23
gameshell.py
|
@ -497,7 +497,28 @@ Player is modified through side-effect."""
|
||||||
del instr[1]
|
del instr[1]
|
||||||
thingName = ' '.join(instr[1:])
|
thingName = ' '.join(instr[1:])
|
||||||
if len(thingName) == 0:
|
if len(thingName) == 0:
|
||||||
print(f"{self.gameBase.player.name} looks at nothing.")
|
# Print the lists of items again.
|
||||||
|
longestLen = 0
|
||||||
|
for i in player.thingNames:
|
||||||
|
if len(i) > longestLen:
|
||||||
|
longestLen = len(i)
|
||||||
|
if longestLen > 0:
|
||||||
|
inv = player.inventory # do this assignment because player.inventory is O(n)
|
||||||
|
print('{{0:<{0}}}{1}'.format(max(6, longestLen+2), "Container:").format("Inv:"))
|
||||||
|
i = 0
|
||||||
|
while i < len(inv) and i < len(cont):
|
||||||
|
print('{{0:<{0}}}{1}'.format(longestLen+2, cont[i].name).format(inv[i].name))
|
||||||
|
i += 1
|
||||||
|
while i < len(inv):
|
||||||
|
print(inv[i].name)
|
||||||
|
i += 1
|
||||||
|
while i < len(cont):
|
||||||
|
print(' '*(longestLen+2) + cont[i].name)
|
||||||
|
i += 1
|
||||||
|
else:
|
||||||
|
print('Container:')
|
||||||
|
for i in cont:
|
||||||
|
print(i.name)
|
||||||
else:
|
else:
|
||||||
# Check the container first.
|
# Check the container first.
|
||||||
for i in range(len(cont)):
|
for i in range(len(cont)):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue