Skip to content

Commit

Permalink
Add a couple more tests around accessing BOOSTS
Browse files Browse the repository at this point in the history
  • Loading branch information
tiennou committed Feb 26, 2024
1 parent 1911145 commit 3885aa1
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion dist/screeps-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1030,8 +1030,24 @@ function resources(o: GenericStore): ResourceConstant[] {
EXTENSION_ENERGY_CAPACITY[Game.rooms.myRoom.controller!.level];

REACTIONS[Object.keys(creep.carry)[0]];
}

{
// Test the BOOSTS constant

// Can be used with a body part, returns a record of mineral -> boosted property -> level
const c = BOOSTS[creep.body[0].type];

BOOSTS[creep.body[0].type];
// Can be used with all body part types, returns undefined
const undef = BOOSTS["claim"];

// Can still be iterated over
for (const bodyPart of Object.keys(BOOSTS) as BodyPartConstant[]) {
const boosts = BOOSTS[bodyPart];
for (const mineral of Object.keys(boosts) as MineralBoostConstant[]) {
const upgrades = boosts[mineral];
}
}
}

// Tombstones
Expand Down

0 comments on commit 3885aa1

Please sign in to comment.