print the rest

This commit is contained in:
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>
import Integrity from "./Integrity/index.svelte";
import Armour from "./Armour/index.svelte";
import Armour from "./Armor.svelte";
export let structure = {};
export let ship_mass = 0;

View File

@ -5,9 +5,9 @@
<div class="details">
<h2>{shipClass}-class, {shipType}</h2>
<div class="reqs">
<Cost {cost} />
<Cost cost={reqs.cost} />
&nbsp;
<Mass {mass} />
<Mass mass={reqs.mass} />
</div>
</div>
@ -17,8 +17,7 @@
export let shipClass;
export let shipType;
export let cost,
mass = (0, 0);
export let reqs = {};
</script>
<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,59 +1,52 @@
<div>
<Identification {...$state.identification} />
<div class="section-2">
<Hull structure={$state.structure} shipMass={$state.identification.mass} />
</div>
<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
firecons={ship.weaponry.firecons.nbr}
screens={ship.structure.screens}
<div class="print-output">
<Identification
{...ship.identification}
reqs={ship.reqs}
/>
</div>
</aside>
-->
<div class="section-2">
<Hull
structure={ship.structure}
shipMass={ship.identification.mass}
/>
<Systems
firecons={ship.weaponry.firecons.nbr}
screens={ship.structure.screens}
/>
</div>
<Weapons weapons={ship.weaponry.weapons} />
<MainSystems
ftl={ship?.propulsion?.ftl}
engine={ship?.propulsion?.drive?.rating}
/>
</div>
<script>
import { getContext } from 'svelte';
/* import _ from "lodash"; */
import Identification from "./Identification/index.svelte";
import MainSystems from "./MainSystems/index.svelte";
import Hull from "./Hull/index.svelte";
import Weapons from "./Weapons/index.svelte";
import Systems from "./Systems/index.svelte";
import Identification from "./Identification/index.svelte";
import MainSystems from "./MainSystems/index.svelte";
import Hull from "./Hull/index.svelte";
import Weapons from "./Weapons/index.svelte";
/* import Systems from "./Systems/index.svelte"; */
/* export let ship; */
const { state } = getContext('ship');
/* import { fly, fade } from "svelte/transition"; */
export let ship = {};
</script>
<style>
div {
width: 4.25in;
height: 5.5in;
border: 1px solid black;
padding: 1em;
margin: 0px auto;
}
.section-2 {
display: flex;
align-items: start;
}
.print-output {
width: 4.25in;
height: 5.5in;
border: 1px solid black;
padding: 1em;
margin: 0px auto;
}
.section-2 {
display: flex;
align-items: start;
margin-right: 2em;
margin-left: 2em;
}
</style>

View File

@ -1,108 +1,105 @@
export default {
ftl: {
mass: 0,
cost: 0,
type: "standard",
"identification": {
"shipType": "Scout",
"shipClass": "Blah",
"isCarrier": false,
"mass": 10
},
engine: {
mass: 40,
cost: 80,
rating: 6,
advanced: false,
},
general: {
ship_class: "Deviant",
name: "",
ship_type: "Battleship",
mass: 132,
used_mass: 131,
cost: 415,
},
weaponry: {
firecons: {
nbr: 5,
mass: 5,
cost: 20,
"propulsion": {
"drive": {
"reqs": {
"cost": 2,
"mass": 1
},
"rating": 3,
"advanced": true
},
weapons: [
{
weapon_type: "submunition",
arcs: ["F"],
mass: 1,
cost: 3,
id: 1,
"ftl": {
"reqs": {
"cost": 0,
"mass": 0
},
{
weapon_type: "beam",
weapon_class: "2",
arcs: ["A", "AS", "FS"],
mass: 2,
cost: 6,
id: 2,
"type": "none"
}
},
"structure": {
"hull": {
"reqs": {
"cost": 2,
"mass": 1
},
{
weapon_type: "pds",
mass: 1,
cost: 3,
id: 3,
"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": [
{
"id": 1,
"type": "beam",
"reqs": {
"mass": 1,
"cost": 3
},
"weaponClass": 1
}
],
adfc: {
rating: 0,
cost: 0,
mass: 0,
"firecons": {
"stations": 1,
"reqs": {
"cost": 4,
"mass": 1
}
},
"adfc": {
"rating": 1,
"reqs": {
"cost": 8,
"mass": 2
}
}
},
structure: {
mass: 0,
cost: 0,
hull: {
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: [],
},
};
"reqs": {
"cost": 19,
"mass": 10,
"usedMass": 6
}
}

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,
},
});