diff --git a/common/everything_registry.ts b/common/everything_registry.ts index 1c71e13..e40e4f4 100644 --- a/common/everything_registry.ts +++ b/common/everything_registry.ts @@ -54,8 +54,9 @@ export class EverythingRegistry { return this.#id_to_value.get(registry)?.[id] as T; } + // empty for a registry nothing has been added to, like blocks in a game whose mods have none static get_registry(registry: string): T[] { - return this.#id_to_value.get(registry) as T[]; + return (this.#id_to_value.get(registry) ?? []) as T[]; } // forget everything, for tests that load mods more than once diff --git a/common/mod_check.ts b/common/mod_check.ts index 4ba0034..660c87b 100644 --- a/common/mod_check.ts +++ b/common/mod_check.ts @@ -159,7 +159,8 @@ export function registered_ids(mods: LoadedMod[]): Record) { - const block_owners = new Map(); + // air is the engine's, so worldgen and place_on can name it like any block + const block_owners = new Map([["cubi:air", ["cubi"]]]); const item_owners = new Map(); const model_owners = new Map(); const model_parents = new Map(); @@ -303,7 +304,7 @@ export function check_references(mods: LoadedMod[], engine_textures: Iterable=0.1.0", + "main": "scripts/main.ts" +} diff --git a/mods/dangerous_business/scripts/main.ts b/mods/dangerous_business/scripts/main.ts new file mode 100644 index 0000000..79ff004 --- /dev/null +++ b/mods/dangerous_business/scripts/main.ts @@ -0,0 +1,10 @@ +import type { ClientContext } from "cubi/client"; +import type { ServerContext } from "cubi/server"; + +// a standalone game that doesn't build on bworld, so everything it needs comes from this mod or the engine + +export function server(_ctx: ServerContext) { +} + +export function client(_ctx: ClientContext) { +} diff --git a/mods/dangerous_business/worldgen/biome_source/void.json b/mods/dangerous_business/worldgen/biome_source/void.json new file mode 100644 index 0000000..42f1180 --- /dev/null +++ b/mods/dangerous_business/worldgen/biome_source/void.json @@ -0,0 +1,12 @@ +{ + "format_version": 1, + "biome_source": { + "id": "dangerous_business:void", + "rules": [ + { + "id": "dangerous_business:void", + "biome": "dangerous_business:void" + } + ] + } +} diff --git a/mods/dangerous_business/worldgen/biomes/void.json b/mods/dangerous_business/worldgen/biomes/void.json new file mode 100644 index 0000000..303ccfe --- /dev/null +++ b/mods/dangerous_business/worldgen/biomes/void.json @@ -0,0 +1,11 @@ +{ + "format_version": 1, + "biome": { + "id": "dangerous_business:void", + "surface": { + "top": "cubi:air", + "filler": "cubi:air", + "filler_depth": 0 + } + } +} diff --git a/mods/dangerous_business/worldgen/dimension/void.json b/mods/dangerous_business/worldgen/dimension/void.json new file mode 100644 index 0000000..006c4b8 --- /dev/null +++ b/mods/dangerous_business/worldgen/dimension/void.json @@ -0,0 +1,8 @@ +{ + "format_version": 1, + "dimension": { + "id": "dangerous_business:void", + "generator": "dangerous_business:void", + "default": false + } +} diff --git a/mods/dangerous_business/worldgen/noise_settings/void.json b/mods/dangerous_business/worldgen/noise_settings/void.json new file mode 100644 index 0000000..6d24a1f --- /dev/null +++ b/mods/dangerous_business/worldgen/noise_settings/void.json @@ -0,0 +1,28 @@ +{ + "format_version": 1, + "noise_settings": { + "id": "dangerous_business:void", + "sea_level": 0, + "default_block": "cubi:air", + "cell_width": 16, + "terrain": { + "density": -1, + "cell_height": 16 + }, + "caves": { + "density": -1, + "cell_height": 16 + }, + "preliminary_surface": 0, + "climate": {}, + "steep": 0, + "biome_source": "dangerous_business:void", + "fluids": [], + "surface_rule": { + "type": "block", + "result_state": { + "Name": "cubi:air" + } + } + } +}