Open tianyma opened 3 years ago
There's no utility to do this right now but I'd definitely accept a player management patch.
The "scrape-world" utility is a good place to start. It collects all the information from the vanilla Screeps lokidb and dumps it into xxscreeps: https://github.com/laverdet/xxscreeps/blob/main/src/scripts/scrape-world.ts
This is a little skeleton to get you started if you're interested.
import { RoomPosition } from 'xxscreeps/game/position';
import * as CodeSchema from 'xxscreeps/engine/db/user/code';
import * as User from 'xxscreeps/engine/db/user';
import { Database, Shard } from 'xxscreeps/engine/db';
import { Room } from 'xxscreeps/game/room/room';
import * as Spawn from 'xxscreeps/mods/spawn/spawn';
const shard = await Shard.connect(db, 'shard0');
const { data } = shard;
const userId = generateId(12);
const user = await User.create(db, userId, 'bot');
const room = await shard.loadRoom('W1N1');
const spawn = Spawn.create(new RoomPosition(25, 25, 'W1N1'), userId, 'Spawn1');
room['#insertObject'](spawn);
await shard.saveRoom(room);
await shard.save();
const modules = ...;
await CodeSchema.saveContent(db, userId, 'main', modules);
db.disconnect();
thank you, where do the bot scripts locate, can I modify them?
So a search in the screeps org after bot gives us the following places I think are relevant.
@laverdet I assume we would need something listening on the CLI host and an actual CLI implementation to get something in place for adding/removing bots? seems like it is backend-local that is responsible for starting both the gameserver and the cli server in vanilla screeps
I found there are four default bots inside xxscreeps, how can I add and delete the bot?