index : btroops | |
Virtual board game-aid for BattleTroops, an infantry combat simulator wargame published by FASA in 1989. |
aboutsummaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/game/firing_arc.js (renamed from src/modules/game/firingArc.js) | 0 | ||||
-rw-r--r-- | src/modules/game/sight_line.js (renamed from src/modules/game/sightLine.js) | 3 | ||||
-rw-r--r-- | src/modules/game/soldier.js (renamed from src/modules/game/counter.js) | 0 | ||||
-rw-r--r-- | src/modules/gameboard.js (renamed from src/modules/game.js) | 36 | ||||
-rw-r--r-- | src/modules/pan-zoom.js (renamed from src/modules/panzoom.js) | 0 | ||||
-rw-r--r-- | src/modules/record_sheet.js (renamed from src/modules/recordSheet.js) | 0 |
6 files changed, 19 insertions, 20 deletions
diff --git a/src/modules/game/firingArc.js b/src/modules/game/firing_arc.js index 817bc44..817bc44 100644 --- a/src/modules/game/firingArc.js +++ b/src/modules/game/firing_arc.js diff --git a/src/modules/game/sightLine.js b/src/modules/game/sight_line.js index 6b94514..411faa8 100644 --- a/src/modules/game/sightLine.js +++ b/src/modules/game/sight_line.js @@ -83,6 +83,7 @@ let sightLine, lockTarget, export function create({ x: x1, y: y1 }, { x: x2, y: y2 }) { const line = document.createElementNS(svgns, 'line'); + sightLine = line; line.classList.add('sight-line'); line.classList.add(activeClassName); @@ -91,8 +92,6 @@ export function create({ x: x1, y: y1 }, { x: x2, y: y2 }) { line.setAttributeNS(null, 'x2', x2); line.setAttributeNS(null, 'y2', y2); - sightLine = line; - return line; } diff --git a/src/modules/game/counter.js b/src/modules/game/soldier.js index 0d75fc6..0d75fc6 100644 --- a/src/modules/game/counter.js +++ b/src/modules/game/soldier.js diff --git a/src/modules/game.js b/src/modules/gameboard.js index e66f126..9f8723e 100644 --- a/src/modules/game.js +++ b/src/modules/gameboard.js @@ -1,6 +1,6 @@ -import * as firingArc from './game/firingArc.js'; -import * as sightLine from './game/sightLine.js'; -import * as counterMod from './game/counter.js'; +import * as firingArc from './game/firing_arc.js'; +import * as sightLine from './game/sight_line.js'; +import * as soldier from './game/soldier.js'; function getCellContents(cell) { return cell.querySelectorAll('*:not(use[href="#hex"])'); @@ -141,7 +141,7 @@ export function start(el) { if (isGrenade(toPlace)) { state.hex.after(toPlace); } else if (toPlace && !state.occupant) { - counterMod.place(svg, toPlace, cell); + soldier.place(svg, toPlace, cell); placing.push(toPlace); const lockedSl = getLockedSightLine(svg); @@ -153,11 +153,11 @@ export function start(el) { } else if (toPlace && state.occupant) { if (toPlace === state.occupant) { if ('previous' in toPlace.dataset) { - const trace = counterMod.getTrace(svg, toPlace); + const trace = soldier.getTrace(svg, toPlace); toPlace.remove(); toPlace = getCounterAtGridIndex(...toPlace.dataset.previous.split(',')); toPlace.classList.remove('clone'); - toPlace.classList.add(counterMod.getSelectedClass()); + toPlace.classList.add(soldier.getSelectedClass()); if (!('previous' in toPlace.dataset)) { trace.remove(); } else { @@ -182,11 +182,11 @@ export function start(el) { if (isClone(state.occupant).of(toPlace)) { if (!('previous' in state.occupant.dataset)) { state.occupant.classList.remove('clone'); - state.occupant.classList.add(counterMod.getSelectedClass()); + state.occupant.classList.add(soldier.getSelectedClass()); toPlace.remove(); toPlace = state.occupant; - counterMod.removeClones(svg, toPlace); - counterMod.getTrace(svg, toPlace).remove(); + soldier.removeClones(svg, toPlace); + soldier.getTrace(svg, toPlace).remove(); const lockedSl = getLockedSightLine(svg); if (!lockedSl) { @@ -196,7 +196,7 @@ export function start(el) { } } else { const index = getGridIndex(state.occupant), - trace = counterMod.getTrace(svg, toPlace), + trace = soldier.getTrace(svg, toPlace), pos = getCellPosition(cell), points = trace.getAttribute('points').split(' ').filter(p => p != `${pos.x},${pos.y}`).join(' ');; @@ -277,20 +277,20 @@ export function start(el) { }); // debug - const c = counterMod.getCounter(svg, { dataset: { allegiance: 'davion', number: '1' }}); - counterMod.place(svg, c, getCell(17, 25)); + const c = soldier.getCounter(svg, { dataset: { allegiance: 'davion', number: '1' }}); + soldier.place(svg, c, getCell(17, 25)); select(c); } export function select(selected) { - const counter = counterMod.getCounter(svg, selected); + const counter = soldier.getCounter(svg, selected); if (counter) { unSelect(); placing.push(counter); - counter.classList.add(counterMod.getSelectedClass()); + counter.classList.add(soldier.getSelectedClass()); firingArc.get(svg, counter).forEach(el => el.removeAttribute('clip-path')); - selectCallback && selectCallback({ prone: counterMod.hasProne(counter), ...counter.dataset }); + selectCallback && selectCallback({ prone: soldier.hasProne(counter), ...counter.dataset }); } } @@ -299,7 +299,7 @@ export function unSelect() { if (selected) { placing = []; - getSelected().classList.remove(counterMod.getSelectedClass()); + getSelected().classList.remove(soldier.getSelectedClass()); clearSightLine(); firingArc.clipAll(svg); } @@ -309,7 +309,7 @@ export function endMove() { const selected = getSelected(); if (selected) { - counterMod.endMove(svg, selected); + soldier.endMove(svg, selected); unSelect(); } } @@ -323,7 +323,7 @@ export function toggleProne() { isOnBoard = selected && selected.parentElement.hasAttribute('data-x'); if (selected && isOnBoard) { - counterMod.toggleProne(selected); + soldier.toggleProne(selected); } } diff --git a/src/modules/panzoom.js b/src/modules/pan-zoom.js index 86f6727..86f6727 100644 --- a/src/modules/panzoom.js +++ b/src/modules/pan-zoom.js diff --git a/src/modules/recordSheet.js b/src/modules/record_sheet.js index 99af18f..99af18f 100644 --- a/src/modules/recordSheet.js +++ b/src/modules/record_sheet.js |