Skip to content
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

feat: add role names visualization to FlagManager #797

Open
wants to merge 1 commit into
base: Development
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions src/international/flags/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,76 @@ export class FlagManager {
flag.setColor(COLOR_GREEN)
room.roomManager.roomVisualsManager.internationalDataVisuals()
}
private roleNames(flagName: string, flagNameParts: string[]) {
const flag = Game.flags[flagName]
const roomName = flagNameParts[1] || flag.pos.roomName
const room = Game.rooms[roomName]
if (!room) {
flag.setColor(COLOR_RED)
return
}

flag.setColor(COLOR_GREEN)

// Sorry for hardcode but CreepRoles is a type! :p
const ROLES = [
'sourceHarvester',
'hauler',
'requestHauler',
'controllerUpgrader',
'builder',
'maintainer',
'mineralHarvester',
'hubHauler',
'fastFiller',
'meleeDefender',
'rangedDefender',
'remoteSourceHarvester',
'remoteReserver',
'remoteDefender',
'remoteCoreAttacker',
'remoteDismantler',
'remoteBuilder',
'scout',
'claimer',
'vanguard',
'allyVanguard',
'antifaRangedAttacker',
'antifaAttacker',
'antifaHealer',
'antifaDismantler',
'antifaDowngrader',
]

const height = 3 + ROLES.length
const data = ROLES.map(role => [role, ROLES.indexOf(role)])
const headers = ['Role', 'index']

Dashboard({
config: {
room: room.roomManager.room.name,
},
widgets: [
{
pos: {
x: 1,
y: 1,
},
width: 20,
height,
widget: Rectangle({
data: Table(() => ({
data,
config: {
label: 'Creep Roles',
headers,
},
})),
}),
},
],
})
}

private incomingTransactions(flagName: string, flagNameParts: string[]) {
const flag = Game.flags[flagName]
Expand Down
Loading