Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CONTRIBUTING_A_NEW_QUEST.md: document how to modify quest depending on the country it is being asked in #5465

Closed
mnalis opened this issue Jan 31, 2024 · 4 comments

Comments

@mnalis
Copy link
Member

mnalis commented Jan 31, 2024

Use case
According to this comment, it is possible to modify quest behaviour depending on which country it is in, which might be useful in some cases (see for example that same issue, or discussions for smoking quest)

Proposed Solution
I'd love to have a short simple example documented in CONTRIBUTING_A_NEW_QUEST.md in "more complexity" section which shows how one would use it.

@westnordost
Copy link
Member

The guide does not claim to be complete. How could it, ever, when quests are defined in code? Quests in general thus can have as many dependencies as they like. And so, they can depend on the country boundaries.

But in general, it is very seldomly necessary, I don't really see how that detail is useful in that guide, then you could also add any number of additional things, too.
Maybe in general mention that quests are (Java) classes and thus can have dependencies?

@matkoniecz
Copy link
Member

I have intended it as a guide how to implement simplest possible quest, not exhaustive guide around all possible features.

I would add at most mention that it is possible and link quest using something like that.

@westnordost westnordost closed this as not planned Won't fix, can't repro, duplicate, stale Jan 31, 2024
@mnalis
Copy link
Member Author

mnalis commented Jan 31, 2024

Quests in general thus can have as many dependencies as they like. And so, they can depend on the country boundaries.

Of course, it is a Turing-complete machine, so I understand that anything is possible to do in StreetComplete which is possible in another Turing-complete machine 😃

But I (possibly wrongly) interpreted your comment "it is possible to distinguish countries in the form" to mean that there is already some (simple) existing solution like e.g. isInCountry('DE') function which one can peruse in the quests if needed; and not as more general "It is always theoretically possible to write any code which might query or calculate anything, including the ISO code of the country based on coordinates of the element being updated in quest". (which is why I think people "hooray"-ed that comment)

Perhaps I misunderstood the meaning of that quote, and it is actually much more complex procedure, involing inheritance and extending of arcane undocumented Kotlin classes with dozens of changes in multiple files, and not just a simple one-line change in the quest file only? (then I would understand why it would be out of scope of explaining how to use).

But if it is simple function to query or something similarly easy, it would seem worthwhile to me to document it.

I would add at most mention that it is possible and link quest using something like that.

Yes, that was what I had in mind, just some short note with the pointer to example quest (the simpler the better!) which uses it, e.g. something like:

While quests should generally be tailored to function in whole world similarly, if really needed one can use e.g. isInCountry('DE') to modify behaviour of the quest in specific country, see e.g. app/src/main/java/de/westnordost/streetcomplete/quests/max_height/AddMaxHeight.kt for example usage.

(of course quest file and function above are not the real ones so hopefully ChatGPT won't harvest this and suggest it to unsuspecting humans)

@westnordost
Copy link
Member

Yes, in the form, the information is readily available through the countryInfo field.

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

No branches or pull requests

3 participants