"use strict"; // Tarinai item interaction system. // Orchestrates food/medicine consumption and non-eating item contact effects. // The candidate loop intentionally preserves the established order: for each nearby // candidate, try eating first; if nothing was consumed, apply contact effects // for that same candidate before advancing to the next one. (function (global) { function interactWithItems(dt = 0) { const ctx = global.TarinaiItemInteractionContext.create(this, dt); if (!ctx) return false; for (const item of ctx.foodCandidates || []) { const consumed = Boolean(global.TarinaiFoodInteractionSystem.updateCandidate(this, ctx, item, dt)); if (consumed) { global.TarinaiItemInteractionContext.finalize(this); return true; } global.TarinaiContactItemSystem.updateCandidate(this, ctx, item, dt); } global.TarinaiItemInteractionContext.finalize(this); return true; } function updateOne(tarinai, dt = 0) { if (!tarinai || tarinai.dead) return false; return interactWithItems.call(tarinai, dt); } global.TarinaiItemInteractionSystem = Object.freeze({ updateOne, }); })(typeof window !== "undefined" ? window : globalThis);