48 lines
1.8 KiB
JavaScript
48 lines
1.8 KiB
JavaScript
"use strict";
|
|
|
|
// Layer: entity-runtime/items/dynamic-system
|
|
// Central dispatch table for active item behavior. Lifecycle steps should call
|
|
// this module instead of knowing every dynamic item type.
|
|
(function (global) {
|
|
function update(item, dt, worldRef) {
|
|
if (!item || item.dead) return false;
|
|
switch (item.type) {
|
|
case "firecracker":
|
|
case "flame_firecracker":
|
|
case "sticky_bomb":
|
|
case "fire":
|
|
case "genkotsu":
|
|
case "nest_box":
|
|
case "rotator":
|
|
case "poison_block":
|
|
case "reciprocator":
|
|
case "robot_cleaner":
|
|
case "rope":
|
|
case "rod":
|
|
case "spring":
|
|
return global.TarinaiItemDynamicToolSystem.update(item, dt, worldRef) !== false;
|
|
case "ball":
|
|
case "balloon":
|
|
return global.TarinaiItemDynamicBallSystem.update(item, dt, worldRef) !== false;
|
|
case "fan":
|
|
return global.TarinaiItemDynamicBallSystem.updateFan(item, dt, worldRef) !== false;
|
|
case "water":
|
|
return global.TarinaiItemDynamicBallSystem.updateWaterDropMotion(item, dt, worldRef) !== false;
|
|
case "duplicator":
|
|
return global.TarinaiItemDynamicDuplicatorSystem.update(item, dt, worldRef) !== false;
|
|
case "zunchi":
|
|
return global.TarinaiItemDynamicZunchiSystem.updateMotion(item, dt, worldRef) !== false;
|
|
default:
|
|
if (global.TarinaiItemDynamicPinSystem.isPin(item)) {
|
|
return global.TarinaiItemDynamicPinSystem.update(item, dt, worldRef) !== false;
|
|
}
|
|
if (item.isStructure && typeof item.update === "function") {
|
|
item.update(dt, worldRef);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
|
|
global.TarinaiItemDynamicSystem = Object.freeze({ update });
|
|
})(typeof window !== "undefined" ? window : globalThis);
|