-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Import JSON does not work #2
Comments
@NesCafe62 I don't know if you're still playing Screeps, but I also encountered this bug and managed to make a quick and dirty fix. You have to modify https://github.com/admon84/screeps-room-planner/blob/main/src/components/actions/ImportFromJson.tsx as follows:
change to import { Point, RoomStructuresJson } from '@/types'; https://github.com/admon84/screeps-room-planner/blob/main/src/components/actions/ImportFromJson.tsx#L62-L68 Object.entries(json.structures).forEach(([structure, positions]) => {
positions.forEach((pos) => {
let point = pos as Point;
let shortPoint = point.x + "-" + point.y;
const tile = getTileForShort(shortPoint);
addTileStructure(tile, structure);
addStructurePosition(structure, shortPoint);
});
}); The bug is that the JSON import functionality assumes that the string it's parsing is in the custom shorthand notation the repo author chose to use in https://github.com/admon84/screeps-room-planner/blob/main/src/utils/constants.ts#L185. |
yep, I'm still playing screeps. good that you managed to find the correct fix. though I just used online version hosted here https://screeps-room-planner.vercel.app/ maybe we could sumbit a pull request with this fix |
Steps to reproduce:
Expected result: Correctly leaded structures plan
Actual result: Nothing happens
Tested in: Firefox Debeloper Edition 123.0b6 x64
Devtools console prints this error:
Uncaught TypeError: e.split is not a function
The text was updated successfully, but these errors were encountered: