mortar_language 0.1.0

A Domain Specific Language designed for game dialogue and text event systems.
{
  "metadata": {
    "version": "0.1.0",
    "generated_at": "2025-11-04T13:50:48.173483324+00:00"
  },
  "nodes": [
    {
      "name": "start",
      "texts": [
        {
          "text": "你好呀,欢迎阅读这个互动故事。",
          "events": [
            {
              "index": 0,
              "actions": [
                {
                  "type": "play_sound",
                  "args": [
                    "greeting.wav"
                  ]
                }
              ]
            },
            {
              "index": 6,
              "actions": [
                {
                  "type": "set_animation",
                  "args": [
                    "wave"
                  ]
                },
                {
                  "type": "play_sound",
                  "args": [
                    "wave_sound.wav"
                  ]
                }
              ]
            },
            {
              "index": 17,
              "actions": [
                {
                  "type": "set_color",
                  "args": [
                    "#FF6B6B"
                  ]
                }
              ]
            }
          ]
        },
        {
          "text": "我想你的名字是 {get_name()},对不?",
          "events": [
            {
              "index": 4.2,
              "actions": [
                {
                  "type": "set_color",
                  "args": [
                    "#33CCFF"
                  ]
                }
              ]
            },
            {
              "index": 10.8,
              "actions": [
                {
                  "type": "set_color",
                  "args": [
                    "#FF6B6B"
                  ]
                }
              ]
            }
          ]
        },
        {
          "text": "太好啦,我们走!"
        }
      ],
      "next": "choice_point"
    },
    {
      "name": "choice_point",
      "texts": [
        {
          "text": "你想干点啥?"
        },
        {
          "text": "我真服了。那咱就先结束对话吧。"
        }
      ],
      "choice": [
        {
          "text": "探索森林",
          "next": "forest_scene"
        },
        {
          "text": "留在城里",
          "condition": {
            "type": "has_map"
          },
          "next": "town_scene"
        },
        {
          "text": "查看背包",
          "condition": {
            "type": "has_backpack"
          },
          "next": "inventory"
        },
        {
          "text": "吃点什么",
          "choice": [
            {
              "text": "Apple",
              "next": "eat_apple"
            },
            {
              "text": "Bread",
              "next": "eat_bread"
            }
          ]
        },
        {
          "text": "别朝我叭叭了!!",
          "action": "return"
        },
        {
          "text": "我不到啊……",
          "action": "break"
        }
      ]
    }
  ],
  "functions": [
    {
      "name": "play_sound",
      "params": [{ "name": "file_name", "type": "String" }]
    },
    {
      "name": "set_animation",
      "params": [{ "name": "anim_name", "type": "String" }]
    },
    {
      "name": "set_color",
      "params": [{ "name": "value", "type": "String" }]
    },
    {
      "name": "get_name",
      "return": "String"
    }
  ]
}