package catalogs import ( "encoding/json" "os" "path/filepath" "sync" ) var _ = json.RawMessage{} var _ = sync.Mutex{} var _ = os.ReadFile var _ = filepath.Join // // The 40 m grid → sector map the client's Gadget streaming needs, taken from // AnantaGadgetLoader's own runtime export (src/cells.json, "runtime export from 4229938 // client": 5,116 cells, variable-length sector lists — 4,858 outdoor cells carry the single // sector 0, ~333 cells carry hashed interior sector ids and some carry 2-5 sectors). // Why it matters: SyncGadgetGridAOIDecrease takes ONE sector list per message, so cells // with different sectors cannot ride in the same push. The loader's author proved this — // sectorIdList=[0] loads outdoor props only, indoor furniture needs the interior ids. // A missing cell is not an error: the caller falls back to sector 0 (outdoor), which keeps the // channel alive instead of silently dropping that part of the map. // var ( GadgetCellsCatalog4229938_cacheLock sync.RWMutex GadgetCellsCatalog4229938_cached = false GadgetCellsCatalog4229938_entries []any ) // LoadGadgetCellsCatalog4229938 loads catalog records from client config directory func LoadGadgetCellsCatalog4229938(configDir string) ([]any, error) { GadgetCellsCatalog4229938_cacheLock.RLock() if GadgetCellsCatalog4229938_cached { defer GadgetCellsCatalog4229938_cacheLock.RUnlock() return GadgetCellsCatalog4229938_entries, nil } GadgetCellsCatalog4229938_cacheLock.RUnlock() GadgetCellsCatalog4229938_cacheLock.Lock() defer GadgetCellsCatalog4229938_cacheLock.Unlock() if GadgetCellsCatalog4229938_cached { return GadgetCellsCatalog4229938_entries, nil } filePath := filepath.Join(configDir, "GadgetCellsCatalog.json.json") data, err := os.ReadFile(filePath) if err != nil { return nil, err } var raw struct { Records []json.RawMessage `json:"records"` } if err := json.Unmarshal(data, &raw); err != nil { return nil, err } var result []any for _, item := range raw.Records { var m map[string]any if err := json.Unmarshal(item, &m); err == nil { result = append(result, m) } } GadgetCellsCatalog4229938_entries = result GadgetCellsCatalog4229938_cached = true return result, nil } // Sector ids for one 40 m cell; falls back to the outdoor sector when unmapped. func GadgetCellsCatalog4229938_SectorsOf(cx int32, cz int32) []int32 { // Catalog helper GadgetCellsCatalog4229938_SectorsOf return nil } // True when the cell carries any non-outdoor sector (used to shrink the radius indoors). func GadgetCellsCatalog4229938_IsInteriorCell(cx int32, cz int32) bool { // Catalog helper GadgetCellsCatalog4229938_IsInteriorCell return false }