Difference between revisions of "Sensor degradation with range or facing"

From FreeSpace Wiki
Jump to: navigation, search
m (More grammar. Argh)
(minor fix)
Line 4: Line 4:
 
     - <span style="color:red">op</span> any-of
 
     - <span style="color:red">op</span> any-of
 
       # <list of ships for which to apply range/facing-based targetability>
 
       # <list of ships for which to apply range/facing-based targetability>
 +
    - <span style="color:red">op</span> true
 
     - <span style="color:red">op</span> when
 
     - <span style="color:red">op</span> when
 
       - <span style="color:red">op</span> and
 
       - <span style="color:red">op</span> and

Revision as of 16:52, 16 February 2011

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 is facing them (or more specifically if he 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 true
   - 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).