Allow user to choose whether getting housed is an error

Previously, the simulation would automatically end whenever it
determined you were housed.  That is still the default, but the user can
now choose to have the simulation continue instead.  Also, this likely
fixes a bug whereby an error could have been thrown for an unavailable
production building when searching the production queue.
This commit is contained in:
Nate Bowman
2026-11-12 00:51:32 -05:00
parent 20d4f5bd6c
commit 8865950678
5 changed files with 81 additions and 5 deletions

View File

@@ -14,6 +14,15 @@ class Production():
raise ProductionBuildingNotAvailableException
def check_production_safe(self, world, thing):
try:
self.check_production(world, thing)
except ProductionBuildingNotAvailableException:
return False
else:
return True
# assumes for now each unit can be built in only one type of building
def __init__(self):
self.building = defaultdict(None, {