Sensor degradation with range or facing

From FreeSpace Wiki
Revision as of 16:44, 16 February 2011 by Shade (talk | contribs) (Example event, currently untested. Will add more detailed explanation later.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The following event is based on an idea by SypheDMar, as proposed in #freespace. It will, in theory, make a set of fighters either be invisible, show up as a fuzzy radar blip, or be fully targetable, all depending on their range to the player as well as whether the player has is facing them, more specifically if has them within a 60-degree forward cone. Detailed explanation below, but without further ado, the event itself:

- op when-argument
   - op any-of
      # <list of ships for which to apply range/facing-based targetability>
   - op when
      - op and
         - op not
            - op is-ship-stealthy
               # <argument>
         - op or
            - op and
               - op >
                  - op distance
                     # <argument>
                     # Alpha 1
                  # 3000
               - op facing
                  # <argument>
                  # 60
            - op and
               - op >
                  - op distance
                     # <argument>
                     # Alpha 1
                  # 1000
               - op not
                  - op facing
                     # <argument>
                     # 60
      - op ship-stealthy
         # <argument>
   - op when
      - op and
         - op or
            - op is-ship-visible
               # <argument>
            - op is-ship-stealthy
               # <argument>
         - op or
            - op and
               - op <=
                  - op distance
                     # <argument>
                     # Alpha 1
                  # 3000
               - op >
                  - op distance
                     # <argument>
                     # Alpha 1
                  # 1000
               - op facing
                  # <argument>
                  # 60
            - op and
               - op <=
                  - op distance
                     # <argument>
                     # Alpha 1
                  # 1000
               - op >
                  - op distance
                     # <argument>
                     # Alpha 1
                  # 300
               - op not
                  - op facing
                     # <argument>
                     # 60
      - op ship-invisible
         # <argument>
      - op ship-unstealthy
         # <argument>
   - op when
      - op and
         - op or
            - op not
               - op is-ship-visible
                  # <argument>
            - op is-ship-stealthy
               # <argument>
         - op or
            - op and
               - op <=
                  - op distance
                     # <argument>
                     # Alpha 1
                  # 1000
               - op facing
                  # <argument>
                  # 60
            - op and
               - op <=
                  - op distance
                     # <argument>
                     # Alpha 1
                  # 300
               - op not
                  - op facing
                     # <argument>
                     # 60
      - op ship-visible
         # <argument>
      - op ship-unstealthy
         # <argument>

Note the use of nested 'when' operators to cover three distinct sets of possibilities within the same event, which allows them to draw on the same argument list. This is not terribly important in this particular case, as no arguments are invalidated or revalidated, but it is kept as one event for demonstration purposes. If one prefers, the event could easily be split in three without any change in functionality (one for each distance bracket).