Lint: fix errors and remove unused variables
**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
This commit is contained in:
@@ -3,7 +3,8 @@ import { LootTables, getRarityHatchMultiplierForEggType } from "./loot-tables.js
|
||||
import { plotSizeFromLevel } from "./grid-utils.js";
|
||||
import { getPlotUpgradeCost, getWorldMapUpgradeResearchCost } from "./economy.js";
|
||||
import { findOffer } from "./conveyor.js";
|
||||
import { placeEgg, fillAnimalBlock, canPlaceMultiCell } from "./placement.js";
|
||||
import { placeEgg, fillAnimalBlock } from "./placement.js";
|
||||
import { getMatureBabyPlacementData, getReceptionAnimalPlacementData } from "./zoo-placement.js";
|
||||
import { getNurseryCellKeysOrdered, getFreeNurseryCellKey } from "./zoo-nursery.js";
|
||||
|
||||
export { getNurseryCellKeysOrdered, getFreeNurseryCellKey };
|
||||
@@ -125,28 +126,9 @@ export function tryBuyAnimal(state, animalId, price) {
|
||||
*/
|
||||
export function placeMatureBabyOnCell(state, opts) {
|
||||
const { nurseryCellKey, toX, toY, nowUnix } = opts;
|
||||
const baby = (state.pendingBabies ?? []).find((p) => p.nurseryCellKey === nurseryCellKey);
|
||||
if (baby === null || baby === undefined) return [false, "NoBaby"];
|
||||
if (nowUnix < baby.readyAt) return [false, "BabyNotReady"];
|
||||
const def = LootTables.Animals[baby.animalId];
|
||||
if (def === null || def === undefined) return [false, "UnknownAnimal"];
|
||||
const w = def.cellsWide ?? 1;
|
||||
const h = def.cellsHigh ?? 1;
|
||||
const [ok, reason] = canPlaceMultiCell(state, { originX: toX, originY: toY, w, h });
|
||||
if (!ok) return [false, reason];
|
||||
const animalData = {
|
||||
kind: "animal",
|
||||
id: baby.animalId,
|
||||
mutation: "none",
|
||||
level: 1,
|
||||
placedAt: nowUnix,
|
||||
lastVisitedAt: nowUnix,
|
||||
lastFedAt: nowUnix,
|
||||
cellsWide: w,
|
||||
cellsHigh: h,
|
||||
fromOtherZoo: baby.fromOtherZoo === true,
|
||||
};
|
||||
fillAnimalBlock(state, toX, toY, animalData);
|
||||
const [ok, result] = getMatureBabyPlacementData(state, opts);
|
||||
if (!ok) return [false, result];
|
||||
fillAnimalBlock(state, toX, toY, result);
|
||||
state.pendingBabies = (state.pendingBabies ?? []).filter((p) => p.nurseryCellKey !== nurseryCellKey);
|
||||
state.lastEvolutionAt = nowUnix;
|
||||
return [true, undefined];
|
||||
@@ -160,28 +142,9 @@ export function placeMatureBabyOnCell(state, opts) {
|
||||
*/
|
||||
export function placeReceptionAnimalOnCell(state, opts) {
|
||||
const { receptionCellKey, toX, toY, nowUnix } = opts;
|
||||
const rec = (state.receptionAnimals ?? []).find((r) => r.receptionCellKey === receptionCellKey);
|
||||
if (rec === null || rec === undefined) return [false, "NoReceptionAnimal"];
|
||||
if (nowUnix < rec.readyAt) return [false, "AnimalNotReady"];
|
||||
const def = LootTables.Animals[rec.animalId];
|
||||
if (def === null || def === undefined) return [false, "UnknownAnimal"];
|
||||
const w = def.cellsWide ?? 1;
|
||||
const h = def.cellsHigh ?? 1;
|
||||
const [ok, reason] = canPlaceMultiCell(state, { originX: toX, originY: toY, w, h });
|
||||
if (!ok) return [false, reason];
|
||||
const animalData = {
|
||||
kind: "animal",
|
||||
id: rec.animalId,
|
||||
mutation: "none",
|
||||
level: 1,
|
||||
placedAt: nowUnix,
|
||||
lastVisitedAt: nowUnix,
|
||||
lastFedAt: nowUnix,
|
||||
cellsWide: w,
|
||||
cellsHigh: h,
|
||||
fromOtherZoo: true,
|
||||
};
|
||||
fillAnimalBlock(state, toX, toY, animalData);
|
||||
const [ok, result] = getReceptionAnimalPlacementData(state, opts);
|
||||
if (!ok) return [false, result];
|
||||
fillAnimalBlock(state, toX, toY, result);
|
||||
state.receptionAnimals = (state.receptionAnimals ?? []).filter((r) => r.receptionCellKey !== receptionCellKey);
|
||||
state.lastEvolutionAt = nowUnix;
|
||||
return [true, undefined];
|
||||
|
||||
Reference in New Issue
Block a user