Add ability to deactivate/reactivate soldier records; make hex clearing work with right-click and add a confirmation modal dialog

This commit is contained in:
2025-06-16 22:41:33 -07:00
parent 264dd1ab3f
commit e0bddbb263
5 changed files with 97 additions and 97 deletions

View File

@@ -145,7 +145,7 @@ async function load() {
document.querySelectorAll('.end-turn').forEach(el =>
el.addEventListener('click', ({ target: { dataset: { allegiance: opponent }}}) => {
const dataSelector = `[data-allegiance="${opponent}"]`,
opponentRecords = Array.from(document.querySelectorAll(`.soldier-record${dataSelector}`)),
opponentRecords = Array.from(document.querySelectorAll(`.soldier-record${dataSelector}:not(.inactive)`)),
firstOpponentRecord = opponentRecords.sort((el1, el2) => el1.dataset.number > el2.dataset.number).at(0);
el.setAttribute('disabled', '');
@@ -154,7 +154,11 @@ document.querySelectorAll('.end-turn').forEach(el =>
clearMoveEndedIndicators(opponentRecords);
gameboard.clearFiringArcs(opponent);
Observable.notify('select', firstOpponentRecord);
if (firstOpponentRecord) {
Observable.notify('select', firstOpponentRecord);
firstOpponentRecord.scrollIntoView({ behavior: 'smooth' });
}
})
);