diff options
| author | historia <[not public]> | 2026-06-30 03:57:52 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-30 03:57:52 -0400 |
| commit | 712072209ab5e3b3a14ebc0c770b020afe544560 (patch) | |
| tree | f5247fa8e03ed327ecb6cbff622bf6bdccb2066c /internal/admin/api_search.go | |
| parent | 7a4b91304061777e7b3365b505d1e74878043d35 (diff) | |
| download | thehouseoficarus-712072209ab5e3b3a14ebc0c770b020afe544560.tar.gz | |
feat: all admin mapping features working
Diffstat (limited to 'internal/admin/api_search.go')
| -rw-r--r-- | internal/admin/api_search.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/admin/api_search.go b/internal/admin/api_search.go index d47dc0e..3367a52 100644 --- a/internal/admin/api_search.go +++ b/internal/admin/api_search.go @@ -28,6 +28,7 @@ func (s *AdminServer) handleSearch(w http.ResponseWriter, r *http.Request) { Items []searchResult `json:"items"` Mobs []searchResult `json:"mobs"` Objects []searchResult `json:"objects"` + Hazards []searchResult `json:"hazards"` } var resp searchResponse @@ -78,5 +79,16 @@ func (s *AdminServer) handleSearch(w http.ResponseWriter, r *http.Request) { } } + hazardIDs, _ := listYAMLFiles(s.dataDir, "hazards") + for _, id := range hazardIDs { + h, err := s.world.LoadHazard(id) + if err != nil { + continue + } + if strings.Contains(strings.ToLower(h.Name), q) || strings.Contains(strings.ToLower(id), q) { + resp.Hazards = append(resp.Hazards, searchResult{ID: id, Name: h.Name}) + } + } + writeJSON(w, resp) } |
