From 71724cc97967a876224d1a4b711843b17256cb0d Mon Sep 17 00:00:00 2001
From: Catalin Mititiuc
Date: Tue, 2 Jul 2024 15:19:17 -0700
Subject: WIP: counters
---
src/modules/game/soldier.js | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
(limited to 'src/modules/game')
diff --git a/src/modules/game/soldier.js b/src/modules/game/soldier.js
index f9c67db..fc3d113 100644
--- a/src/modules/game/soldier.js
+++ b/src/modules/game/soldier.js
@@ -1,3 +1,5 @@
+import counters from './assets/images/counters.svg';
+
const selectedClass = 'selected';
function dataSelector({ dataset: { allegiance, number }}) {
@@ -53,15 +55,15 @@ function createTrace(previous, current, selected) {
return trace;
}
-export function createCounter(selected) {
+export function createCounter(selected, weapon = 'rifle') {
const use = document.createElementNS(svgns, 'use');
const g = document.createElementNS(svgns, 'g');
- // use.setAttributeNS(null, 'href', `#t-${selected.dataset.number}`);
- use.setAttributeNS(null, 'href', `counters.svg#rifle`);
+ use.setAttributeNS(null, 'href', `../../${counters}#${weapon}`);
use.classList.add('primary-weapon');
g.classList.add('counter');
g.dataset.allegiance = selected.dataset.allegiance;
g.dataset.number = selected.dataset.number;
+ g.dataset.squad = selected.dataset.squad;
g.appendChild(use);
return g;
--
cgit v1.2.3