horsegen: generate races

This commit is contained in:
2026-01-30 23:25:44 -05:00
parent 9dd18ed972
commit 34edcf97a7
11 changed files with 4316 additions and 646 deletions

32
horsegen/race.go.template Normal file
View File

@@ -0,0 +1,32 @@
{{- define "go-race" -}}
package {{ $.Region }}
// Automatically generated with horsegen; DO NOT EDIT
import . "git.sunturtle.xyz/zephyr/horse/horse"
const (
{{- range $r := $.Races }}
Race{{ goenum $r.Name }}{{ if ne $r.Primary $r.ID }}Alternate{{ end }} RaceID = {{ $r.ID }} // {{ $r.Name }}
{{- end }}
)
var AllRaces = map[RaceID]Race{
{{- range $r := $.Races }}
Race{{ goenum $r.Name }}{{ if ne $r.Primary $r.ID }}Alternate{{ end }}: {
ID: {{ $r.ID }},
Name: {{ printf "%q" $r.Name }}{{ if ne $r.Primary $r.ID }} + " (Alternate)"{{ end }},
Thumbnail: {{ $r.ThumbnailID }},
{{- if ne $r.Primary $r.ID }}
Primary: {{ $r.Primary }},
{{- end }}
},
{{- end }}
}
var RaceNameToID = map[string]RaceID{
{{- range $r := $.Races }}
{{ printf "%q" $r.Name }}{{ if ne $r.Primary $r.ID }} + " (Alternate)"{{ end }}: {{ $r.ID }},
{{- end }}
}
{{ end }}