1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2024-10-27 20:34:29 +00:00
tobspr_shapez.io/src/js/game/component_registry.js

44 lines
2.0 KiB
JavaScript
Raw Normal View History

2020-05-09 14:45:23 +00:00
import { gComponentRegistry } from "../core/global_registries";
import { StaticMapEntityComponent } from "./components/static_map_entity";
import { BeltComponent } from "./components/belt";
import { ItemEjectorComponent } from "./components/item_ejector";
import { ItemAcceptorComponent } from "./components/item_acceptor";
import { MinerComponent } from "./components/miner";
import { ItemProcessorComponent } from "./components/item_processor";
import { UndergroundBeltComponent } from "./components/underground_belt";
import { HubComponent } from "./components/hub";
2020-05-20 13:51:06 +00:00
import { StorageComponent } from "./components/storage";
2020-06-24 20:23:10 +00:00
import { WiredPinsComponent } from "./components/wired_pins";
import { BeltUnderlaysComponent } from "./components/belt_underlays";
2020-08-11 16:40:09 +00:00
import { WireComponent } from "./components/wire";
2020-08-12 19:05:32 +00:00
import { ConstantSignalComponent } from "./components/constant_signal";
2020-05-09 14:45:23 +00:00
export function initComponentRegistry() {
gComponentRegistry.register(StaticMapEntityComponent);
gComponentRegistry.register(BeltComponent);
gComponentRegistry.register(ItemEjectorComponent);
gComponentRegistry.register(ItemAcceptorComponent);
gComponentRegistry.register(MinerComponent);
gComponentRegistry.register(ItemProcessorComponent);
gComponentRegistry.register(UndergroundBeltComponent);
gComponentRegistry.register(HubComponent);
2020-05-20 13:51:06 +00:00
gComponentRegistry.register(StorageComponent);
2020-06-24 20:23:10 +00:00
gComponentRegistry.register(WiredPinsComponent);
gComponentRegistry.register(BeltUnderlaysComponent);
2020-08-11 16:40:09 +00:00
gComponentRegistry.register(WireComponent);
2020-08-12 19:05:32 +00:00
gComponentRegistry.register(ConstantSignalComponent);
2020-05-09 14:45:23 +00:00
2020-05-20 13:51:06 +00:00
// IMPORTANT ^^^^^ UPDATE ENTITY COMPONENT STORAGE AFTERWARDS
2020-05-09 14:45:23 +00:00
// Sanity check - If this is thrown, you (=me, lol) forgot to add a new component here
assert(
// @ts-ignore
require.context("./components", false, /.*\.js/i).keys().length ===
gComponentRegistry.getNumEntries(),
"Not all components are registered"
);
console.log("📦 There are", gComponentRegistry.getNumEntries(), "components");
}