Rename all "liquid" mentions to "fluid"
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
"render_layer": "cutout",
|
||||
"light_emission": 15,
|
||||
"item": false,
|
||||
"liquid": { "range": 3, "ticks": 30, "renewable": false },
|
||||
"fluid": { "range": 3, "ticks": 30, "renewable": false },
|
||||
"components": {
|
||||
"bworld:bucketable": {
|
||||
"into": "bworld:lava_bucket"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"light_opacity": 1,
|
||||
"alpha": 0.8,
|
||||
"item": false,
|
||||
"liquid": {},
|
||||
"fluid": {},
|
||||
"components": {
|
||||
"bworld:water_source": {},
|
||||
"bworld:fishable": {},
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"item": {
|
||||
"id": "bworld:bucket",
|
||||
"texture": "bworld:bucket",
|
||||
"targets_liquids": true,
|
||||
"targets_fluids": true,
|
||||
"max_stack": 16,
|
||||
"base_sell_value": 180
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"item": {
|
||||
"id": "bworld:copper_watering_can",
|
||||
"texture": "bworld:copper_watering_can",
|
||||
"targets_liquids": true,
|
||||
"targets_fluids": true,
|
||||
"tool": {
|
||||
"type": "watering_can",
|
||||
"tier": 1,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"item": {
|
||||
"id": "bworld:gold_watering_can",
|
||||
"texture": "bworld:gold_watering_can",
|
||||
"targets_liquids": true,
|
||||
"targets_fluids": true,
|
||||
"tool": {
|
||||
"type": "watering_can",
|
||||
"tier": 0,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"item": {
|
||||
"id": "bworld:iron_watering_can",
|
||||
"texture": "bworld:iron_watering_can",
|
||||
"targets_liquids": true,
|
||||
"targets_fluids": true,
|
||||
"tool": {
|
||||
"type": "watering_can",
|
||||
"tier": 2,
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
},
|
||||
"components": {
|
||||
"bworld:fish": {
|
||||
"liquid": "bworld:lava",
|
||||
"fluid": "bworld:lava",
|
||||
"weight": 2,
|
||||
"minigame": "valley",
|
||||
"difficulty": 90
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
},
|
||||
"components": {
|
||||
"bworld:fish": {
|
||||
"liquid": "bworld:lava",
|
||||
"fluid": "bworld:lava",
|
||||
"weight": 8,
|
||||
"minigame": "ring",
|
||||
"difficulty": 61
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
},
|
||||
"components": {
|
||||
"bworld:fish": {
|
||||
"liquid": "bworld:lava",
|
||||
"fluid": "bworld:lava",
|
||||
"weight": 10,
|
||||
"minigame": "valley",
|
||||
"difficulty": 50
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
},
|
||||
"components": {
|
||||
"bworld:fish": {
|
||||
"liquid": "bworld:lava",
|
||||
"fluid": "bworld:lava",
|
||||
"weight": 1,
|
||||
"minigame": "maze",
|
||||
"difficulty": 110
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"item": {
|
||||
"id": "bworld:stone_watering_can",
|
||||
"texture": "bworld:stone_watering_can",
|
||||
"targets_liquids": true,
|
||||
"targets_fluids": true,
|
||||
"tool": {
|
||||
"type": "watering_can",
|
||||
"tier": 1,
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
},
|
||||
"components": {
|
||||
"bworld:fish": {
|
||||
"liquid": "bworld:lava",
|
||||
"fluid": "bworld:lava",
|
||||
"weight": 4,
|
||||
"minigame": "ring",
|
||||
"difficulty": 81
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
},
|
||||
"components": {
|
||||
"bworld:fish": {
|
||||
"liquid": "bworld:lava",
|
||||
"fluid": "bworld:lava",
|
||||
"weight": 0.1,
|
||||
"minigame": "hold",
|
||||
"difficulty": 50
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
},
|
||||
"components": {
|
||||
"bworld:fish": {
|
||||
"liquid": "bworld:lava",
|
||||
"fluid": "bworld:lava",
|
||||
"weight": 10,
|
||||
"minigame": "chess",
|
||||
"difficulty": 70
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"item": {
|
||||
"id": "bworld:wood_watering_can",
|
||||
"texture": "bworld:wood_watering_can",
|
||||
"targets_liquids": true,
|
||||
"targets_fluids": true,
|
||||
"tool": {
|
||||
"type": "watering_can",
|
||||
"tier": 0,
|
||||
|
||||
@@ -15,9 +15,9 @@ const FISH = "bworld:fish";
|
||||
// the menu a fish's minigame is played in. client.ts gives it the minigame's screen, see minigames/mod.ts
|
||||
const MINIGAME_MENU = "bworld:fishing_minigame";
|
||||
// what's caught in a fishable block whose bworld:fishable doesn't name a table, like water. each table is built from
|
||||
// the items with bworld:fish that live in its liquid, see register_fishing
|
||||
// the items with bworld:fish that live in its fluid, see register_fishing
|
||||
const FISHING_TABLE = "bworld:gameplay/fishing";
|
||||
// the liquid a fish lives in when it doesn't say
|
||||
// the fluid a fish lives in when it doesn't say
|
||||
const WATER = "bworld:water";
|
||||
// further than this from the hook, the line snaps
|
||||
const LINE_LENGTH = 16;
|
||||
@@ -65,7 +65,7 @@ interface FishParams {
|
||||
// how hard its minigame is, 10 when not given. what it changes is up to the minigame
|
||||
difficulty?: number;
|
||||
// the fishable block it's caught in, bworld:water when not given. it's in that block's loot table
|
||||
liquid?: string;
|
||||
fluid?: string;
|
||||
}
|
||||
|
||||
interface Cast {
|
||||
@@ -111,7 +111,7 @@ export function register_fishing(ctx: ServerContext) {
|
||||
const fly = (cast: Cast, velocity: Position, now: number) => {
|
||||
const from = cast.position;
|
||||
const to = { x: from.x + velocity.x, y: from.y + velocity.y, z: from.z + velocity.z };
|
||||
const hit = ctx.world.raycast(from, to, { liquids: "any" });
|
||||
const hit = ctx.world.raycast(from, to, { fluids: "any" });
|
||||
if (!hit) {
|
||||
cast.position = to;
|
||||
velocity.x *= DRAG;
|
||||
@@ -167,7 +167,7 @@ export function register_fishing(ctx: ServerContext) {
|
||||
return from <= to ? hour >= from && hour < to : hour >= from || hour < to;
|
||||
});
|
||||
|
||||
// every item with bworld:fish is in its liquid's fishing table, caught in its seasons, at its hours and in its
|
||||
// every item with bworld:fish is in its fluid's fishing table, caught in its seasons, at its hours and in its
|
||||
// biomes
|
||||
ctx.components.register_item<FishParams>(FISH, {});
|
||||
const tables = new Map<string, { item: string; weight: number; conditions: { condition: string }[] }[]>([
|
||||
@@ -186,12 +186,12 @@ export function register_fishing(ctx: ServerContext) {
|
||||
if (fish.seasons) conditions.push({ condition: "bworld:season", seasons: fish.seasons });
|
||||
if (fish.time) conditions.push({ condition: "bworld:time", ...fish.time });
|
||||
if (fish.biomes) conditions.push({ condition: "bworld:biome", biomes: fish.biomes });
|
||||
const liquid = fish.liquid ?? WATER;
|
||||
if (!ctx.blocks.exists(liquid) || !(FISHABLE in ctx.blocks.components(liquid))) {
|
||||
throw new Error(`${id} is caught in ${liquid}, which isn't a block with ${FISHABLE}`);
|
||||
const fluid = fish.fluid ?? WATER;
|
||||
if (!ctx.blocks.exists(fluid) || !(FISHABLE in ctx.blocks.components(fluid))) {
|
||||
throw new Error(`${id} is caught in ${fluid}, which isn't a block with ${FISHABLE}`);
|
||||
}
|
||||
const entry = { item: id, weight: fish.weight ?? 1, conditions };
|
||||
const table = table_of(liquid);
|
||||
const table = table_of(fluid);
|
||||
tables.set(table, [...tables.get(table) ?? [], entry]);
|
||||
return [entry];
|
||||
});
|
||||
|
||||
@@ -815,11 +815,11 @@ function register_buckets(ctx: ServerContext) {
|
||||
if (bucket?.id !== BUCKET) return false;
|
||||
const { x, y, z } = block;
|
||||
if (ctx.world.get_block(x, y, z) === block.id) {
|
||||
// only a liquid's source fills it, not where it's flowing
|
||||
// only a fluid's source fills it, not where it's flowing
|
||||
if ((ctx.world.get_state(x, y, z, "level") ?? 0) !== 0) return false;
|
||||
ctx.world.set_block(x, y, z, "bworld:air");
|
||||
} else {
|
||||
// the liquid in a waterlogged block, like a fence in water, which stays
|
||||
// the fluid in a waterlogged block, like a fence in water, which stays
|
||||
ctx.world.set_state(x, y, z, "waterlogged", 0);
|
||||
}
|
||||
bucket.count -= 1;
|
||||
|
||||
@@ -12,7 +12,7 @@ made down its left side, the category and the page between their arrows, then th
|
||||
them, Backspace goes back, and Escape or the inventory key (E) returns to the inventory.
|
||||
|
||||
It reads every mod's recipes with `ctx.recipes.list()`. Fish, the items with the base game's `bworld:fish` component,
|
||||
get a Fishing category too: clicking one shows its seasons, biomes, hours and the liquid it's caught in, read with
|
||||
get a Fishing category too: clicking one shows its seasons, biomes, hours and the fluid it's caught in, read with
|
||||
`ctx.items.components`, and the fishing rod's uses are every fish. The crab pot gets one too: a recipe for each bait in
|
||||
its `bworld:crabpot` component and each kind of water, showing everything that water's loot table can catch and how
|
||||
likely each is, read with `ctx.blocks.components` and `ctx.loot.table`.
|
||||
|
||||
@@ -131,7 +131,7 @@ function base_categories(tags: TagApi): RecipeCategory[] {
|
||||
}`,
|
||||
`Biomes: ${fish.biomes?.map(biome_name).join(", ") ?? "all"}`,
|
||||
`Time: ${fish.time ? `${clock(fish.time.from)} to ${clock(fish.time.to)}` : "all day"}`,
|
||||
`In: ${biome_name(fish.liquid ?? "bworld:water")}`,
|
||||
`In: ${biome_name(fish.fluid ?? "bworld:water")}`,
|
||||
];
|
||||
lines.forEach((line, i) => layout.text(line, 24, 1 + i * 13));
|
||||
},
|
||||
@@ -169,7 +169,7 @@ interface FishParams {
|
||||
seasons?: string[];
|
||||
biomes?: string[];
|
||||
time?: { from: number; to: number };
|
||||
liquid?: string;
|
||||
fluid?: string;
|
||||
}
|
||||
|
||||
export function fishing_recipes(ctx: ClientContext): Recipe[] {
|
||||
@@ -244,7 +244,7 @@ function title_case(name: string): string {
|
||||
return name.split("_").map((word) => word[0].toUpperCase() + word.slice(1)).join(" ");
|
||||
}
|
||||
|
||||
// a biome, liquid or #biome tag by its name: "bworld:swamp" is "Swamp", "#bworld:is_ocean" is "Ocean"
|
||||
// a biome, fluid or #biome tag by its name: "bworld:swamp" is "Swamp", "#bworld:is_ocean" is "Ocean"
|
||||
function biome_name(id: string): string {
|
||||
return title_case(id.replace(/^#/, "").split(":")[1].replace(/^is_/, ""));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user