-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add start mission button #96
base: main
Are you sure you want to change the base?
Conversation
093dcc7
to
7504132
Compare
b8a555e
to
f9c60d3
Compare
Much improved, thank you. Though I think we could push even more of that ts code you added to the mission page into the component. And it will have to be thoroughly tested by me and Rex for bugs. |
demilErrorMessage = `A room that can support more bombs is required. Current rooms only support up to ${bombCountError.MaximumSupportedBombsCount} bombs, and the mission has ${bombCountError.MissionBombsCount} bombs.`; | ||
demilHelpState = 'Error'; | ||
} else { | ||
toast.success(`Started mission ${missionResult.MissionID}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't use the mission ID but the mission name.
|
||
<Dialog bind:dialog> | ||
{#if typeof demilHelpState !== 'undefined'} | ||
<div class="block"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove this block element? It makes it look the dialog has a weird thick gray border around it.
let demilClient = new DeMiL.DeMiLClient(8095); | ||
async function startMission() { | ||
demilHelpState = undefined; | ||
try { | ||
const missionResult = await demilClient.startMissionByName(mission.name, steamID); | ||
demilVersion = !missionResult.IsVersionInRange ? missionResult.Version ?? '<2.1.0' : undefined; | ||
if (missionResult.hasOwnProperty('MissingModules')) { | ||
missingModules = (missionResult as DeMiL.StartMissionMissingModulesResult).MissingModules.map(mod => | ||
getModule(mod, modules) | ||
); | ||
demilHelpState = 'MissingModules'; | ||
} else if (missionResult.hasOwnProperty('MissionModulesCount')) { | ||
let moduleCountError = missionResult as DeMiL.StartMissionTooManyModulesResult; | ||
demilErrorMessage = `Failed to start mission. A bomb that can support more modules is required. Current bombs only support up to ${moduleCountError.MaximumSupportedModulesCount} modules, and the mission has ${moduleCountError.MissionModulesCount} modules.`; | ||
demilHelpState = 'Error'; | ||
} else if (missionResult.hasOwnProperty('MissionBombsCount')) { | ||
let bombCountError = missionResult as DeMiL.StartMissionTooManyBombsResult; | ||
demilErrorMessage = `A room that can support more bombs is required. Current rooms only support up to ${bombCountError.MaximumSupportedBombsCount} bombs, and the mission has ${bombCountError.MissionBombsCount} bombs.`; | ||
demilHelpState = 'Error'; | ||
} else { | ||
toast.success(`Started mission ${missionResult.MissionID}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think literally all of this from line 84 to 117 can be in the component instead of in the mission page code and you just pass it the mission object.
Resolves #91