Skip to content

Conversation

@axxroytovu
Copy link
Contributor

@axxroytovu axxroytovu commented Jan 2, 2025

Still needs cleanup so I'm leaving this as draft for now.

What does this PR do?

  • Allows items and locations to individually have yaml_option definitions
  • Adds syntax to allow yaml_option to check range & choice options:
    • "option>10", "option<10", "option=10" and "!option=10" all properly check against a range option
    • "option:choice" properly checks against a choice option

src/Options.py Outdated
for option_name in category_table[category].get("yaml_option", []):
for c in "><=:": # Range and Choice options must be defined using Options.json
if c in option_name:
continue
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make this check for option_name in manual_options, and throw an exception if they forgot to define it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e5f27a8

@axxroytovu axxroytovu marked this pull request as ready for review January 19, 2025 05:12
is_location_enabled and is_item_enabled function input types were wrong and confusing
Split lambdas into two stages to prevent infinite recursion
Copy link
Collaborator

@silasary silasary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choices should also use =, not :

@axxroytovu
Copy link
Contributor Author

Easy enough change.

I kept : instead of = because it felt more consistent with other manual syntax that already uses : but I'm not married to it.

@axxroytovu axxroytovu requested a review from silasary January 19, 2025 16:53
silasary
silasary previously approved these changes Jan 19, 2025
Copy link
Collaborator

@silasary silasary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're supporting >= and <=, we should probably also support !=?

@axxroytovu
Copy link
Contributor Author

It does already, but the format is "!option=value". Should be easy enough to also support "option!=value" as well.

@silasary
Copy link
Collaborator

Yeah. Supporting both will lead to less support requests :D


category_data = category_table.get(category_name, {})
return resolve_yaml_option(multiworld, player, category_data)
category_data = multiworld.worlds[player].category_table.get(category_name, {})
Copy link
Collaborator

@FuzzyGamesOn FuzzyGamesOn Jan 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was wondering why you referenced it this way and was reminded once again that the is_*_enabled hooks don't pass in world like all the other hooks, lol

(Just an observation. This way is fine, and the hooks can be standardized later.)

nicopop added a commit that referenced this pull request Jan 25, 2025
Fixed hook type hints
Added `==` as valid option to match ManualForArchipelago#130 syntax
Comment on lines +124 to +129

try_resolve = resolve_yaml_option(multiworld, player, item)
if try_resolve is None:
return _is_manualobject_enabled(multiworld, player, item)
else:
return try_resolve
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if I understand this part correctly if the item says its enabled via your new yaml_option then categories are not checked at all is that what you mean to do?
is that something we want?
idk but its something to think of

Copy link
Contributor

@nicopop nicopop Apr 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually there's a reason I originaly just put return _is_manualobject_enabled since the logic is the same for both loc and item maybe you could move your try_resolve call there so you dont have 2 copy of this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if I understand this part correctly if the item says its enabled via your new yaml_option then categories are not checked at all is that what you mean to do?

Hmm. I could probably put an AND in there instead

@FuzzyGamesOn
Copy link
Collaborator

At a glance, looks like this is just waiting on the resolve_yaml / manualobject_enabled adjustment. Skimmed over and looks good, will circle back to review more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants