add ADFC
This commit is contained in:
parent
103b1a2bd1
commit
809572006f
@ -16,6 +16,7 @@
|
|||||||
import Cargo from '~C/Cargo/index.svelte';
|
import Cargo from '~C/Cargo/index.svelte';
|
||||||
import Streamlining from '~C/Streamlining/index.svelte';
|
import Streamlining from '~C/Streamlining/index.svelte';
|
||||||
import Carrier from '~C/Carrier';
|
import Carrier from '~C/Carrier';
|
||||||
|
import ADFC from '~C/Weaponry/ADFC';
|
||||||
|
|
||||||
const ship = shipStore();
|
const ship = shipStore();
|
||||||
|
|
||||||
@ -79,6 +80,8 @@
|
|||||||
<Firecons { ... $ship.weaponry.firecons }
|
<Firecons { ... $ship.weaponry.firecons }
|
||||||
on:change_firecons={ change_firecons }/>
|
on:change_firecons={ change_firecons }/>
|
||||||
|
|
||||||
|
<ADFC {...$ship.weaponry.adfc } />
|
||||||
|
|
||||||
<input type="button" value="add weapon" on:click={add_weapon}/>
|
<input type="button" value="add weapon" on:click={add_weapon}/>
|
||||||
|
|
||||||
{#each weapons as weapon (weapon.id)}
|
{#each weapons as weapon (weapon.id)}
|
||||||
|
26
src/components/Weaponry/ADFC/index.svelte
Normal file
26
src/components/Weaponry/ADFC/index.svelte
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<ShipItem {cost} {mass}>
|
||||||
|
<Field label="ADFC">
|
||||||
|
<input type="number" bind:value={rating} />
|
||||||
|
</Field>
|
||||||
|
</ShipItem>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import get from 'lodash/get';
|
||||||
|
import ShipItem from '~C/ShipItem/index.svelte';
|
||||||
|
import Field from '~C/Field/index.svelte';
|
||||||
|
import dux from '~/dux';
|
||||||
|
|
||||||
|
import {getContext } from 'svelte';
|
||||||
|
|
||||||
|
export let rating = 0;
|
||||||
|
export let cost = 0;
|
||||||
|
export let mass = 0;
|
||||||
|
export let ship_change = getContext('ship_change') || ( () => {} );
|
||||||
|
|
||||||
|
$: ship_change( dux.actions.set_adfc(rating));
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
div { display: flex }
|
||||||
|
</style>
|
17
src/dux/weaponry/adfc/index.js
Normal file
17
src/dux/weaponry/adfc/index.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import Updux from "updux";
|
||||||
|
import { action, payload } from "ts-action";
|
||||||
|
import u from "updeep";
|
||||||
|
|
||||||
|
const dux = new Updux({
|
||||||
|
initial: {
|
||||||
|
rating: 0,
|
||||||
|
cost: 0,
|
||||||
|
mass: 0,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
dux.addMutation( action( 'set_adfc', payload() ), rating =>
|
||||||
|
u({ rating, mass: 2 * rating, cost: 8 * rating })
|
||||||
|
);
|
||||||
|
|
||||||
|
export default dux.asDux;
|
@ -4,6 +4,7 @@ import u from "updeep";
|
|||||||
import { createSelector } from "reselect";
|
import { createSelector } from "reselect";
|
||||||
|
|
||||||
import weapons from './weapons';
|
import weapons from './weapons';
|
||||||
|
import adfc from './adfc';
|
||||||
|
|
||||||
const dux = new Updux({
|
const dux = new Updux({
|
||||||
initial: {
|
initial: {
|
||||||
@ -13,6 +14,7 @@ const dux = new Updux({
|
|||||||
},
|
},
|
||||||
subduxes: {
|
subduxes: {
|
||||||
weapons,
|
weapons,
|
||||||
|
adfc,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user