Formats Code
This commit is contained in:
@@ -2,8 +2,7 @@ export type RoleDefinition = {
|
||||
name: string;
|
||||
body: BodyPartConstant[];
|
||||
priority: number;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
export const CreepRoles = {
|
||||
harvester: {
|
||||
@@ -23,9 +22,6 @@ export const CreepRoles = {
|
||||
}
|
||||
} satisfies Record<string, RoleDefinition>;
|
||||
|
||||
|
||||
export type CreepRole = keyof typeof CreepRoles;
|
||||
|
||||
|
||||
|
||||
export type CreepRequisition = Record<CreepRole, number>;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { CreepRequisition } from "./creeps";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Configuration for the game, defining limits and minimum requirements for creeps.
|
||||
* Used to manage the overall game state and ensure proper role distribution.
|
||||
@@ -17,7 +15,6 @@ export type GameConfig = {
|
||||
minCreepsPerRole: CreepRequisition;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Default game configuration with maximum creeps and minimum creeps per role.
|
||||
* This configuration is used to initialize the game state and ensure that the game runs smoothly.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { RoleDefinition } from "types/creeps"
|
||||
import { RoleDefinition } from "types/creeps";
|
||||
|
||||
export const get_role_const = (role: RoleDefinition) => {
|
||||
return role.body.reduce((cost, part) => {
|
||||
cost += BODYPART_COST[part] || 0;
|
||||
return cost;
|
||||
}, 0)
|
||||
}
|
||||
}, 0);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user