**Motivations:** - Ensure lint config is not degraded and fix all lint errors for pousse workflow. **Root causes:** - Unused variables kept with _ prefix instead of removed (_row, _questReward, _i). - getAnimalBlockOrigin had 5 parameters (max 4). - use of continue statement (no-continue rule). **Correctifs:** - ESLint config verified; no eslint-disable in codebase. - Removed unused variable _row (biome-rules); removed dead function _questReward (quests); removed unused map param _i (state.js). - getAnimalBlockOrigin refactored to 4 params (pos object instead of x, y). - Replaced continue with if (cell) block in normalizeLoadedCells (state.js). - JSDoc param names aligned with _height, _y (biome-rules). **Evolutions:** - (none) **Pages affectées:** - web/js/biome-rules.js - web/js/quests.js - web/js/state.js - web/js/placement.js
25 lines
1.5 KiB
Markdown
25 lines
1.5 KiB
Markdown
# Feedbacks visuels animaux
|
||
|
||
**Objectif :** États visuels (froid, chaud, faim, malade, heureux) dérivés des données existantes, sans jauges. Specs : animal_generique.md, temperature.md.
|
||
|
||
## Impacts
|
||
|
||
- **Rendu :** classes CSS `animal-cold`, `animal-hot`, `animal-hungry`, `animal-sick`, `animal-happy` sur les cellules animal (origine et parties de bloc).
|
||
- **Logique :** `getAnimalVisualState(cell, state, grid, originKey)` dans animal-visual-state.js : température (avec saison), lastFedAt, lastVisitedAt, seuils config (Food.MaxSecondsWithoutFood, Visitor.MaxSecondsWithoutVisit) pour déduire cold/hot/hungry/sick/happy.
|
||
|
||
## Modifications
|
||
|
||
- **web/js/animal-visual-state.js** : `getAnimalVisualState` (froid = temp < idéal - tolérance, chaud = temp > idéal + tolérance, hungry = fedAgo > 60 % maxFood, sick = cold ou hot ou hungry ou visitAgo > 80 % maxVisit, happy = aucun problème et bien nourri/visité).
|
||
- **web/js/ui.js** : import `getAnimalVisualState`, pour chaque cellule animal (origine ou non) récupération de l’origine et application des classes.
|
||
- **web/css/main.css** : `.animal-cold` (teinte bleutée, givre), `.animal-hot` (rougeâtre), `.animal-hungry` (opacité, icône faim), `.animal-sick` (saturé/brillance réduits), `.animal-happy` (lueur, brillance).
|
||
|
||
## Modalités de déploiement
|
||
|
||
Client uniquement. Rechargement suffit.
|
||
|
||
## Modalités d'analyse
|
||
|
||
- Animal sur case froide (ou saison hiver) : classe cold visible.
|
||
- Animal non nourri depuis longtemps : hungry puis sick.
|
||
- Animal bien nourri et visité, temp ok : happy.
|