{
  "version": "1.1",
  "name": "Use Room Events as Invisible Systems",
  "startRoom": "lesson_hall",
  "author": "TAGMaker",
  "description": "Entering a gas tunnel automatically checks whether the mask is actually worn and applies damage when it is not. Entering the safe room records arrival once and gives a shorter response on later visits.",
  "playerAppearance": {
    "version": 1,
    "layout": "modern",
    "font": "sans",
    "colorScheme": "light",
    "textSize": 18,
    "lineHeight": 1.6,
    "readingWidth": 80,
    "quietReading": false,
    "mapMode": "discovered",
    "panels": {
      "inventory": true,
      "map": true,
      "objectives": true,
      "status": true,
      "words": true
    },
    "picture": {
      "visible": true,
      "fit": "contain",
      "focalX": 50,
      "focalY": 50
    },
    "commands": {
      "visible": true,
      "standard": [
        "look",
        "search",
        "inventory",
        "help"
      ],
      "custom": []
    },
    "words": []
  },
  "created": "2026-11-01T00:00:00.000Z",
  "modified": "2026-11-01T00:00:00.000Z",
  "files": [
    {
      "path": "rooms/lesson_hall.taml",
      "content": "room lesson_hall\n  exit north: lesson_tunnel\n  name: \"Tunnel Equipment Room\"\n  description: \"Take and wear the gas mask before going north.\"\n  dark: false\nend"
    },
    {
      "path": "rooms/lesson_tunnel.taml",
      "content": "room lesson_tunnel\n  exit north: lesson_safe\n  exit south: lesson_hall\n  name: \"Gas Tunnel\"\n  description: \"The equipment room is south. A safe room is north.\"\n  dark: false\nend"
    },
    {
      "path": "rooms/lesson_safe.taml",
      "content": "room lesson_safe\n  exit south: lesson_tunnel\n  name: \"Clean Air Room\"\n  description: \"The gas tunnel is south.\"\n  dark: false\nend"
    },
    {
      "path": "objects/lesson_mask.taml",
      "content": "object lesson_mask\n  name: \"gas mask\"\n  description: \"Wear this to protect your lungs.\"\n  location: lesson_hall\n  takeable: true\n  wearable: true\n  weight: 0.1\nend"
    },
    {
      "path": "objects/sample_field_journal.taml",
      "content": "object sample_field_journal\n  name: \"field journal\"\n  description: \"Use this journal when you have completed the recipe to record your success. You can also keep exploring before you finish.\"\n  location: inventory\n  aliases: [\"journal\"]\n  takeable: true\n  droppable: false\n  use_give: true\n  weight: 0.1\nend"
    }
  ],
  "playerConfig": {
    "healthEnabled": true,
    "startingHealth": 100
  },
  "story": {
    "version": 1,
    "states": [
      {
        "id": "lesson_safe",
        "name": "safe",
        "description": "Progress remembered by this recipe.",
        "type": "boolean",
        "initial": false
      }
    ],
    "rules": [
      {
        "id": "lesson_gas",
        "name": "gas",
        "enabled": true,
        "trigger": {
          "kind": "room",
          "target": "lesson_tunnel",
          "event": "after_enter"
        },
        "match": "all",
        "conditions": [
          {
            "kind": "object_state",
            "target": "lesson_mask",
            "key": "worn",
            "operator": "==",
            "value": false
          }
        ],
        "actions": [
          {
            "kind": "health",
            "operation": "add",
            "value": -8
          },
          {
            "kind": "message",
            "value": "The gas burns your throat."
          }
        ],
        "otherwise": "",
        "once": false
      },
      {
        "id": "lesson_protected",
        "name": "protected",
        "enabled": true,
        "trigger": {
          "kind": "room",
          "target": "lesson_tunnel",
          "event": "after_enter"
        },
        "match": "all",
        "conditions": [
          {
            "kind": "object_state",
            "target": "lesson_mask",
            "key": "worn",
            "operator": "==",
            "value": true
          }
        ],
        "actions": [
          {
            "kind": "message",
            "value": "Gas swirls around you, but the mask protects your lungs."
          }
        ],
        "otherwise": "",
        "once": false
      },
      {
        "id": "lesson_safe",
        "name": "safe",
        "enabled": true,
        "trigger": {
          "kind": "room",
          "target": "lesson_safe",
          "event": "after_enter"
        },
        "match": "all",
        "conditions": [],
        "actions": [
          {
            "kind": "state",
            "target": "lesson_safe",
            "value": true
          },
          {
            "kind": "message",
            "value": "Clean air fills your lungs as you enter the safe room."
          }
        ],
        "otherwise": "",
        "once": true,
        "repeatText": "The safe room remains quiet and breathable."
      },
      {
        "id": "sample_finish",
        "name": "Record the completed expedition",
        "enabled": true,
        "trigger": {
          "kind": "object",
          "target": "sample_field_journal",
          "event": "use"
        },
        "match": "all",
        "conditions": [
          {
            "kind": "state",
            "target": "lesson_safe",
            "operator": "==",
            "value": true
          }
        ],
        "actions": [
          {
            "kind": "message",
            "value": "Automatic room events checked protection and remembered safety. You record the result in your field journal. Your expedition is complete."
          },
          {
            "kind": "score",
            "value": 100
          },
          {
            "kind": "end",
            "value": "Your expedition is complete."
          }
        ],
        "otherwise": "Your expedition is not complete yet. Follow the room clues, then use the field journal to record your success.",
        "once": true
      }
    ]
  },
  "cookbookRecipes": [
    {
      "version": 1,
      "settings": {
        "instance": "lesson",
        "recipeId": "15-use-room-events-as-invisible-systems",
        "choices": {
          "hall": {
            "existing": "",
            "name": "Tunnel Equipment Room",
            "description": "Take and wear the gas mask before going north."
          },
          "tunnel": {
            "existing": "",
            "name": "Gas Tunnel",
            "description": "The equipment room is south. A safe room is north."
          },
          "safe": {
            "existing": "",
            "name": "Clean Air Room",
            "description": "The gas tunnel is south."
          },
          "mask": {
            "existing": "",
            "name": "gas mask",
            "description": "Wear this to protect your lungs."
          }
        },
        "values": {
          "hurt": "The gas burns your throat.",
          "protected": "Gas swirls around you, but the mask protects your lungs.",
          "safe": "Clean air fills your lungs as you enter the safe room.",
          "repeat": "The safe room remains quiet and breathable.",
          "damage": 8,
          "enableHealth": true
        },
        "reuseRoutes": {}
      },
      "owned": [
        {
          "path": "files",
          "key": "rooms/lesson_hall.taml",
          "after": {
            "path": "rooms/lesson_hall.taml",
            "name": "lesson_hall.taml",
            "content": "room lesson_hall\n  exit north: lesson_tunnel\n  name: \"Tunnel Equipment Room\"\n  description: \"Take and wear the gas mask before going north.\"\n  dark: false\nend",
            "isDirty": true
          }
        },
        {
          "path": "files",
          "key": "rooms/lesson_tunnel.taml",
          "after": {
            "path": "rooms/lesson_tunnel.taml",
            "name": "lesson_tunnel.taml",
            "content": "room lesson_tunnel\n  exit north: lesson_safe\n  exit south: lesson_hall\n  name: \"Gas Tunnel\"\n  description: \"The equipment room is south. A safe room is north.\"\n  dark: false\nend",
            "isDirty": true
          }
        },
        {
          "path": "files",
          "key": "rooms/lesson_safe.taml",
          "after": {
            "path": "rooms/lesson_safe.taml",
            "name": "lesson_safe.taml",
            "content": "room lesson_safe\n  exit south: lesson_tunnel\n  name: \"Clean Air Room\"\n  description: \"The gas tunnel is south.\"\n  dark: false\nend",
            "isDirty": true
          }
        },
        {
          "path": "files",
          "key": "objects/lesson_mask.taml",
          "after": {
            "path": "objects/lesson_mask.taml",
            "name": "lesson_mask.taml",
            "content": "object lesson_mask\n  name: \"gas mask\"\n  description: \"Wear this to protect your lungs.\"\n  location: lesson_hall\n  takeable: true\n  wearable: true\n  weight: 0.1\nend",
            "isDirty": true
          }
        },
        {
          "path": "objects",
          "key": "lesson_mask",
          "after": {
            "id": "lesson_mask",
            "name": "gas mask",
            "description": "Wear this to protect your lungs.",
            "article": "",
            "location": "lesson_hall",
            "aliases": [],
            "visible": true,
            "takeable": true,
            "droppable": true,
            "useGive": false,
            "container": false,
            "switchable": false,
            "edible": false,
            "drinkable": false,
            "wearable": true,
            "weapon": false,
            "weight": 0.1,
            "locked": false,
            "lockKey": "",
            "events": []
          }
        },
        {
          "path": "mapRooms",
          "key": "lesson_hall",
          "after": {
            "id": "lesson_hall",
            "name": "Tunnel Equipment Room",
            "description": "Take and wear the gas mask before going north.",
            "reentryEnabled": false,
            "reentryDesc": "",
            "hint": "",
            "dark": false,
            "roomType": "regular",
            "x": 100,
            "y": 100,
            "width": 160,
            "height": 64,
            "color": "#000000",
            "blockedDescriptions": {}
          }
        },
        {
          "path": "mapRooms",
          "key": "lesson_tunnel",
          "after": {
            "id": "lesson_tunnel",
            "name": "Gas Tunnel",
            "description": "The equipment room is south. A safe room is north.",
            "reentryEnabled": false,
            "reentryDesc": "",
            "hint": "",
            "dark": false,
            "roomType": "regular",
            "x": 320,
            "y": 100,
            "width": 160,
            "height": 64,
            "color": "#000000",
            "blockedDescriptions": {}
          }
        },
        {
          "path": "mapRooms",
          "key": "lesson_safe",
          "after": {
            "id": "lesson_safe",
            "name": "Clean Air Room",
            "description": "The gas tunnel is south.",
            "reentryEnabled": false,
            "reentryDesc": "",
            "hint": "",
            "dark": false,
            "roomType": "regular",
            "x": 540,
            "y": 100,
            "width": 160,
            "height": 64,
            "color": "#000000",
            "blockedDescriptions": {}
          }
        },
        {
          "path": "mapExits",
          "key": "lesson_route_tunnel",
          "after": {
            "id": "lesson_route_tunnel",
            "fromRoom": "lesson_hall",
            "toRoom": "lesson_tunnel",
            "direction": "north",
            "locked": false
          }
        },
        {
          "path": "mapExits",
          "key": "lesson_route_back",
          "after": {
            "id": "lesson_route_back",
            "fromRoom": "lesson_tunnel",
            "toRoom": "lesson_hall",
            "direction": "south",
            "locked": false
          }
        },
        {
          "path": "mapExits",
          "key": "lesson_route_safe",
          "after": {
            "id": "lesson_route_safe",
            "fromRoom": "lesson_tunnel",
            "toRoom": "lesson_safe",
            "direction": "north",
            "locked": false
          }
        },
        {
          "path": "mapExits",
          "key": "lesson_route_return",
          "after": {
            "id": "lesson_route_return",
            "fromRoom": "lesson_safe",
            "toRoom": "lesson_tunnel",
            "direction": "south",
            "locked": false
          }
        },
        {
          "path": "manifest.story.states",
          "key": "lesson_safe",
          "after": {
            "id": "lesson_safe",
            "name": "safe",
            "description": "Progress remembered by this recipe.",
            "type": "boolean",
            "initial": false
          }
        },
        {
          "path": "manifest.story.rules",
          "key": "lesson_gas",
          "after": {
            "id": "lesson_gas",
            "name": "gas",
            "enabled": true,
            "trigger": {
              "kind": "room",
              "target": "lesson_tunnel",
              "event": "after_enter"
            },
            "match": "all",
            "conditions": [
              {
                "kind": "object_state",
                "target": "lesson_mask",
                "key": "worn",
                "operator": "==",
                "value": false
              }
            ],
            "actions": [
              {
                "kind": "health",
                "operation": "add",
                "value": -8
              },
              {
                "kind": "message",
                "value": "The gas burns your throat."
              }
            ],
            "otherwise": "",
            "once": false
          }
        },
        {
          "path": "manifest.story.rules",
          "key": "lesson_protected",
          "after": {
            "id": "lesson_protected",
            "name": "protected",
            "enabled": true,
            "trigger": {
              "kind": "room",
              "target": "lesson_tunnel",
              "event": "after_enter"
            },
            "match": "all",
            "conditions": [
              {
                "kind": "object_state",
                "target": "lesson_mask",
                "key": "worn",
                "operator": "==",
                "value": true
              }
            ],
            "actions": [
              {
                "kind": "message",
                "value": "Gas swirls around you, but the mask protects your lungs."
              }
            ],
            "otherwise": "",
            "once": false
          }
        },
        {
          "path": "manifest.story.rules",
          "key": "lesson_safe",
          "after": {
            "id": "lesson_safe",
            "name": "safe",
            "enabled": true,
            "trigger": {
              "kind": "room",
              "target": "lesson_safe",
              "event": "after_enter"
            },
            "match": "all",
            "conditions": [],
            "actions": [
              {
                "kind": "state",
                "target": "lesson_safe",
                "value": true
              },
              {
                "kind": "message",
                "value": "Clean air fills your lungs as you enter the safe room."
              }
            ],
            "otherwise": "",
            "once": true,
            "repeatText": "The safe room remains quiet and breathable."
          }
        },
        {
          "path": "manifest.playerConfig.healthEnabled",
          "key": "$value",
          "after": true
        },
        {
          "path": "manifest.playerConfig.startingHealth",
          "key": "$value",
          "after": 100
        }
      ]
    }
  ],
  "creatorNotes": "Entering a gas tunnel automatically checks whether the mask is actually worn and applies damage when it is not. Entering the safe room records arrival once and gives a shorter response on later visits.\nOpen Help → Cookbook → Use Room Events as Invisible Systems → Start this recipe to inspect its saved settings. The field journal and 100-point ending belong only to the sample game.\nCommands: take gas mask; north; south; wear gas mask; north; north; south; north; wait; use field journal",
  "mapRooms": [
    {
      "id": "lesson_hall",
      "name": "Tunnel Equipment Room",
      "description": "Take and wear the gas mask before going north.",
      "reentryEnabled": false,
      "reentryDesc": "",
      "hint": "",
      "dark": false,
      "roomType": "regular",
      "x": 100,
      "y": 100,
      "width": 160,
      "height": 64,
      "color": "#000000",
      "blockedDescriptions": {}
    },
    {
      "id": "lesson_tunnel",
      "name": "Gas Tunnel",
      "description": "The equipment room is south. A safe room is north.",
      "reentryEnabled": false,
      "reentryDesc": "",
      "hint": "",
      "dark": false,
      "roomType": "regular",
      "x": 320,
      "y": 100,
      "width": 160,
      "height": 64,
      "color": "#000000",
      "blockedDescriptions": {}
    },
    {
      "id": "lesson_safe",
      "name": "Clean Air Room",
      "description": "The gas tunnel is south.",
      "reentryEnabled": false,
      "reentryDesc": "",
      "hint": "",
      "dark": false,
      "roomType": "regular",
      "x": 540,
      "y": 100,
      "width": 160,
      "height": 64,
      "color": "#000000",
      "blockedDescriptions": {}
    }
  ],
  "mapExits": [
    {
      "id": "lesson_route_tunnel",
      "fromRoom": "lesson_hall",
      "toRoom": "lesson_tunnel",
      "direction": "north",
      "locked": false
    },
    {
      "id": "lesson_route_back",
      "fromRoom": "lesson_tunnel",
      "toRoom": "lesson_hall",
      "direction": "south",
      "locked": false
    },
    {
      "id": "lesson_route_safe",
      "fromRoom": "lesson_tunnel",
      "toRoom": "lesson_safe",
      "direction": "north",
      "locked": false
    },
    {
      "id": "lesson_route_return",
      "fromRoom": "lesson_safe",
      "toRoom": "lesson_tunnel",
      "direction": "south",
      "locked": false
    }
  ],
  "objects": [
    {
      "id": "lesson_mask",
      "name": "gas mask",
      "description": "Wear this to protect your lungs.",
      "article": "",
      "location": "lesson_hall",
      "aliases": [],
      "visible": true,
      "takeable": true,
      "droppable": true,
      "useGive": false,
      "container": false,
      "switchable": false,
      "edible": false,
      "drinkable": false,
      "wearable": true,
      "weapon": false,
      "weight": 0.1,
      "locked": false,
      "lockKey": "",
      "events": []
    },
    {
      "id": "sample_field_journal",
      "name": "field journal",
      "description": "Use this journal when you have completed the recipe to record your success. You can also keep exploring before you finish.",
      "article": "",
      "location": "inventory",
      "aliases": [
        "journal"
      ],
      "visible": true,
      "takeable": true,
      "droppable": false,
      "useGive": true,
      "container": false,
      "switchable": false,
      "edible": false,
      "drinkable": false,
      "wearable": false,
      "weapon": false,
      "weight": 0.1,
      "locked": false,
      "lockKey": "",
      "events": []
    }
  ],
  "npcs": [],
  "activeMechanics": [],
  "verbAliases": [],
  "scripts": [],
  "worldEvents": [],
  "customMechanicDefs": [],
  "savedMechanicTemplates": [],
  "objectiveSets": [],
  "gameOutliner": {},
  "customRoomTemplates": [],
  "customObjectTemplates": [],
  "customNpcTemplates": [],
  "customSavedScripts": [],
  "requiredCapabilities": [
    "story-rules-v1"
  ]
}
