print the rest

main
Yanick Champoux 2022-03-26 14:24:57 -04:00
parent 745a72f83f
commit d77d280bd5
6 changed files with 165 additions and 166 deletions

View File

@ -9,7 +9,7 @@
<script> <script>
import Integrity from "./Integrity/index.svelte"; import Integrity from "./Integrity/index.svelte";
import Armour from "./Armour/index.svelte"; import Armour from "./Armor.svelte";
export let structure = {}; export let structure = {};
export let ship_mass = 0; export let ship_mass = 0;

View File

@ -5,9 +5,9 @@
<div class="details"> <div class="details">
<h2>{shipClass}-class, {shipType}</h2> <h2>{shipClass}-class, {shipType}</h2>
<div class="reqs"> <div class="reqs">
<Cost {cost} /> <Cost cost={reqs.cost} />
&nbsp; &nbsp;
<Mass {mass} /> <Mass mass={reqs.mass} />
</div> </div>
</div> </div>
@ -17,8 +17,7 @@
export let shipClass; export let shipClass;
export let shipType; export let shipType;
export let cost, export let reqs = {};
mass = (0, 0);
</script> </script>
<style> <style>

View File

@ -0,0 +1,23 @@
<Meta title="Output/Print" component={Print} argTypes={{
ship: {
type: 'object',
defaultValue: sample
}
}} />
<Story name="Primary" args={{}} />
<Template let:args>
<div style="width: 50em">
<Print ship={sample}/>
</div>
</Template>
<script>
import { Meta, Template, Story } from "@storybook/addon-svelte-csf";
import { action } from "@storybook/addon-actions";
import sample from './sample.js';
import Print from './index.svelte';
</script>

View File

@ -1,21 +1,14 @@
<div> <div class="print-output">
<Identification {...$state.identification} /> <Identification
{...ship.identification}
reqs={ship.reqs}
/>
<div class="section-2"> <div class="section-2">
<Hull structure={$state.structure} shipMass={$state.identification.mass} /> <Hull
</div> structure={ship.structure}
shipMass={ship.identification.mass}
<Weapons weapons={$state.weaponry.weapons} /> />
<MainSystems ftl={$state?.propulsion?.ftl}
engine={$state?.propulsion?.drive?.rating} />
</div>
<!--
<aside class="ship-sheet" transition:fade>
<div class="section-2">
<Hull structure={ship.structure} ship_mass={ship.general.mass} />
<Systems <Systems
firecons={ship.weaponry.firecons.nbr} firecons={ship.weaponry.firecons.nbr}
@ -23,27 +16,26 @@
/> />
</div> </div>
</aside> <Weapons weapons={ship.weaponry.weapons} />
-->
<MainSystems
ftl={ship?.propulsion?.ftl}
engine={ship?.propulsion?.drive?.rating}
/>
</div>
<script> <script>
import { getContext } from 'svelte';
/* import _ from "lodash"; */
import Identification from "./Identification/index.svelte"; import Identification from "./Identification/index.svelte";
import MainSystems from "./MainSystems/index.svelte"; import MainSystems from "./MainSystems/index.svelte";
import Hull from "./Hull/index.svelte"; import Hull from "./Hull/index.svelte";
import Weapons from "./Weapons/index.svelte"; import Weapons from "./Weapons/index.svelte";
/* import Systems from "./Systems/index.svelte"; */ import Systems from "./Systems/index.svelte";
/* export let ship; */ export let ship = {};
const { state } = getContext('ship');
/* import { fly, fade } from "svelte/transition"; */
</script> </script>
<style> <style>
div { .print-output {
width: 4.25in; width: 4.25in;
height: 5.5in; height: 5.5in;
border: 1px solid black; border: 1px solid black;
@ -54,6 +46,7 @@ import { getContext } from 'svelte';
.section-2 { .section-2 {
display: flex; display: flex;
align-items: start; align-items: start;
margin-right: 2em;
margin-left: 2em;
} }
</style> </style>

View File

@ -1,108 +1,105 @@
export default { export default {
ftl: { "identification": {
mass: 0, "shipType": "Scout",
cost: 0, "shipClass": "Blah",
type: "standard", "isCarrier": false,
"mass": 10
}, },
engine: { "propulsion": {
mass: 40, "drive": {
cost: 80, "reqs": {
rating: 6, "cost": 2,
advanced: false, "mass": 1
}, },
general: { "rating": 3,
ship_class: "Deviant", "advanced": true
name: "",
ship_type: "Battleship",
mass: 132,
used_mass: 131,
cost: 415,
}, },
weaponry: { "ftl": {
firecons: { "reqs": {
nbr: 5, "cost": 0,
mass: 5, "mass": 0
cost: 20,
}, },
weapons: [ "type": "none"
}
},
"structure": {
"hull": {
"reqs": {
"cost": 2,
"mass": 1
},
"rating": 10,
"min": 1,
"max": 10
},
"screens": {
"reqs": {
"cost": 0,
"mass": 0
},
"standard": 3,
"advanced": 2
},
"cargo": {
"reqs": {
"cost": 0,
"mass": 0
},
"space": 0
},
"streamlining": {
"reqs": {
"cost": 0,
"mass": 0
},
"type": "none"
},
"armor": {
"layers": [],
"reqs": {
"mass": 0,
"cost": 0
}
}
},
"carrier": {
"reqs": {
"cost": 0,
"mass": 0
},
"bays": 0,
"squadrons": []
},
"weaponry": {
"weapons": [
{ {
weapon_type: "submunition", "id": 1,
arcs: ["F"], "type": "beam",
mass: 1, "reqs": {
cost: 3, "mass": 1,
id: 1, "cost": 3
},
{
weapon_type: "beam",
weapon_class: "2",
arcs: ["A", "AS", "FS"],
mass: 2,
cost: 6,
id: 2,
},
{
weapon_type: "pds",
mass: 1,
cost: 3,
id: 3,
}, },
"weaponClass": 1
}
], ],
adfc: { "firecons": {
rating: 0, "stations": 1,
cost: 0, "reqs": {
mass: 0, "cost": 4,
"mass": 1
}
}, },
"adfc": {
"rating": 1,
"reqs": {
"cost": 8,
"mass": 2
}
}
}, },
structure: { "reqs": {
mass: 0, "cost": 19,
cost: 0, "mass": 10,
hull: { "usedMass": 6
rating: 22, }
advanced: false, }
cost: 44,
mass: 22,
},
screens: {
standard: 2,
advanced: 1,
cost: 105,
mass: 35,
},
armour: [
{
layer: 1,
rating: 7,
cost: 14,
mass: 14,
},
{
layer: 2,
rating: 2,
cost: 8,
mass: 4,
},
{
layer: 3,
rating: 0,
cost: 0,
mass: 0,
},
],
},
cargo: {
space: 7,
cost: 0,
mass: 7,
},
streamlining: {
type: "none",
cost: 0,
mass: 0,
},
carrier: {
bays: 0,
cost: 0,
mass: 0,
squadrons: [],
},
};

View File

@ -1,13 +0,0 @@
import Print from "./index.svelte";
import sample from "./sample";
export default {
title: "printouts",
};
export const basic = () => ({
Component: Print,
props: {
ship: sample,
},
});