Dangerous business

This commit is contained in:
2026-11-14 15:21:10 -03:00
parent 95e058d659
commit 2282abc3bc
9 changed files with 89 additions and 3 deletions
+2 -1
View File
@@ -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<T>(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
+3 -2
View File
@@ -159,7 +159,8 @@ export function registered_ids(mods: LoadedMod[]): Record<TagRegistry, Set<strin
// engine_textures are the cubi: texture ids, for telling whether a texture a mod uses exists
export function check_references(mods: LoadedMod[], engine_textures: Iterable<string>) {
const block_owners = new Map<string, string[]>();
// air is the engine's, so worldgen and place_on can name it like any block
const block_owners = new Map<string, string[]>([["cubi:air", ["cubi"]]]);
const item_owners = new Map<string, string[]>();
const model_owners = new Map<string, string[]>();
const model_parents = new Map<string, string>();
@@ -303,7 +304,7 @@ export function check_references(mods: LoadedMod[], engine_textures: Iterable<st
}
}
for (const id of [...(json.place_on ?? []), ...(json.place_in ?? [])]) {
if (id !== "cubi:air") uses(file, id, "block");
uses(file, id, "block");
}
}
for (const { file, json } of mod.models) {
+3
View File
@@ -0,0 +1,3 @@
# Dangerous Business
A quota game with monsters and structures. It doesn't depend on bworld: its blocks, items and rules all live here.
+12
View File
@@ -0,0 +1,12 @@
{
"format_version": 1,
"id": "dangerous_business",
"name": "Dangerous Business",
"description": "A quota game: explore structures full of monsters and bring back enough to meet the quota.",
"version": "0.1.0",
"authors": [
"paula"
],
"game_version": ">=0.1.0",
"main": "scripts/main.ts"
}
+10
View File
@@ -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) {
}
@@ -0,0 +1,12 @@
{
"format_version": 1,
"biome_source": {
"id": "dangerous_business:void",
"rules": [
{
"id": "dangerous_business:void",
"biome": "dangerous_business:void"
}
]
}
}
@@ -0,0 +1,11 @@
{
"format_version": 1,
"biome": {
"id": "dangerous_business:void",
"surface": {
"top": "cubi:air",
"filler": "cubi:air",
"filler_depth": 0
}
}
}
@@ -0,0 +1,8 @@
{
"format_version": 1,
"dimension": {
"id": "dangerous_business:void",
"generator": "dangerous_business:void",
"default": false
}
}
@@ -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"
}
}
}
}