"use strict"; // Layer: entity-runtime/items/dynamic-system // Owns dynamic tool behavior for rotator, reciprocator, firecracker, genkotsu, // links, and static gate-fence ticking. Item.prototype methods delegate here for // direct Item.prototype calls; lifecycle dispatch also calls this boundary directly. (function (global) { function fireApi() { const api = global.TarinaiFireRuntimeSystem; if (!api) throw new Error("TarinaiFireRuntimeSystem must be loaded before fire item behavior is used"); return api; } function robotApi() { const api = global.TarinaiRobotCleanerSystem; if (!api) throw new Error("TarinaiRobotCleanerSystem must be loaded before robot cleaner behavior is used"); return api; } function updateGenkotsu(item, dt) { item.impactFlash = Math.max(0, (item.impactFlash || 0) - dt); if (item.dropImpactDone) { item.lingerTimer = Math.max(0, (item.lingerTimer || 0) - dt); if ((item.lingerTimer || 0) <= 0) item.amount = 0; } else { item.amount = Math.max(item.amount || 0, 100); } } function updateRotator(item, dt, worldRef) { return Boolean(global.TarinaiMechanicalSystem.updateRotator(item, dt, worldRef)); } function updateReciprocator(item, dt, worldRef) { return Boolean(global.TarinaiMechanicalSystem.updateReciprocator(item, dt, worldRef)); } function updatePoisonBlock(item, dt, worldRef) { return Boolean(global.TarinaiMechanicalSystem.updatePoisonBlock(item, dt, worldRef)); } function updateFlexibleLink(item, dt, worldRef) { return Boolean(global.TarinaiConstraintSystem.updateFlexibleLink(item, dt, worldRef)); } function updateRigidLink(item, dt, worldRef) { return Boolean(global.TarinaiConstraintSystem.updateRigidLink(item, dt, worldRef)); } function updateGateFence(item) { if (item) item.amount = 999; return Boolean(item); } function update(item, dt, worldRef) { if (!item || item.dead) return false; if (item.type === "firecracker") return fireApi().updateFirecracker(item, dt, worldRef); if (item.type === "flame_firecracker") return fireApi().updateFlameFirecracker(item, dt, worldRef); if (item.type === "fire") return fireApi().updateFire(item, dt, worldRef); if (item.type === "genkotsu") return updateGenkotsu(item, dt, worldRef); if (item.type === "rotator") return updateRotator(item, dt, worldRef); if (item.type === "poison_block") return updatePoisonBlock(item, dt, worldRef); if (item.type === "reciprocator") return updateReciprocator(item, dt, worldRef); if (item.type === "gate_fence") return updateGateFence(item, dt, worldRef); if (item.type === "robot_cleaner") return robotApi().updateRobotCleaner(item, dt, worldRef); if (item.type === "rope") return updateFlexibleLink(item, dt, worldRef); if (item.type === "rod") return updateRigidLink(item, dt, worldRef); return false; } global.TarinaiItemDynamicToolSystem = Object.freeze({ update, robotCleanerDefaultMask: (...args) => robotApi().robotCleanerDefaultMask(...args), robotCleanerMask: (...args) => robotApi().robotCleanerMask(...args), setRobotCleanerMask: (...args) => robotApi().setRobotCleanerMask(...args), robotCleanerHasTarget: (...args) => robotApi().robotCleanerHasTarget(...args), robotCleanerHighSpeed: (...args) => robotApi().robotCleanerHighSpeed(...args), setRobotCleanerHighSpeed: (...args) => robotApi().setRobotCleanerHighSpeed(...args), robotCleanerEffectiveSpeed: (...args) => robotApi().robotCleanerEffectiveSpeed(...args), robotTargetLabel: (...args) => robotApi().robotTargetLabel(...args), get robotCleanerTargetBits() { return robotApi().robotCleanerTargetBits; }, get robotCleanerTargetOrder() { return robotApi().robotCleanerTargetOrder; }, get robotCleanerMoveSpeed() { return robotApi().robotCleanerMoveSpeed; }, get robotCleanerHighMoveSpeed() { return robotApi().robotCleanerHighMoveSpeed; }, get fireBurningText() { return fireApi().fireBurningText; }, get fireSeenText() { return fireApi().fireSeenText; }, fireTempMultiplier: (...args) => fireApi().fireTempMultiplier(...args), contactWaterDrop: (...args) => fireApi().contactWaterDrop(...args), consumeWaterForFire: (...args) => fireApi().consumeWaterForFire(...args), igniteTarinaiByFire: (...args) => fireApi().igniteTarinaiByFire(...args), panicTarinaiFromFire: (...args) => fireApi().panicTarinaiFromFire(...args), igniteAntByFire: (...args) => fireApi().igniteAntByFire(...args), igniteGrassByFire: (...args) => fireApi().igniteGrassByFire(...args), spawnFireAt: (...args) => fireApi().spawnFireAt(...args), scatterFireFrom: (...args) => fireApi().scatterFireFrom(...args), compactWorldFires: (...args) => fireApi().compactWorldFires(...args), updateFire: (...args) => fireApi().updateFire(...args), }); })(typeof window !== "undefined" ? window : globalThis);