the great renaming

This commit is contained in:
2026-02-26 15:33:24 +01:00
parent 4a4df0e799
commit 1ac2de123e
63 changed files with 11931 additions and 2674 deletions

View File

@@ -0,0 +1,48 @@
import { Component, computed, effect, inject, input, InputSignal, Signal } from '@angular/core';
import { HeaderComponent } from "../../components/ui-elements/header/header.component";
import { ERouteKey } from '../../types/route-key';
import { Chibi, ChibiId } from '../../types/chibi/chibi';
import { InteractionCanvasComponent } from "../../components/interaction-canvas/interaction-canvas.component";
import { ChibiStore } from '../../api/chibi.store';
import { FoodPantryComponent } from "../../components/food-pantry/food-pantry.component";
import { InventoryComponent } from "../../components/inventory/inventory.component";
import { ButtonComponent } from "../../components/ui-elements/button/button.component";
import { EChibiInteraction } from '../../types/chibi/chibi-interaction';
import { IBrain } from '../../logic/chibi-behaviour/brain';
import { BRAIN_MAP } from '../../logic/chibi-behaviour/brain-map';
import { TranslateableComponent } from '../../components/translateable.component';
@Component({
selector: 'ff-interactions',
imports: [HeaderComponent, InteractionCanvasComponent, FoodPantryComponent, InventoryComponent, ButtonComponent],
templateUrl: './interactions.component.html',
})
export class InteractionsComponent extends TranslateableComponent {
public readonly chibiId: InputSignal<ChibiId> = input.required<ChibiId>();
private readonly chibiStore: ChibiStore = inject(ChibiStore);
protected readonly chibi: Signal<Chibi> = computed(() => {
return this.chibiStore.chibis().find((chibi: Chibi) => chibi.id === this.chibiId()) as Chibi;
});
protected readonly ERouteKey: typeof ERouteKey = ERouteKey;
protected readonly EChibiInteraction: typeof EChibiInteraction = EChibiInteraction;
private brain!: IBrain;
constructor() {
effect(() => {
if (this.chibi()) {
this.brain = BRAIN_MAP[this.chibi().name]!;
}
})
}
public interact(interaction: EChibiInteraction): void {
console.log(`${interaction} ${this.chibi().name}`);
this.chibi().state = this.brain.resolveInteraction(this.chibi().state, interaction);
}
}