Add Acceleration Segment + Improved Thrust calculation
This commit is contained in:
parent
90085dd87a
commit
986cf8453e
9 changed files with 288 additions and 138 deletions
src/lib/cards
50
src/lib/cards/Thrusters.svelte
Normal file
50
src/lib/cards/Thrusters.svelte
Normal file
|
@ -0,0 +1,50 @@
|
|||
<svelte:options runes />
|
||||
|
||||
<script>
|
||||
import {applyUnits, Localization} from "$lib/constants";
|
||||
import {Separator} from "$lib/components/ui/separator";
|
||||
import NewInventory from "$lib/components/NewInventory.svelte";
|
||||
import InventoryList from "$lib/components/InventoryList.svelte";
|
||||
import {Label} from "$lib/components/ui/label";
|
||||
import {Input} from "$lib/components/ui/input";
|
||||
import * as Card from "$lib/components/ui/card";
|
||||
import NewThruster from "$lib/components/NewThruster.svelte";
|
||||
import ThrusterList from "$lib/components/ThrusterList.svelte";
|
||||
|
||||
let { i18n = new Localization("en-GB"), ship, atmosphericDensity, onAddThruster, onRemoveThruster } = $props();
|
||||
|
||||
let valid = $derived.by(() => {
|
||||
let valids = [];
|
||||
valids[0] = typeof ship !== "undefined";
|
||||
valids[1] = typeof atmosphericDensity !== "undefined";
|
||||
valids[2] = typeof onAddThruster !== "undefined";
|
||||
valids[3] = typeof onRemoveThruster !== "undefined";
|
||||
return !valids.includes(false);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
{#if valid}
|
||||
<Card.Root class="flex-1 flex flex-col flex-grow">
|
||||
<Card.Header>
|
||||
<Card.Title>{i18n.localize("thrusterSettings")}</Card.Title>
|
||||
</Card.Header>
|
||||
<Card.Content class="flex flex-col flex-grow gap-3">
|
||||
<Separator />
|
||||
<Card.Root>
|
||||
<Card.Content class="flex flex-col gap-3 pt-6">
|
||||
<NewThruster i18n={i18n} {onAddThruster} />
|
||||
</Card.Content>
|
||||
</Card.Root>
|
||||
<Card.Root class="flex flex-col h-60 flex-grow">
|
||||
<Card.Header>
|
||||
<Card.Title>{i18n.localize("thrusters")} ({applyUnits(i18n, ship.getTotalThrust(atmosphericDensity), "N")})</Card.Title>
|
||||
</Card.Header>
|
||||
<Card.Content class="flex flex-col gap-3 overflow-hidden">
|
||||
<Separator />
|
||||
<ThrusterList i18n={i18n} thrusters={ship.thrusters} {onRemoveThruster} grid={ship.grid} atmosphere={atmosphericDensity}/>
|
||||
</Card.Content>
|
||||
</Card.Root>
|
||||
</Card.Content>
|
||||
</Card.Root>
|
||||
{/if}
|
Loading…
Add table
Add a link
Reference in a new issue