aotds-docks/src/components/Weapon/Submunition/index.svelte

38 lines
809 B
Svelte
Raw Normal View History

2020-07-27 22:17:55 +00:00
<label> submunition pack</label>
<Arcs selected={arcs} on:click_arc={({detail}) => click_arc(detail)} />
<script>
import {getContext } from 'svelte';
2021-05-17 13:48:31 +00:00
import Arcs from '../Arcs/index.svelte';
import dux from '$lib/dux';
2020-07-27 22:17:55 +00:00
import { createEventDispatcher } from 'svelte';
2021-05-17 13:48:31 +00:00
2020-07-27 22:17:55 +00:00
const all_arcs = [ 'FS', 'F', 'FP', 'AP', 'A', 'AS' ];
export let arcs = ['F'];
export let ship_change = getContext('ship_change') || ( () => {} );
const click_arc = (arc) => {
if( arcs[0] === arc ) return;
arcs = [ arc ];
}
const dispatch = createEventDispatcher();
let cache;
$: cache = arcs.join(":");
$: dispatch( 'change', {
arcs: cache.split(":"),
})
</script>
<style>
.arc {
display: flex;
flex-direction: column;
margin-right: 1em;
}
</style>