removed unused processesseessess
This commit is contained in:
parent
348f355eb2
commit
4fdc567e08
158 changed files with 1317 additions and 3351 deletions
|
|
@ -1,74 +1,9 @@
|
|||
"use strict";
|
||||
|
||||
// Public facade joining the split item registry sources.
|
||||
// Public facade for registries that are still consumed across modules.
|
||||
(function (global) {
|
||||
function itemTypeDefinition(type = "") {
|
||||
const id = String(type || "");
|
||||
const tool = typeof global.itemDefinition === "function" ? global.itemDefinition(id) : null;
|
||||
const foodDefinitions = global.TarinaiFoodDefinitions || {};
|
||||
const effectDefinitions = global.TarinaiEffectDefinitions || {};
|
||||
const visualDefinitions = global.TarinaiItemVisualDefinitions || {};
|
||||
const traits = global.ITEM_TRAITS || global.TarinaiToolRegistry?.traits || {};
|
||||
const food = foodDefinitions[id] || null;
|
||||
const effectId = food?.effectId || (effectDefinitions[id] ? id : "");
|
||||
const effect = effectId ? (effectDefinitions[effectId] || null) : null;
|
||||
const visual = visualDefinitions[id] || null;
|
||||
return {
|
||||
id,
|
||||
tool,
|
||||
food,
|
||||
effect,
|
||||
effectId,
|
||||
visual,
|
||||
label: tool?.label || food?.label || effect?.label || id,
|
||||
radius: tool?.radius,
|
||||
amount: tool?.amount,
|
||||
placeable: Boolean(tool?.placeable),
|
||||
scalable: Boolean(tool?.scalable),
|
||||
traits: Object.fromEntries(Object.keys(traits).map(trait => [trait, typeof global.itemHasTrait === "function" ? global.itemHasTrait(id, trait) : false])),
|
||||
};
|
||||
}
|
||||
|
||||
function itemTypeLabel(type = "") {
|
||||
return itemTypeDefinition(type).label;
|
||||
}
|
||||
|
||||
function itemTypeDebugSnapshot() {
|
||||
const toolDefinitions = global.TOOL_DEFINITIONS || global.TarinaiToolRegistry?.definitions || {};
|
||||
const foodDefinitions = global.TarinaiFoodDefinitions || {};
|
||||
const effectDefinitions = global.TarinaiEffectDefinitions || {};
|
||||
const visualDefinitions = global.TarinaiItemVisualDefinitions || {};
|
||||
const ids = new Set([
|
||||
...Object.values(toolDefinitions).map(def => def.itemType || def.id),
|
||||
...Object.keys(foodDefinitions),
|
||||
...Object.keys(effectDefinitions),
|
||||
...Object.keys(visualDefinitions),
|
||||
]);
|
||||
return [...ids].sort().map(id => itemTypeDefinition(id));
|
||||
}
|
||||
|
||||
global.itemTypeDefinition = itemTypeDefinition;
|
||||
global.itemTypeLabel = itemTypeLabel;
|
||||
global.itemTypeDebugSnapshot = itemTypeDebugSnapshot;
|
||||
|
||||
global.TarinaiItemRegistry = Object.freeze({
|
||||
definition: itemTypeDefinition,
|
||||
label: itemTypeLabel,
|
||||
debugSnapshot: itemTypeDebugSnapshot,
|
||||
tool: global.toolDefinition,
|
||||
item: global.itemDefinition,
|
||||
food: global.TarinaiFoodRegistry,
|
||||
effect: global.TarinaiEffectRegistry,
|
||||
visual: global.itemVisualDefinition,
|
||||
hasTrait: global.itemHasTrait,
|
||||
radius: global.itemRadiusFor,
|
||||
amount: global.itemAmountFor,
|
||||
categories: global.toolCategories,
|
||||
physicsToolIds: () => [...(global.PHYSICS_TOOL_IDS || [])],
|
||||
isFence: global.isFenceItemType,
|
||||
isMechanical: global.isMechanicalItemType,
|
||||
isLink: global.isLinkItemType,
|
||||
scalableToolIds: global.scalableToolIds,
|
||||
pinBehavior: global.pinBehaviorFor,
|
||||
});
|
||||
})(typeof window !== "undefined" ? window : globalThis);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue