tarinai/js/item_dynamic_duplicator_system.js

25 lines
869 B
JavaScript

"use strict";
// Layer: entity-runtime/items/dynamic-system
// Owns duplicator item loading/reloading behavior.
(function (global) {
function support() {
return global.TarinaiItemLifecycleRuntimeSupport || {};
}
function update(item, dt, worldRef) {
if (!item || item.dead || item.type !== "duplicator") return false;
const s = support();
const syncRoles = s.syncDuplicatorRoles;
const applyStoredPin = s.duplicatorApplyStoredPin;
if (typeof syncRoles !== "function") return false;
item.amount = 999;
syncRoles(item);
if (typeof applyStoredPin === "function") applyStoredPin(item, worldRef);
item.duplicatorPinFlash = Math.max(0, (item.duplicatorPinFlash || 0) - dt);
return true;
}
global.TarinaiItemDynamicDuplicatorSystem = Object.freeze({ update });
})(typeof window !== "undefined" ? window : globalThis);