Closed mjedynak closed 5 months ago
I don't know. How does arena work? Is there an api documentation? If it uses the same api as screeps (meaning this one https://docs.screeps.com/api/) then it will work otherwise probably not
@exaV The Arena API does look slightly different, but has a lot of similarities. It can be found here.
https://arena.screeps.com/docs/#arenaInfo
Worthy of note is that Screeps Arena does use a different module system and imports for the code. For example, here is the code I wrote for the construction part of the tutorial:
import { getObjectsByPrototype } from 'game/utils';
import { Creep, Source, StructureContainer } from 'game/prototypes';
import { ERR_NOT_IN_RANGE, RESOURCE_ENERGY } from 'game/constants';
import { } from 'arena';
import { createConstructionSite } from 'game/utils';
import { StructureTower } from 'game/prototypes';
let constructionSite = null;
export function loop() {
let source = getObjectsByPrototype(StructureContainer)[0];
if (!constructionSite) {
constructionSite = createConstructionSite({x: 50, y: 55}, StructureTower).object;
}
let creep = getObjectsByPrototype(Creep)[0];
if (creep.store.getFreeCapacity() > 0) {
console.log("Harvest");
if (creep.withdraw(source, RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) {
creep.moveTo(source);
}
} else if (creep.store.getUsedCapacity() > 0) {
console.log("Build");
if (creep.build(constructionSite) == ERR_NOT_IN_RANGE) {
creep.moveTo(constructionSite);
}
}
}
Is it possible to use the project in Screeps Arena?