cargo
This commit is contained in:
parent
683f8bba93
commit
9596ae9922
25
src/lib/components/ShipEdit/Structure/Cargo.svelte
Normal file
25
src/lib/components/ShipEdit/Structure/Cargo.svelte
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<ShipItem {...reqs}>
|
||||||
|
<Field label="cargo">
|
||||||
|
<input type="number" min="0" bind:value={space} />
|
||||||
|
</Field>
|
||||||
|
</ShipItem>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import ShipItem from "$lib/components/ShipItem/index.svelte";
|
||||||
|
import Field from "$lib/components/Field/index.svelte";
|
||||||
|
|
||||||
|
import { getContext } from "svelte";
|
||||||
|
|
||||||
|
export let ship = getContext("ship");
|
||||||
|
|
||||||
|
export let space = 0;
|
||||||
|
export let reqs = {};
|
||||||
|
|
||||||
|
$: ship.dispatch.setCargo(space);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
input {
|
||||||
|
width: 5em;
|
||||||
|
}
|
||||||
|
</style>
|
@ -1,15 +1,18 @@
|
|||||||
<Section label="structure">
|
<Section label="structure">
|
||||||
<Hull {...hull}/>
|
<Hull {...hull}/>
|
||||||
<Screens {...screens} />
|
<Screens {...screens} />
|
||||||
|
<Cargo {...cargo} />
|
||||||
</Section>
|
</Section>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Section from "$lib/components/Section/index.svelte";
|
import Section from "$lib/components/Section/index.svelte";
|
||||||
import Hull from './Hull.svelte';
|
import Hull from './Hull.svelte';
|
||||||
import Screens from './Screens.svelte';
|
import Screens from './Screens.svelte';
|
||||||
|
import Cargo from './Cargo.svelte';
|
||||||
|
|
||||||
export let hull = {};
|
export let hull = {};
|
||||||
export let screens = {};
|
export let screens = {};
|
||||||
|
export let cargo = {};
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
24
src/lib/shipDux/structure/cargo.js
Normal file
24
src/lib/shipDux/structure/cargo.js
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import { Updux } from "updux";
|
||||||
|
import u from 'updeep';
|
||||||
|
import { createSelector } from 'reselect';
|
||||||
|
|
||||||
|
import reqs from '../reqs.js';
|
||||||
|
|
||||||
|
const dux = new Updux({
|
||||||
|
subduxes: {
|
||||||
|
reqs
|
||||||
|
},
|
||||||
|
initial: {
|
||||||
|
space: 0,
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
setCargo: null,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
export default dux;
|
||||||
|
|
||||||
|
dux.setMutation('setCargo', space => u({
|
||||||
|
space,
|
||||||
|
reqs: { mass: space }
|
||||||
|
}));
|
||||||
|
|
@ -2,8 +2,9 @@ import { Updux } from 'updux';
|
|||||||
|
|
||||||
import hull from './hull.js';
|
import hull from './hull.js';
|
||||||
import screens from './screens.js';
|
import screens from './screens.js';
|
||||||
|
import cargo from './cargo.js';
|
||||||
|
|
||||||
const dux = new Updux({
|
const dux = new Updux({
|
||||||
subduxes: { hull, screens }
|
subduxes: { hull, screens, cargo }
|
||||||
});
|
});
|
||||||
export default dux;
|
export default dux;
|
||||||
|
Loading…
Reference in New Issue
Block a user