Add options to allow silent failed plando placements.

This commit is contained in:
CaitSith2
2021-01-05 09:53:52 -08:00
parent 2891d575f0
commit 8ef78cc32a
2 changed files with 27 additions and 28 deletions

View File

@@ -1477,7 +1477,19 @@ class PlandoItem(NamedTuple):
location: str
world: Union[bool, str] = False # False -> own world, True -> not own world
from_pool: bool = True # if item should be removed from item pool
force: bool = False # False -> warns if item not successfully placed. True -> errors out on failure to place item.
force: Union[bool, str] = 'silent' # False -> warns if item not successfully placed. True -> errors out on failure to place item.
def warn(self, warning: str):
if str(self.force).lower() in ['true', 'fail', 'failure', 'none', 'false', 'warn', 'warning']:
logging.warning(f'{warning}')
else:
logging.debug(f'{warning}')
def failed(self, warning: str, exception=Exception):
if str(self.force).lower() in ['true', 'fail', 'failure']:
raise exception(warning)
else:
self.warn(warning)
class PlandoConnection(NamedTuple):