-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finally have debug support in VS Code
- Loading branch information
Showing
12 changed files
with
1,309 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,8 +16,6 @@ try { | |
} | ||
|
||
LogCommand { npm run build } | ||
|
||
LogCommand { npm run generate } | ||
} | ||
finally { | ||
Pop-Location | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,11 @@ | ||
<script setup lang="ts"> | ||
import HelloWorld from './components/HelloWorld.vue' | ||
import { ref } from 'vue'; | ||
import TroughItem from './components/TroughItem.vue' | ||
import Trough from './types/Trough.ts' | ||
const trough = ref(new Trough({ name: "Trough 1" })); | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<a href="https://vitejs.dev" target="_blank"> | ||
<img src="/vite.svg" class="logo" alt="Vite logo" /> | ||
</a> | ||
<a href="https://vuejs.org/" target="_blank"> | ||
<img src="./assets/vue.svg" class="logo vue" alt="Vue logo" /> | ||
</a> | ||
</div> | ||
<HelloWorld msg="Vite + Vue" /> | ||
<TroughItem :trough="trough" /> | ||
</template> | ||
|
||
<style scoped> | ||
.logo { | ||
height: 6em; | ||
padding: 1.5em; | ||
will-change: filter; | ||
transition: filter 300ms; | ||
} | ||
.logo:hover { | ||
filter: drop-shadow(0 0 2em #646cffaa); | ||
} | ||
.logo.vue:hover { | ||
filter: drop-shadow(0 0 2em #42b883aa); | ||
} | ||
</style> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<template> | ||
<h1>{{ trough.name }}</h1> | ||
|
||
<div class="card"> | ||
<button type="button" @click="doSomething">count is {{ trough.entries.length }}</button> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import Trough from '../types/Trough.ts' | ||
import data from '../types/arkData.ts' | ||
const props = defineProps<{ trough: Trough }>() | ||
function doSomething() { | ||
props.trough.entries.push({ | ||
Species: data.species[0], | ||
CheckedAge: 0.04, | ||
CheckTime: new Date(Date.now()), | ||
Count: 1, | ||
CurrentAge: 0.30 | ||
}) | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export default interface Diet { | ||
name: string; | ||
food: { [key: string]: number } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export default interface Food { | ||
name: string; | ||
stackSize: number; | ||
spoilTime: number | null; | ||
weight: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
export default class Species { | ||
name!: string; | ||
diet!: string; | ||
babyFoodRateStart!: number; | ||
babyFoodRateEnd!: number; | ||
adultFoodRate!: number; | ||
ageSpeed!: number; | ||
|
||
constructor(partial: Partial<Species>) { | ||
Object.assign(this, partial); | ||
} | ||
|
||
GetBabyFoodRate(age: number) | ||
{ | ||
if (age >= 1.0) return this.adultFoodRate; | ||
|
||
return this.babyFoodRateStart + (this.babyFoodRateEnd - this.babyFoodRateStart) * age | ||
}; | ||
|
||
GetFoodPointsConsumed(startAge: number, duration: number) | ||
{ | ||
let endAge = Math.min(startAge + duration * this.ageSpeed, 1.0); | ||
|
||
let startRate = this.GetBabyFoodRate(startAge); | ||
let endRate = this.GetBabyFoodRate(endAge); | ||
|
||
return (startRate + endRate) * duration / 2; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Provides trough class for food calculations | ||
import Species from "./Species"; | ||
|
||
export default class Trough { | ||
entries: troughEntry[]; | ||
name!: string; | ||
|
||
constructor(props: Partial<Trough>) { | ||
Object.assign(this, props); | ||
this.entries ??= []; | ||
} | ||
|
||
public addEntry(entry: troughEntry) { | ||
this.entries.push(entry); | ||
} | ||
} | ||
|
||
export class troughEntry { | ||
public Species: Species; | ||
public Count: number; | ||
public CheckedAge: number; | ||
public CheckTime: Date; | ||
|
||
constructor(species: Species, count: number, checkedAge: number, checkedTime: Date) { | ||
this.Species = species; | ||
this.Count = count; | ||
this.CheckedAge = checkedAge; | ||
this.CheckTime = checkedTime; | ||
} | ||
|
||
get CurrentAge(): number { | ||
let elapsedSeconds = (new Date().getTime() - this.CheckTime.getTime()) / 1000; | ||
return this.CheckedAge + elapsedSeconds / this.Species.ageSpeed; | ||
} | ||
} |
Oops, something went wrong.