Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCatalin Mititiuc <webdevcat@proton.me>2024-05-30 15:51:47 -0700
committerCatalin Mititiuc <webdevcat@proton.me>2024-05-30 17:14:25 -0700
commita49c0caff2d8d76941eaceeddb871c20977b7080 (patch)
treeb91a28425daf8ce95d38c8df31b821c0e7dfe9bf
parent981cc566f05a2c517aef8657bad605477d519b48 (diff)
Build scenario files
-rw-r--r--esbuild-server.mjs63
-rw-r--r--public/assets/images/counters.svg24
-rw-r--r--public/assets/images/scenario-dragon_hunting.svg149
-rw-r--r--public/assets/images/scenario-race_against_time.svg103
-rw-r--r--public/assets/images/scenario-side_show.svg148
5 files changed, 209 insertions, 278 deletions
diff --git a/esbuild-server.mjs b/esbuild-server.mjs
index c43bd68..13cca8b 100644
--- a/esbuild-server.mjs
+++ b/esbuild-server.mjs
@@ -124,36 +124,49 @@ const resolveImportedSvg = {
});
build.onLoad({ filter: /\.svg$/ }, async (args) => {
- const documentText = await fs.promises.readFile(args.path, 'utf8');
- const mapsheetsText = await fs.promises.readFile('/usr/src/app/public/assets/images/mapsheets.svg', 'utf8');
-
- // const fromFile = JSDOM.fromFile(args.path).then(dom => {
- // console.log('fromFile', dom.serialize());
- // });
-
- const dom = new JSDOM(documentText);
- const document = dom.window.document;
- const doc = (new JSDOM(mapsheetsText)).window.document;
- const refs = [];
-
- document.querySelectorAll('use[href*=".svg"').forEach(el => {
- const fragId = el.getAttributeNS(null, 'href').split('.svg').pop();
- const frag = doc.querySelector(fragId);
- frag.querySelectorAll('use').forEach(el => refs.push(el.getAttributeNS(null, 'href')));
- if (el.style.transform) frag.style.transform = el.style.transform;
- el.replaceWith(frag);
+ const document = (await JSDOM.fromFile(args.path)).window.document;
+ const externalResourceUseEls = Array.from(document.querySelectorAll('use[href*=".svg"'));
+ const readFiles = {};
+
+ const files = [...new Set([...externalResourceUseEls.map(el =>
+ el.getAttributeNS(null, 'href').match(/.+\.svg/).at(0)
+ )])];
+
+ await Promise.all(files.map((filename) =>
+ JSDOM
+ .fromFile(path.join(path.dirname(args.path), filename))
+ .then(dom => readFiles[filename] = dom.window.document)
+ ));
+
+ const refs = {};
+
+ externalResourceUseEls.forEach(el => {
+ const href = el.getAttributeNS(null, 'href');
+ const [filename] = href.match(/.+\.svg/);
+ const fragId = href.split('.svg').pop();
+ const frag = readFiles[filename].querySelector(fragId);
+
+ if (frag) {
+ frag.querySelectorAll('use').forEach(el =>
+ (refs[filename] ??= []).push(el.getAttributeNS(null, 'href'))
+ );
+
+ (refs[filename] ??= []).push(fragId);
+ el.setAttributeNS(null, 'href', fragId);
+ }
});
- const refsQuery = [...new Set([...refs])].join(', ');
- const refNodes = doc.querySelectorAll(refsQuery);
- const defs = document.querySelector('defs');
-
- refNodes.forEach(n => defs.appendChild(n));
+ Object.keys(refs).forEach(filename => {
+ const refsQuery = [...new Set([...refs[filename]])].join(', ');
+ const refNodes = readFiles[filename].querySelectorAll(refsQuery);
+ const defs = document.querySelector('defs');
+ refNodes.forEach(n => defs.appendChild(n));
+ });
return {
- contents: '<?xml version="1.0" standalone="no"?>' + document.querySelector('svg').outerHTML,
+ contents: `<?xml version="1.0" standalone="no"?>\n${document.querySelector('svg').outerHTML}`,
loader: 'file',
- watchFiles: ['/usr/src/app/public/assets/images/mapsheets.svg']
+ watchFiles: Object.keys(readFiles).map(filename => path.join(path.dirname(args.path), filename))
}
});
}
diff --git a/public/assets/images/counters.svg b/public/assets/images/counters.svg
index 85936d0..238b2ec 100644
--- a/public/assets/images/counters.svg
+++ b/public/assets/images/counters.svg
@@ -7,28 +7,28 @@
<use style="r: inherit;" href="#counter-base"/>
<text style="fill: var(--text-fill); transform: translateY(var(--translateY))">1</text>
</g>
- <g id="number-2">
- <use href="#counter-base"/>
+ <g style="r: inherit;" id="number-2">
+ <use style="r: inherit;" href="#counter-base"/>
<text style="fill: var(--text-fill); transform: translateY(var(--translateY))">2</text>
</g>
- <g id="number-3">
- <use href="#counter-base"/>
+ <g style="r: inherit;" id="number-3">
+ <use style="r: inherit;" href="#counter-base"/>
<text style="fill: var(--text-fill); transform: translateY(var(--translateY))">3</text>
</g>
- <g id="number-4">
- <use href="#counter-base"/>
+ <g style="r: inherit;" id="number-4">
+ <use style="r: inherit;" href="#counter-base"/>
<text style="fill: var(--text-fill); transform: translateY(var(--translateY))">4</text>
</g>
- <g id="number-5">
- <use href="#counter-base"/>
+ <g style="r: inherit;" id="number-5">
+ <use style="r: inherit;" href="#counter-base"/>
<text style="fill: var(--text-fill); transform: translateY(var(--translateY))">5</text>
</g>
- <g id="number-6">
- <use href="#counter-base"/>
+ <g style="r: inherit;" id="number-6">
+ <use style="r: inherit;" href="#counter-base"/>
<text style="fill: var(--text-fill); transform: translateY(var(--translateY))">6</text>
</g>
- <g id="number-7">
- <use href="#counter-base"/>
+ <g style="r: inherit;" id="number-7">
+ <use style="r: inherit;" href="#counter-base"/>
<text style="fill: var(--text-fill); transform: translateY(var(--translateY))">7</text>
</g>
diff --git a/public/assets/images/scenario-dragon_hunting.svg b/public/assets/images/scenario-dragon_hunting.svg
index 4443568..e456f27 100644
--- a/public/assets/images/scenario-dragon_hunting.svg
+++ b/public/assets/images/scenario-dragon_hunting.svg
@@ -1,5 +1,5 @@
<?xml version="1.0" standalone="no"?>
-<svg viewBox="-15.639999389648438 -129.2300262451172 2320.879638671875 4871.5654296875" xmlns="http://www.w3.org/2000/svg">
+<svg viewBox="-10 -10 200 300" xmlns="http://www.w3.org/2000/svg">
<link xmlns="http://www.w3.org/1999/xhtml" rel="stylesheet" href="../css/map.css" type="text/css" />
<style>
g[data-edge="north"] { --i: -2; }
@@ -44,69 +44,6 @@
<use x="-8.66" style="transform-origin: -8.66px 0;" class="ccw-60-deg" href="#ast-line"/>
</pattern>
- <circle id="counter-base" style="r: inherit; stroke: none;" cx="0" cy="0" r="5"/>
-
- <g style="r: inherit;" id="number-1">
- <use style="r: inherit;" href="#counter-base"/>
- <text style="fill: var(--text-fill); transform: translateY(var(--translateY))">1</text>
- </g>
- <g id="number-2">
- <use href="#counter-base"/>
- <text style="fill: var(--text-fill); transform: translateY(var(--translateY))">2</text>
- </g>
- <g id="number-3">
- <use href="#counter-base"/>
- <text style="fill: var(--text-fill); transform: translateY(var(--translateY))">3</text>
- </g>
- <g id="number-4">
- <use href="#counter-base"/>
- <text style="fill: var(--text-fill); transform: translateY(var(--translateY))">4</text>
- </g>
- <g id="number-5">
- <use href="#counter-base"/>
- <text style="fill: var(--text-fill); transform: translateY(var(--translateY))">5</text>
- </g>
- <g id="number-6">
- <use href="#counter-base"/>
- <text style="fill: var(--text-fill); transform: translateY(var(--translateY))">6</text>
- </g>
- <g id="number-7">
- <use href="#counter-base"/>
- <text style="fill: var(--text-fill); transform: translateY(var(--translateY))">7</text>
- </g>
-
- <g id="semi-auto">
- <line x1="-2" y1="1" x2="2" y2="1"/>
- <line x1="-2" y1="2" x2="2" y2="2"/>
- </g>
-
- <g id="auto">
- <line x1="-2" y1="0" x2="2" y2="0"/>
- <line x1="-2" y1="1" x2="2" y2="1"/>
- <line x1="-2" y1="2" x2="2" y2="2"/>
- </g>
-
- <g id="rifle" style="r: inherit;" class="weapon-symbol">
- <use style="r: inherit;" href="#counter-base"/>
- <use href="#semi-auto"/>
- <line x1="0" y1="-5" x2="0" y2="5"/>
- <polyline style="fill: none;" points="-2,-3.5 0,-5 2,-3.5"/>
- </g>
-
- <g id="smg" style="r: inherit;" class="weapon-symbol">
- <use style="r: inherit;" href="#counter-base"/>
- <use href="#auto"/>
- <line x1="0" y1="-5" x2="0" y2="4.5"/>
- <line x1="-2" y1="4.5" x2="2" y2="4.5"/>
- </g>
-
- <g id="blazer" style="r: inherit;" class="weapon-symbol">
- <use style="r: inherit;" href="#counter-base"/>
- <use href="#auto"/>
- <polyline points="0,-5 0,-3 -3,-2.5 3,-1.5 0,-1 0,2.5 -3,3, 3,4 0,4.5 0,5"/>
- <polyline points="-2,-3.5 0,-5 2,-3.5"/>
- </g>
-
<image id="counter-prone" href="counter_prone.jpg" width="10"/>
<image id="counter-grenade" href="counter_grenade.jpg" width="10"/>
</defs>
@@ -129,51 +66,51 @@
<g data-edge="north">
<g data-x="13">
<g class="counter" data-allegiance="attacker" data-number="1">
- <use class="primary-weapon" href="#blazer"/>
- <use class="troop-number" href="#number-1"/>
- <use class="squad-number" href="#number-1"/>
+ <use class="primary-weapon" href="counters.svg#blazer"/>
+ <use class="troop-number" href="counters.svg#number-1"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
</g>
</g>
<g data-x="14">
<g class="counter" data-allegiance="attacker" data-number="2">
- <use class="primary-weapon" href="#rifle"/>
- <use class="troop-number" href="#number-2"/>
- <use class="squad-number" href="#number-1"/>
+ <use class="primary-weapon" href="counters.svg#rifle"/>
+ <use class="troop-number" href="counters.svg#number-2"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
</g>
</g>
<g data-x="15">
<g class="counter" data-allegiance="attacker" data-number="3">
- <use class="primary-weapon" href="#rifle"/>
- <use class="troop-number" href="#number-3"/>
- <use class="squad-number" href="#number-1"/>
+ <use class="primary-weapon" href="counters.svg#rifle"/>
+ <use class="troop-number" href="counters.svg#number-3"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
</g>
</g>
<g data-x="16">
<g class="counter" data-allegiance="attacker" data-number="4">
- <use class="primary-weapon" href="#smg"/>
- <use class="troop-number" href="#number-4"/>
- <use class="squad-number" href="#number-1"/>
+ <use class="primary-weapon" href="counters.svg#smg"/>
+ <use class="troop-number" href="counters.svg#number-4"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
</g>
</g>
<g data-x="17">
<g class="counter" data-allegiance="attacker" data-number="5">
- <use class="primary-weapon" href="#smg"/>
- <use class="troop-number" href="#number-5"/>
- <use class="squad-number" href="#number-1"/>
+ <use class="primary-weapon" href="counters.svg#smg"/>
+ <use class="troop-number" href="counters.svg#number-5"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
</g>
</g>
<g data-x="18">
<g class="counter" data-allegiance="attacker" data-number="6">
- <use class="primary-weapon" href="#smg"/>
- <use class="troop-number" href="#number-6"/>
- <use class="squad-number" href="#number-1"/>
+ <use class="primary-weapon" href="counters.svg#smg"/>
+ <use class="troop-number" href="counters.svg#number-6"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
</g>
</g>
<g data-x="19">
<g class="counter" data-allegiance="attacker" data-number="7">
- <use class="primary-weapon" href="#smg"/>
- <use class="troop-number" href="#number-7"/>
- <use class="squad-number" href="#number-1"/>
+ <use class="primary-weapon" href="counters.svg#smg"/>
+ <use class="troop-number" href="counters.svg#number-7"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
</g>
</g>
</g>
@@ -181,50 +118,50 @@
<g data-x="13">
<g class="counter" data-allegiance="defender" data-number="1">
<use class="primary-weapon" href="#blazer"/>
- <use class="troop-number" href="#number-1"/>
- <use class="squad-number" href="#number-1"/>
+ <use class="troop-number" href="counters.svg#number-1"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
</g>
</g>
<g data-x="14">
<g class="counter" data-allegiance="defender" data-number="2">
- <use class="primary-weapon" href="#rifle"/>
- <use class="troop-number" href="#number-2"/>
- <use class="squad-number" href="#number-1"/>
+ <use class="primary-weapon" href="counters.svg#rifle"/>
+ <use class="troop-number" href="counters.svg#number-2"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
</g>
</g>
<g data-x="15">
<g class="counter" data-allegiance="defender" data-number="3">
- <use class="primary-weapon" href="#rifle"/>
- <use class="troop-number" href="#number-3"/>
- <use class="squad-number" href="#number-1"/>
+ <use class="primary-weapon" href="counters.svg#rifle"/>
+ <use class="troop-number" href="counters.svg#number-3"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
</g>
</g>
<g data-x="16">
<g class="counter" data-allegiance="defender" data-number="4">
- <use class="primary-weapon" href="#smg"/>
- <use class="troop-number" href="#number-4"/>
- <use class="squad-number" href="#number-1"/>
+ <use class="primary-weapon" href="counters.svg#smg"/>
+ <use class="troop-number" href="counters.svg#number-4"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
</g>
</g>
<g data-x="17">
<g class="counter" data-allegiance="defender" data-number="5">
- <use class="primary-weapon" href="#smg"/>
- <use class="troop-number" href="#number-5"/>
- <use class="squad-number" href="#number-1"/>
+ <use class="primary-weapon" href="counters.svg#smg"/>
+ <use class="troop-number" href="counters.svg#number-5"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
</g>
</g>
<g data-x="18">
<g class="counter" data-allegiance="defender" data-number="6">
- <use class="primary-weapon" href="#smg"/>
- <use class="troop-number" href="#number-6"/>
- <use class="squad-number" href="#number-1"/>
+ <use class="primary-weapon" href="counters.svg#smg"/>
+ <use class="troop-number" href="counters.svg#number-6"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
</g>
</g>
<g data-x="19">
<g class="counter" data-allegiance="defender" data-number="7">
- <use class="primary-weapon" href="#smg"/>
- <use class="troop-number" href="#number-7"/>
- <use class="squad-number" href="#number-1"/>
+ <use class="primary-weapon" href="counters.svg#smg"/>
+ <use class="troop-number" href="counters.svg#number-7"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
</g>
</g>
</g>
@@ -232,6 +169,6 @@
<g class="grid"/>
</g>
- <!-- <script href="../../import_external_resources.js"/> -->
+
<script data-cols="33" data-rows="77" href="../../map.js"/>
</svg>
diff --git a/public/assets/images/scenario-race_against_time.svg b/public/assets/images/scenario-race_against_time.svg
index 38be9fb..8a1cc04 100644
--- a/public/assets/images/scenario-race_against_time.svg
+++ b/public/assets/images/scenario-race_against_time.svg
@@ -1,6 +1,5 @@
<?xml version="1.0" standalone="no"?>
-<svg viewBox="-15.639999389648438 -129.2300262451172 2320.879638671875 1751.5654296875" xmlns="http://www.w3.org/2000/svg">
- <!-- <link xmlns="http://www.w3.org/1999/xhtml" rel="stylesheet" href="http://localhost:8080/assets/css/map.css" type="text/css" /> -->
+<svg viewBox="-10 -10 200 300" xmlns="http://www.w3.org/2000/svg">
<link xmlns="http://www.w3.org/1999/xhtml" rel="stylesheet" href="../css/map.css" type="text/css" />
<style>
g[data-edge="north"] { --i: -2; }
@@ -26,7 +25,6 @@
</style>
<defs>
<polygon id="hex" points="0,10 8.66,5 8.66,-5 0,-10 -8.66,-5 -8.66,5"/>
- <circle id="counter-base" cx="0" cy="0" r="5"/>
<line id="ast-line" x1="-1.2" y1="0" x2="1.2" y2="0"/>
@@ -46,14 +44,6 @@
<use x="-8.66" style="transform-origin: -8.66px 0;" class="ccw-60-deg" href="#ast-line"/>
</pattern>
- <g id="t-1" class="troop-counter-template"><use href="#counter-base"/><text>1</text></g>
- <g id="t-2" class="troop-counter-template"><use href="#counter-base"/><text>2</text></g>
- <g id="t-3" class="troop-counter-template"><use href="#counter-base"/><text>3</text></g>
- <g id="t-4" class="troop-counter-template"><use href="#counter-base"/><text>4</text></g>
- <g id="t-5" class="troop-counter-template"><use href="#counter-base"/><text>5</text></g>
- <g id="t-6" class="troop-counter-template"><use href="#counter-base"/><text>6</text></g>
- <g id="t-7" class="troop-counter-template"><use href="#counter-base"/><text>7</text></g>
-
<image id="counter-prone" href="counter_prone.jpg" width="10"/>
<image id="counter-grenade" href="counter_grenade.jpg" width="10"/>
</defs>
@@ -61,8 +51,7 @@
<rect id="background"/>
<g class="gameboard">
- <!-- <use href="http://localhost:8080/assets/images/mapsheets.svg#map4"/> -->
- <use data-href="mapsheets.svg#map4"/>
+ <use href="mapsheets.svg#map4"/>
<rect id="dots" fill="url(#asterisk)"/>
@@ -71,57 +60,113 @@
<g id="lines"/>
</g>
- <g class="start-locations">
+ <g class="start-locations" data-attacker-name="liao" data-defender-name="davion">
<g data-edge="north">
<g data-x="13">
- <g class="counter" data-allegiance="attacker" data-number="1"><use href="#t-1"/></g>
+ <g class="counter" data-allegiance="attacker" data-number="1">
+ <use class="primary-weapon" href="counters.svg#blazer"/>
+ <use class="troop-number" href="counters.svg#number-1"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
+ </g>
</g>
<g data-x="14">
- <g class="counter" data-allegiance="attacker" data-number="2"><use href="#t-2"/></g>
+ <g class="counter" data-allegiance="attacker" data-number="2">
+ <use class="primary-weapon" href="counters.svg#rifle"/>
+ <use class="troop-number" href="counters.svg#number-2"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
+ </g>
</g>
<g data-x="15">
- <g class="counter" data-allegiance="attacker" data-number="3"><use href="#t-3"/></g>
+ <g class="counter" data-allegiance="attacker" data-number="3">
+ <use class="primary-weapon" href="counters.svg#rifle"/>
+ <use class="troop-number" href="counters.svg#number-3"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
+ </g>
</g>
<g data-x="16">
- <g class="counter" data-allegiance="attacker" data-number="4"><use href="#t-4"/></g>
+ <g class="counter" data-allegiance="attacker" data-number="4">
+ <use class="primary-weapon" href="counters.svg#smg"/>
+ <use class="troop-number" href="counters.svg#number-4"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
+ </g>
</g>
<g data-x="17">
- <g class="counter" data-allegiance="attacker" data-number="5"><use href="#t-5"/></g>
+ <g class="counter" data-allegiance="attacker" data-number="5">
+ <use class="primary-weapon" href="counters.svg#smg"/>
+ <use class="troop-number" href="counters.svg#number-5"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
+ </g>
</g>
<g data-x="18">
- <g class="counter" data-allegiance="attacker" data-number="6"><use href="#t-6"/></g>
+ <g class="counter" data-allegiance="attacker" data-number="6">
+ <use class="primary-weapon" href="counters.svg#smg"/>
+ <use class="troop-number" href="counters.svg#number-6"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
+ </g>
</g>
<g data-x="19">
- <g class="counter" data-allegiance="attacker" data-number="7"><use href="#t-7"/></g>
+ <g class="counter" data-allegiance="attacker" data-number="7">
+ <use class="primary-weapon" href="counters.svg#smg"/>
+ <use class="troop-number" href="counters.svg#number-7"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
+ </g>
</g>
</g>
<g data-edge="south">
<g data-x="13">
- <g class="counter" data-allegiance="defender" data-number="1"><use href="#t-1"/></g>
+ <g class="counter" data-allegiance="defender" data-number="1">
+ <use class="primary-weapon" href="#blazer"/>
+ <use class="troop-number" href="counters.svg#number-1"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
+ </g>
</g>
<g data-x="14">
- <g class="counter" data-allegiance="defender" data-number="2"><use href="#t-2"/></g>
+ <g class="counter" data-allegiance="defender" data-number="2">
+ <use class="primary-weapon" href="counters.svg#rifle"/>
+ <use class="troop-number" href="counters.svg#number-2"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
+ </g>
</g>
<g data-x="15">
- <g class="counter" data-allegiance="defender" data-number="3"><use href="#t-3"/></g>
+ <g class="counter" data-allegiance="defender" data-number="3">
+ <use class="primary-weapon" href="counters.svg#rifle"/>
+ <use class="troop-number" href="counters.svg#number-3"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
+ </g>
</g>
<g data-x="16">
- <g class="counter" data-allegiance="defender" data-number="4"><use href="#t-4"/></g>
+ <g class="counter" data-allegiance="defender" data-number="4">
+ <use class="primary-weapon" href="counters.svg#smg"/>
+ <use class="troop-number" href="counters.svg#number-4"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
+ </g>
</g>
<g data-x="17">
- <g class="counter" data-allegiance="defender" data-number="5"><use href="#t-5"/></g>
+ <g class="counter" data-allegiance="defender" data-number="5">
+ <use class="primary-weapon" href="counters.svg#smg"/>
+ <use class="troop-number" href="counters.svg#number-5"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
+ </g>
</g>
<g data-x="18">
- <g class="counter" data-allegiance="defender" data-number="6"><use href="#t-6"/></g>
+ <g class="counter" data-allegiance="defender" data-number="6">
+ <use class="primary-weapon" href="counters.svg#smg"/>
+ <use class="troop-number" href="counters.svg#number-6"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
+ </g>
</g>
<g data-x="19">
- <g class="counter" data-allegiance="defender" data-number="7"><use href="#t-7"/></g>
+ <g class="counter" data-allegiance="defender" data-number="7">
+ <use class="primary-weapon" href="counters.svg#smg"/>
+ <use class="troop-number" href="counters.svg#number-7"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
+ </g>
</g>
</g>
</g>
<g class="grid"/>
</g>
- <script href="../../import_mapsheets.js"/>
+
<script data-cols="33" data-rows="25" href="../../map.js"/>
</svg>
diff --git a/public/assets/images/scenario-side_show.svg b/public/assets/images/scenario-side_show.svg
index b9d89c2..1041bd1 100644
--- a/public/assets/images/scenario-side_show.svg
+++ b/public/assets/images/scenario-side_show.svg
@@ -44,69 +44,6 @@
<use x="-8.66" style="transform-origin: -8.66px 0;" class="ccw-60-deg" href="#ast-line"/>
</pattern>
- <circle id="counter-base" style="r: inherit; stroke: none;" cx="0" cy="0" r="5"/>
-
- <g style="r: inherit;" id="number-1">
- <use style="r: inherit;" href="#counter-base"/>
- <text style="fill: var(--text-fill); transform: translateY(var(--translateY))">1</text>
- </g>
- <g id="number-2">
- <use href="#counter-base"/>
- <text style="fill: var(--text-fill); transform: translateY(var(--translateY))">2</text>
- </g>
- <g id="number-3">
- <use href="#counter-base"/>
- <text style="fill: var(--text-fill); transform: translateY(var(--translateY))">3</text>
- </g>
- <g id="number-4">
- <use href="#counter-base"/>
- <text style="fill: var(--text-fill); transform: translateY(var(--translateY))">4</text>
- </g>
- <g id="number-5">
- <use href="#counter-base"/>
- <text style="fill: var(--text-fill); transform: translateY(var(--translateY))">5</text>
- </g>
- <g id="number-6">
- <use href="#counter-base"/>
- <text style="fill: var(--text-fill); transform: translateY(var(--translateY))">6</text>
- </g>
- <g id="number-7">
- <use href="#counter-base"/>
- <text style="fill: var(--text-fill); transform: translateY(var(--translateY))">7</text>
- </g>
-
- <g id="semi-auto">
- <line x1="-2" y1="1" x2="2" y2="1"/>
- <line x1="-2" y1="2" x2="2" y2="2"/>
- </g>
-
- <g id="auto">
- <line x1="-2" y1="0" x2="2" y2="0"/>
- <line x1="-2" y1="1" x2="2" y2="1"/>
- <line x1="-2" y1="2" x2="2" y2="2"/>
- </g>
-
- <g id="rifle" style="r: inherit;" class="weapon-symbol">
- <use style="r: inherit;" href="#counter-base"/>
- <use href="#semi-auto"/>
- <line x1="0" y1="-5" x2="0" y2="5"/>
- <polyline style="fill: none;" points="-2,-3.5 0,-5 2,-3.5"/>
- </g>
-
- <g id="smg" style="r: inherit;" class="weapon-symbol">
- <use style="r: inherit;" href="#counter-base"/>
- <use href="#auto"/>
- <line x1="0" y1="-5" x2="0" y2="4.5"/>
- <line x1="-2" y1="4.5" x2="2" y2="4.5"/>
- </g>
-
- <g id="blazer" style="r: inherit;" class="weapon-symbol">
- <use style="r: inherit;" href="#counter-base"/>
- <use href="#auto"/>
- <polyline points="0,-5 0,-3 -3,-2.5 3,-1.5 0,-1 0,2.5 -3,3, 3,4 0,4.5 0,5"/>
- <polyline points="-2,-3.5 0,-5 2,-3.5"/>
- </g>
-
<image id="counter-prone" href="counter_prone.jpg" width="10"/>
<image id="counter-grenade" href="counter_grenade.jpg" width="10"/>
</defs>
@@ -128,51 +65,51 @@
<g data-edge="north">
<g data-x="13">
<g class="counter selected" data-allegiance="attacker" data-number="1">
- <use class="primary-weapon" href="#blazer"/>
- <use class="troop-number" href="#number-1"/>
- <use class="squad-number" href="#number-1"/>
+ <use class="primary-weapon" href="counters.svg#blazer"/>
+ <use class="troop-number" href="counters.svg#number-1"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
</g>
</g>
<g data-x="14">
<g class="counter" data-allegiance="attacker" data-number="2">
- <use class="primary-weapon" href="#rifle"/>
- <use class="troop-number" href="#number-2"/>
- <use class="squad-number" href="#number-1"/>
+ <use class="primary-weapon" href="counters.svg#rifle"/>
+ <use class="troop-number" href="counters.svg#number-2"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
</g>
</g>
<g data-x="15">
<g class="counter" data-allegiance="attacker" data-number="3">
- <use class="primary-weapon" href="#rifle"/>
- <use class="troop-number" href="#number-3"/>
- <use class="squad-number" href="#number-1"/>
+ <use class="primary-weapon" href="counters.svg#rifle"/>
+ <use class="troop-number" href="counters.svg#number-3"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
</g>
</g>
<g data-x="16">
<g class="counter" data-allegiance="attacker" data-number="4">
- <use class="primary-weapon" href="#smg"/>
- <use class="troop-number" href="#number-4"/>
- <use class="squad-number" href="#number-1"/>
+ <use class="primary-weapon" href="counters.svg#smg"/>
+ <use class="troop-number" href="counters.svg#number-4"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
</g>
</g>
<g data-x="17">
<g class="counter" data-allegiance="attacker" data-number="5">
- <use class="primary-weapon" href="#smg"/>
- <use class="troop-number" href="#number-5"/>
- <use class="squad-number" href="#number-1"/>
+ <use class="primary-weapon" href="counters.svg#smg"/>
+ <use class="troop-number" href="counters.svg#number-5"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
</g>
</g>
<g data-x="18">
<g class="counter" data-allegiance="attacker" data-number="6">
- <use class="primary-weapon" href="#smg"/>
- <use class="troop-number" href="#number-6"/>
- <use class="squad-number" href="#number-1"/>
+ <use class="primary-weapon" href="counters.svg#smg"/>
+ <use class="troop-number" href="counters.svg#number-6"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
</g>
</g>
<g data-x="19">
<g class="counter" data-allegiance="attacker" data-number="7">
- <use class="primary-weapon" href="#smg"/>
- <use class="troop-number" href="#number-7"/>
- <use class="squad-number" href="#number-1"/>
+ <use class="primary-weapon" href="counters.svg#smg"/>
+ <use class="troop-number" href="counters.svg#number-7"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
</g>
</g>
</g>
@@ -180,50 +117,50 @@
<g data-x="13">
<g class="counter" data-allegiance="defender" data-number="1">
<use class="primary-weapon" href="#blazer"/>
- <use class="troop-number" href="#number-1"/>
- <use class="squad-number" href="#number-1"/>
+ <use class="troop-number" href="counters.svg#number-1"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
</g>
</g>
<g data-x="14">
<g class="counter" data-allegiance="defender" data-number="2">
- <use class="primary-weapon" href="#rifle"/>
- <use class="troop-number" href="#number-2"/>
- <use class="squad-number" href="#number-1"/>
+ <use class="primary-weapon" href="counters.svg#rifle"/>
+ <use class="troop-number" href="counters.svg#number-2"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
</g>
</g>
<g data-x="15">
<g class="counter" data-allegiance="defender" data-number="3">
- <use class="primary-weapon" href="#rifle"/>
- <use class="troop-number" href="#number-3"/>
- <use class="squad-number" href="#number-1"/>
+ <use class="primary-weapon" href="counters.svg#rifle"/>
+ <use class="troop-number" href="counters.svg#number-3"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
</g>
</g>
<g data-x="16">
<g class="counter" data-allegiance="defender" data-number="4">
- <use class="primary-weapon" href="#smg"/>
- <use class="troop-number" href="#number-4"/>
- <use class="squad-number" href="#number-1"/>
+ <use class="primary-weapon" href="counters.svg#smg"/>
+ <use class="troop-number" href="counters.svg#number-4"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
</g>
</g>
<g data-x="17">
<g class="counter" data-allegiance="defender" data-number="5">
- <use class="primary-weapon" href="#smg"/>
- <use class="troop-number" href="#number-5"/>
- <use class="squad-number" href="#number-1"/>
+ <use class="primary-weapon" href="counters.svg#smg"/>
+ <use class="troop-number" href="counters.svg#number-5"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
</g>
</g>
<g data-x="18">
<g class="counter" data-allegiance="defender" data-number="6">
- <use class="primary-weapon" href="#smg"/>
- <use class="troop-number" href="#number-6"/>
- <use class="squad-number" href="#number-1"/>
+ <use class="primary-weapon" href="counters.svg#smg"/>
+ <use class="troop-number" href="counters.svg#number-6"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
</g>
</g>
<g data-x="19">
<g class="counter" data-allegiance="defender" data-number="7">
- <use class="primary-weapon" href="#smg"/>
- <use class="troop-number" href="#number-7"/>
- <use class="squad-number" href="#number-1"/>
+ <use class="primary-weapon" href="counters.svg#smg"/>
+ <use class="troop-number" href="counters.svg#number-7"/>
+ <use class="squad-number" href="counters.svg#number-1"/>
</g>
</g>
</g>
@@ -2017,7 +1954,6 @@
</g>
</g>
</g>
- <!-- <script href="http://localhost:8080/map.js"/> -->
- <!-- <script href="../../import_external_resources.js"/> -->
+
<script href="../../map.js"/>
</svg>