diff --git a/BaseClasses.py b/BaseClasses.py index fed3e7cd..fc1cdd71 100644 --- a/BaseClasses.py +++ b/BaseClasses.py @@ -1471,16 +1471,16 @@ 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: Union[bool, str] = 'silent' # False -> warns if item not successfully placed. True -> errors out on failure to place item. + force: 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']: + if self.force 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']: + if self.force in ['true', 'fail', 'failure']: raise exception(warning) else: self.warn(warning) diff --git a/Mystery.py b/Mystery.py index 328f32ad..8d2c4535 100644 --- a/Mystery.py +++ b/Mystery.py @@ -576,7 +576,7 @@ def roll_settings(weights, plando_options: typing.Set[str] = frozenset(("bosses" if roll_percentage(get_choice("percentage", placement, 100)): from_pool = get_choice("from_pool", placement, PlandoItem.from_pool) location_world = get_choice("world", placement, PlandoItem.world) - force = get_choice("force", placement, PlandoItem.force) + force = str(get_choice("force", placement, PlandoItem.force)).lower() if "items" in placement and "locations" in placement: items = placement["items"] locations = placement["locations"] diff --git a/WebHostLib/static/assets/tutorial/zelda3/plando_en.md b/WebHostLib/static/assets/tutorial/zelda3/plando_en.md index 493ffb59..7eeac95f 100644 --- a/WebHostLib/static/assets/tutorial/zelda3/plando_en.md +++ b/WebHostLib/static/assets/tutorial/zelda3/plando_en.md @@ -49,7 +49,7 @@ boss_shuffle: ### Items - This module is disabled by default. -- Has the options from_pool, world, percentage and either item and location or items and locations +- Has the options from_pool, world, percentage, force and either item and location or items and locations - All of these options support subweights - percentage is the percentage chance for this block to trigger - is a number in the range [0, 100], can be omitted entirely for 100% @@ -62,6 +62,10 @@ boss_shuffle: - can be true, to target any other player's world - can be false, to target own world and is the default - can be null, to target a random world +- force is either "silent", "true" or "false". + - "true" means the item has to be placed, or the generator aborts with an exception. + - "false" means the generator logs a warning if the placement can't be done. + - "silent" means that this entry is entirely ignored if the placement fails and is the default. - Single Placement - place a single item at a single location - item denotes the Item to place