/
RaskolnickOFF
/
3D
Обзор
Документация
Войти
/
RaskolnickOFF
/
3D
Код
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
js/source/systems/interaction/InventorySystem.js
24 строки
606 B
RaskolnickOFF
Structure update
06 июн 2026, 03:18
06 июн 2026, 03:18
9bc1c25
Код
Авторство
О чём код?
// js/source/systems/interaction/InventorySystem.js import { GameEvents } from '../../core/GameEvents.js'; export class InventorySystem { constructor(eventBus) { this.items = []; this.eventBus = eventBus; } addItem(name, amount = 1) { const existing = this.items.find(i => i.name === name); if (existing) { existing.amount += amount; } else { this.items.push({ name, amount }); } this.eventBus.emit(GameEvents.INVENTORY_CHANGED, { items: this.items }); } getItems() { return this.items; } }