[
  {
    "type": "effect_on_condition",
    "id": "afs_night_messages",
    "recurrence": [ "8 hours", "72 hours" ],
    "condition": { "and": [ { "one_in_chance": 3 }, { "not": "is_day" }, "u_can_see", { "is_weather": "clear" }, "u_is_outside" ] },
    "effect": [ { "u_message": "AFS_NIGHT_MESSAGES_1", "snippet": true } ]
  },
  {
    "type": "effect_on_condition",
    "id": "afs_motion_sensor_eoc",
    "condition": { "u_has_items": { "item": "afs_motion_sensor_on", "charges": 1 } },
    "effect": [
      {
        "run_eocs": [
          {
            "id": "afs_motion_sensor_audio_warning_high",
            "condition": { "math": [ "u_monsters_nearby('radius': 24)", ">", "15" ] },
            "effect": [ { "u_message": "The motion detector whines distressingly!", "type": "warning" } ],
            "false_effect": {
              "run_eocs": [
                {
                  "id": "afs_motion_sensor_audio_warning_medium",
                  "condition": { "math": [ "u_monsters_nearby('radius': 24)", ">", "5" ] },
                  "effect": [ { "u_message": "The motion detector emits a short series of warning beeps.", "type": "warning" } ],
                  "false_effect": {
                    "run_eocs": [
                      {
                        "id": "afs_motion_sensor_audio_warning_low",
                        "condition": { "math": [ "u_monsters_nearby('radius': 24)", ">", "1" ] },
                        "effect": [ { "u_message": "The motion detector emits a single warning beep.", "type": "info" } ]
                      }
                    ]
                  }
                }
              ]
            }
          }
        ]
      },
      { "u_adjust_var": "afs_motion_sensor_ping", "type": "flag", "context": "motion_sensor", "adjustment": 1 },
      { "queue_eocs": "afs_motion_sensor_eoc_end_ping", "time_in_future": [ "2 seconds", "2 seconds" ] }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "afs_motion_sensor_eoc_end_ping",
    "effect": [ { "u_add_var": "afs_motion_sensor_ping", "type": "flag", "context": "motion_sensor", "value": "0" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ESCAPE_POD_CHAIR",
    "effect": [
      {
        "u_location_variable": { "context_val": "escape_pod_crate" },
        "target_params": { "om_terrain": "crashing_ship_4", "search_range": 10, "z": -10 },
        "terrain": "t_escape_pod_floor",
        "target_max_radius": 24
      },
      {
        "u_map_run_item_eocs": "all",
        "loc": { "context_val": "escape_pod_crate" },
        "min_radius": 0,
        "max_radius": 0,
        "true_eocs": [ { "id": "EOC_AFS_ESCAPE_POD_CARGO_TP", "effect": [ { "npc_teleport": { "global_val": "new_map" } } ] } ]
      },
      {
        "u_message": "You make sure that all equipment is strapped down and loose items are put away to avoid projectiles during launch before you strap yourself into the escape pod seat and press the launch button.  With an incredibly loud roar and a massive acceleration that presses you into the seat, the escape pod fires from the ship, plummeting towards the planet below.",
        "popup": true
      },
      { "u_teleport": { "global_val": "new_map" }, "force": true }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_AFS_ESCAPE_POD_CARGO_TP",
    "effect": [ { "u_teleport": { "global_val": "new_map" }, "force": true } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_CRASHING_SHIP_SETUP",
    "eoc_type": "SCENARIO_SPECIFIC",
    "effect": [
      {
        "u_location_variable": { "global_val": "new_map" },
        "target_params": { "om_terrain": "afs_crashed_escape_pod", "search_range": 500, "z": 0 },
        "terrain": "t_metal_floor",
        "target_max_radius": 30,
        "min_radius": 0,
        "max_radius": 0
      },
      { "queue_eocs": "EOC_CRASHING_SHIP_U_DIE", "time_in_future": "7 minutes" }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_CRASHING_SHIP_U_DIE",
    "condition": { "u_near_om_location": "crashing_ship_5", "range": 1 },
    "effect": [
      {
        "u_message": "A large boom rocks the hull, fire engulfs the decks.  You can do nothing but watch as a wall of burning gas rushes towards you, consumes you as fast as it came, and then all is black.",
        "popup": true
      },
      "u_die"
    ]
  }
]
