fix: golems/utils.ts and equipment/utils.ts duplicate local constants instead of importing from index #40
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: Major
Files:
src/lib/game/data/golems/utils.ts(lines 8-13) — creates localGOLEMS_DEFby spreadingBASE_GOLEMS,ELEMENTAL_GOLEMS,HYBRID_GOLEMSsrc/lib/game/data/equipment/utils.ts(lines 13-24) — creates localEQUIPMENT_TYPESby spreading all equipment category arraysProblem: Both files recreate their respective definition constants locally instead of importing from their
./index.tsbarrel files. This creates a maintenance risk — if a new golem category or equipment category is added to the index but not to the local spread in utils, the utility functions won't see the new entries.Impact: New golem or equipment types added to the index won't be visible to utility functions like
getGolemDef(),getAvailableDrops(), etc. Silent data loss.Fix: Import from the index files instead:
[priority: 3] DATA/LOGIC BUG — golems/utils.ts and equipment/utils.ts duplicate local constants instead of importing from index.
Starting work on #40. Will fix golems/utils.ts and equipment/utils.ts to import from index instead of duplicating constants.
Fixed. Updated golems/utils.ts to import GOLEMS_DEF from './index' instead of locally spreading BASE/ELEMENTAL/HYBRID_GOLEMS. Updated equipment/utils.ts to import EQUIPMENT_TYPES from './index' instead of locally spreading all equipment category arrays.