Slight Adjustments, Added Fuels Output

This commit is contained in:
Neshura 2024-05-22 23:37:44 +02:00
parent 42628b6a57
commit f85faeb6ad
Signed by: Neshura
GPG key ID: B6983AAA6B9A7A6C
3 changed files with 89 additions and 30 deletions

View file

@ -169,6 +169,30 @@ const localization = new Map([
["en-GB", "Atmospheric Density"], ["en-GB", "Atmospheric Density"],
["de-DE", "Atmosphärendichte"] ["de-DE", "Atmosphärendichte"]
])], ])],
["results", new Map([
["en-GB", "Results"],
["de-DE", "Ergebnisse"],
])],
["settings", new Map([
["en-GB", "Settings"],
["de-DE", "Einstellungen"],
])],
["fuels", new Map([
["en-GB", "Fuels"],
["de-DE", "Treibstoffe"],
])],
["electric", new Map([
["en-GB", "Electricity"],
["de-DE", "Elektrizität"],
])],
["hydrogen", new Map([
["en-GB", "Hydrogen"],
["de-DE", "Wasserstoff"],
])],
["deuterium", new Map([
["en-GB", "Deuterium"],
["de-DE", "Deuterium"],
])]
]) ])

View file

@ -1,6 +1,7 @@
import {Thruster, THRUSTER_LIST} from "$lib/thruster.svelte"; import {Thruster, THRUSTER_LIST, THRUSTER_TYPE_LIST} from "$lib/thruster.svelte";
import {Grid} from "$lib/grid"; import {Grid} from "$lib/grid";
import {INVENTORIES, Inventory} from "$lib/containers.svelte"; import {INVENTORIES, Inventory} from "$lib/containers.svelte";
import type {Fuel} from "$lib/fuel";
export class Ship { export class Ship {
thrusters: Array<Thruster> = $state([]); thrusters: Array<Thruster> = $state([]);
@ -91,4 +92,14 @@ export class Ship {
}); });
return thrust; return thrust;
} }
getFuelTypes(): Array<Fuel> {
let fuels: Array<Fuel> = [];
this.thrusters.forEach((thruster) => {
if (!fuels.includes(thruster.details.type.details.fuel)) {
fuels.push(thruster.details.type.details.fuel)
}
})
return fuels;
}
} }

View file

@ -145,13 +145,14 @@
</Card.Header> </Card.Header>
<Card.Content class="flex flex-col gap-3"> <Card.Content class="flex flex-col gap-3">
<Separator /> <Separator />
<Label for="gravity">{i18n.localize("gravity")}</Label> <Card.Root>
<Input type="number" step="0.01" id="gravity" bind:value={gravity}/> <Card.Header>
<Label for="atmosDensity">{i18n.localize("atmosDensity")}</Label> <Card.Title>{i18n.localize("settings")}</Card.Title>
<Input type="number" step="0.01" id="atmosDensity" bind:value={atmosphericDensity}/> </Card.Header>
<Card.Content class="flex flex-col gap-3">
<Separator /> <Separator />
<Label for="gridSize">{i18n.localize("gridSize")}</Label> <Label for="grid">{i18n.localize("gridSize")}</Label>
<div id="gridSize" class="flex gap-2"> <div id="grid" class="flex gap-2">
{#each Object.values(Grid) as size} {#each Object.values(Grid) as size}
{#if ship.grid === size} {#if ship.grid === size}
<Button class="bg-primary">{i18n.localize(size)}</Button> <Button class="bg-primary">{i18n.localize(size)}</Button>
@ -160,7 +161,8 @@
{/if} {/if}
{/each} {/each}
</div> </div>
<Separator /> <Label for="gravity">{i18n.localize("gravity")}</Label>
<Input type="number" step="0.01" id="gravity" bind:value={gravity}/>
<Label for="density">{i18n.localize("density")}</Label> <Label for="density">{i18n.localize("density")}</Label>
<div id="density" class="flex gap-2"> <div id="density" class="flex gap-2">
{#each Object.values(CargoMaterial) as value} {#each Object.values(CargoMaterial) as value}
@ -171,9 +173,31 @@
{/if} {/if}
{/each} {/each}
</div> </div>
<Label for="atmosDensity">{i18n.localize("atmosDensity")}</Label>
<Input type="number" step="0.01" id="atmosDensity" bind:value={atmosphericDensity}/>
</Card.Content>
</Card.Root>
<Card.Root>
<Card.Header>
<Card.Title>{i18n.localize("results")}</Card.Title>
</Card.Header>
<Card.Content class="flex flex-col gap-3">
<Separator /> <Separator />
<p>{i18n.localize("liftableVehcileWeight")}: {weightConversion(i18n, maxVehicleWeight)}</p> <div class="flex gap-2">
<p>{i18n.localize("liftableVehcileWeight")}:</p>
{#if maxVehicleWeight < 0}
<p class="text-destructive">{weightConversion(i18n, maxVehicleWeight)}</p>
{:else}
<p>{weightConversion(i18n, maxVehicleWeight)}</p>
{/if}
</div>
<p>{i18n.localize("liftableWeight")}: {weightConversion(i18n, maxWeight)}</p> <p>{i18n.localize("liftableWeight")}: {weightConversion(i18n, maxWeight)}</p>
<Separator />
<p>{i18n.localize("fuels")}:
{ship.getFuelTypes().map((fuel) => i18n.localize(fuel.name)).join(", ") }
</p>
</Card.Content>
</Card.Root>
</Card.Content> </Card.Content>
</Card.Root> </Card.Root>
<Card.Root class="flex-1 flex flex-col flex-grow"> <Card.Root class="flex-1 flex flex-col flex-grow">