main.go 840 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package main
  2. import (
  3. "errors"
  4. "log"
  5. "os"
  6. "git.red-green.com/david/dmmo"
  7. )
  8. func main() {
  9. var (
  10. idx *dmmo.Index
  11. err error
  12. )
  13. idx, err = dmmo.LoadIndex("index")
  14. if err != nil {
  15. if errors.Is(err, os.ErrNotExist) {
  16. idx = dmmo.NewIndex()
  17. idx.Set("void", "", "BLA ON BLA")
  18. idx.Set("player", "@", "GRE ON BLA")
  19. idx.Set("player-neutral", "@", "WHI ON BLA")
  20. idx.Set("player-ally", "@", "CYA ON BLA")
  21. idx.Set("player-enemy", "@", "MAG ON BLA")
  22. idx.Set("grass", ".", "GRE ON BLA")
  23. idx.Set("stone", ".", "WHI ON BLA")
  24. idx.Set("wall-stone-vertical", "|", "WHI ON BLA")
  25. idx.Set("wall-stone-horizontal", "-", "WHI ON BLA")
  26. idx.Set("door-closed", "+", "BRO ON BLA", false)
  27. idx.Set("door-opened", "-", "BRO ON BLA", false)
  28. err := idx.Save("index")
  29. if err != nil {
  30. log.Panicln(err)
  31. }
  32. }
  33. }
  34. }