using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ScriptData : ScriptableObject
{
	public enum Opcode : byte
	{
		DefFn,
		DefSaved,
		DefLocal,
		SetVar,
		PushVar,
		Return,
		JFalse,
		Jump,
		Says,
		WalksTo,
		HeadsFor,
		Exits,
		Waits,
		Starts,
		Stops,
		Uses,
		Drops,
		Receives,
		Toots,
		EntersVia,
		Enters,
		Not,
		StaysFocused,
		Has,
		ClearVar,
		Sees,
		LosesFocus,
		Opens,
		Closes,
	}

	[System.Flags]
	public enum DlgFlags : byte
	{
		None = 0,
		Caption = (1 << 0),
		First = (1 << 1),
		Second = (1 << 2),
		Third = (1 << 3),
		Nth = (1 << 4),
	}

	[System.Flags]
	public enum StorageFlags : byte
	{
		Local = 0,
		External = (1 << 0),
		Dynamic = (1 << 1),
	}

	[System.Serializable]
	public struct Symbol
	{
		public string type, name;
		public StorageFlags storage;
	};

	[System.Serializable]
	public class Function
	{
		public string name;
		public List<byte> bytes = new List<byte>();
		public List<int> lineTable = new List<int>();
	}

	[System.Serializable]
	public struct Condition
	{
		public ushort subject, obj;
		public Opcode verb;
		public ushort function;
	};


	public List<Function> functions = new List<Function>();
	public List<Condition> conditions = new List<Condition>();
	public List<string> strings = new List<string>();
	public List<Symbol> symbols = new List<Symbol>();
}
