import { Plus, Trash2 } from 'lucide-react'; import type { NPCConfiguration, MoLangConfigVariable } from '../types/npc'; interface ConfigVariablesEditorProps { config: NPCConfiguration; onChange: (config: NPCConfiguration) => void; } export function ConfigVariablesEditor({ config, onChange }: ConfigVariablesEditorProps) { const addVariable = () => { const newVariable: MoLangConfigVariable = { variableName: '', displayName: '', description: '', type: 'TEXT', defaultValue: '' }; onChange({ ...config, config: [...config.config, newVariable] }); }; const removeVariable = (index: number) => { onChange({ ...config, config: config.config.filter((_, i) => i !== index) }); }; const updateVariable = (index: number, field: keyof MoLangConfigVariable, value: any) => { const newConfig = [...config.config]; newConfig[index] = { ...newConfig[index], [field]: value }; onChange({ ...config, config: newConfig }); }; return (
Configuration variables allow for customizable NPC behavior through MoLang expressions. These variables can be referenced in dialogues, scripts, and other configurations.
{config.config.length === 0 ? (Internal identifier for the variable
Human-readable name shown in UI
Data type for the variable
Initial value for the variable