Fluid handler

This commit is contained in:
2026-10-31 16:54:24 -03:00
parent 23d02c5229
commit 407ed77385
20 changed files with 602 additions and 127 deletions
+6 -1
View File
@@ -51,7 +51,7 @@ export class FluidRules {
exists: (id) => EverythingRegistry.get("fluids", id) !== undefined,
name: (fluid) => this.name(fluid),
color: (fluid) => this.color(fluid),
same: (a, b) => a.id === b.id && same_data(a.data, b.data),
same: same_fluid,
};
}
@@ -68,6 +68,11 @@ export class FluidRules {
}
}
// whether they're one fluid, see FluidApi.same
export function same_fluid(a: FluidVariant, b: FluidVariant): boolean {
return a.id === b.id && same_data(a.data, b.data);
}
function known_fluid(id: string): FluidJson {
const json = EverythingRegistry.get<FluidJson>("fluids", id);
if (!json) throw new Error(`unknown fluid ${id}`);