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

LocationFilter: conditions, reachable, mapped, elsewhere, entered, landed #23

Draft
wants to merge 1 commit into
base: experimental
Choose a base branch
from

Conversation

UnorderedSigh
Copy link

Feature: Location filters can have conditions, visit info, reachability, and other PlayerInfo things.

This is identical to PR endless-sky#8260 to endless-sky master.

Related issues: #7789, #7702, #5525, #5395

A previous attempt at visit-related features in a LocationFilter is: #5415 and I have addressed the issues raised there.

Feature Details

Connects PlayerInfo to LocationFilter, allowing this:

mission
    ...
    destination
        elsewhere      # not at the center of the search (AKA not source)
        reachable      # player's flagship can get to the system, even if they don't know how
        mapped         # player has mapped a route to the system, even if their flagship can't get there
        entered        # player has entered (visited) the system
        landed         # player has landed on (visited) the planet
                       # (for a system filter: any planet in the system)

        # You can test conditions:
        test
            dog + cat == bunny

        # You can negate any of that:
        not landed
        not
             mapped
             reachable
             ...
    source
        ... # all that other stuff except "elsewhere" which would exclude the player's location

All those features will work in any location filters except person and the location test program. In those two, you can use elsewhere but not the others. However, the meaning of elsewhere depends on the context; it is always the center of the search.

UI Screenshots

N/A

Usage Examples

  1. Multiple not blocks to select different regions based on conditions. This may let us merge multiple missions into one, when the difference was just source or destination
  2. Remnant research missions can be restricted to mapped or reachable locations.
  3. Jobs can be restricted to areas the player already knows about (entered, landed, mapped) to prevent accidentally giving away map information before it is time to.

Testing Done

Lots of printfs, since the location test program has no PlayerInfo. (That can be dealt with in a later PR.)

Here are some examples:

filtertest.txt

Automated Tests Added

N/A

Performance Impact

No impact to existing features.

The reachable and mapped calculate a DistanceMap, which is expensive, so they should be restricted to mission destination/stopover/waypoint filters. If you use them in persons and enforcement zones, then things may get slow. I can't imagine how they'd be useful there... just sayin'.

@UnorderedSigh UnorderedSigh changed the title LocationFilter: conditions, reachable, mapped, elsewhere, entered, la… LocationFilter: conditions, reachable, mapped, elsewhere, entered, landed Jun 2, 2023
@UnorderedSigh
Copy link
Author

UnorderedSigh commented Aug 30, 2024

I'm not thrilled about the number of places I have to add PlayerInfo to support conditions in the filters on fleet spawns.

EDIT: I haven't updated this branch yet because I'm still pondering how to deal with the numerous new PlayerInfo locations.

@Zitchas Zitchas marked this pull request as draft October 2, 2024 20:03
@Zitchas
Copy link
Member

Zitchas commented Oct 2, 2024

No pressure, just converting it to draft so it is visually distinctive in the PR list.

@Zitchas Zitchas added the code Things that focus on the mechanics and internals of how they have engine works. label Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code Things that focus on the mechanics and internals of how they have engine works.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants