Compare commits

..
2 Commits
Author SHA1 Message Date
paula 2cc5d4e013 Add some more fish 2026-10-11 17:20:50 -03:00
paula c3bc1b3501 Fix bug with fences 2026-10-11 16:52:55 -03:00
25 changed files with 262 additions and 36 deletions
+10 -1
View File
@@ -7,6 +7,15 @@
"nutrition": 2,
"saturation_modifier": 0.1
},
"base_sell_value": 1
"components": {
"bworld:fish": {
"weight": 10,
"seasons": ["summer"],
"biomes": ["#bworld:is_ocean"],
"minigame": "valley",
"difficulty": 28
}
},
"base_sell_value": 40
}
}
+10 -1
View File
@@ -7,6 +7,15 @@
"nutrition": 2,
"saturation_modifier": 0.1
},
"base_sell_value": 1
"components": {
"bworld:fish": {
"weight": 10,
"seasons": ["autumn"],
"biomes": ["#bworld:is_river"],
"minigame": "valley",
"difficulty": 39
}
},
"base_sell_value": 70
}
}
+10 -1
View File
@@ -7,6 +7,15 @@
"nutrition": 2,
"saturation_modifier": 0.1
},
"base_sell_value": 1
"components": {
"bworld:fish": {
"weight": 10,
"seasons": ["winter"],
"biomes": ["#bworld:is_river", "#bworld:is_mountain"],
"minigame": "valley",
"difficulty": 50
}
},
"base_sell_value": 120
}
}
+10 -1
View File
@@ -7,6 +7,15 @@
"nutrition": 2,
"saturation_modifier": 0.1
},
"base_sell_value": 1
"components": {
"bworld:fish": {
"weight": 10,
"seasons": ["spring"],
"biomes": ["#bworld:is_ocean"],
"minigame": "valley",
"difficulty": 28
}
},
"base_sell_value": 40
}
}
+10 -1
View File
@@ -7,6 +7,15 @@
"nutrition": 2,
"saturation_modifier": 0.1
},
"base_sell_value": 1
"components": {
"bworld:fish": {
"weight": 10,
"seasons": ["summer"],
"biomes": ["#bworld:is_river"],
"minigame": "valley",
"difficulty": 28
}
},
"base_sell_value": 40
}
}
+10 -1
View File
@@ -7,6 +7,15 @@
"nutrition": 2,
"saturation_modifier": 0.1
},
"base_sell_value": 1
"components": {
"bworld:fish": {
"weight": 5,
"seasons": ["summer", "winter"],
"biomes": ["#bworld:is_ocean"],
"minigame": "valley",
"difficulty": 39
}
},
"base_sell_value": 70
}
}
+10 -1
View File
@@ -7,6 +7,15 @@
"nutrition": 2,
"saturation_modifier": 0.1
},
"base_sell_value": 1
"components": {
"bworld:fish": {
"weight": 2,
"seasons": ["spring"],
"biomes": ["#bworld:is_river"],
"minigame": "valley",
"difficulty": 44
}
},
"base_sell_value": 90
}
}
+10 -1
View File
@@ -7,6 +7,15 @@
"nutrition": 2,
"saturation_modifier": 0.1
},
"base_sell_value": 1
"components": {
"bworld:fish": {
"weight": 10,
"seasons": ["autumn"],
"biomes": ["#bworld:is_river"],
"minigame": "valley",
"difficulty": 30
}
},
"base_sell_value": 45
}
}
+10 -1
View File
@@ -7,6 +7,15 @@
"nutrition": 2,
"saturation_modifier": 0.1
},
"base_sell_value": 1
"components": {
"bworld:fish": {
"weight": 10,
"seasons": ["spring", "summer", "autumn", "winter"],
"biomes": ["#bworld:is_river"],
"minigame": "valley",
"difficulty": 30
}
},
"base_sell_value": 45
}
}
+10 -1
View File
@@ -7,6 +7,15 @@
"nutrition": 2,
"saturation_modifier": 0.1
},
"base_sell_value": 1
"components": {
"bworld:fish": {
"weight": 10,
"seasons": ["autumn"],
"biomes": ["#bworld:is_forest"],
"minigame": "valley",
"difficulty": 25
}
},
"base_sell_value": 35
}
}
+11 -1
View File
@@ -7,6 +7,16 @@
"nutrition": 2,
"saturation_modifier": 0.1
},
"base_sell_value": 1
"components": {
"bworld:fish": {
"weight": 10,
"seasons": ["summer", "winter"],
"biomes": ["#bworld:is_ocean"],
"time": { "from": 6, "to": 19 },
"minigame": "valley",
"difficulty": 40
}
},
"base_sell_value": 75
}
}
+10 -1
View File
@@ -7,6 +7,15 @@
"nutrition": 2,
"saturation_modifier": 0.1
},
"base_sell_value": 1
"components": {
"bworld:fish": {
"weight": 10,
"seasons": ["spring", "autumn"],
"biomes": ["#bworld:is_ocean"],
"minigame": "valley",
"difficulty": 30
}
},
"base_sell_value": 45
}
}
+10 -1
View File
@@ -7,6 +7,15 @@
"nutrition": 2,
"saturation_modifier": 0.1
},
"base_sell_value": 1
"components": {
"bworld:fish": {
"weight": 10,
"seasons": ["spring", "summer", "autumn", "winter"],
"biomes": ["#bworld:is_ocean"],
"minigame": "valley",
"difficulty": 25
}
},
"base_sell_value": 35
}
}
+11 -1
View File
@@ -7,6 +7,16 @@
"nutrition": 2,
"saturation_modifier": 0.1
},
"base_sell_value": 1
"components": {
"bworld:fish": {
"weight": 10,
"seasons": ["autumn", "winter"],
"biomes": ["#bworld:is_ocean"],
"time": { "from": 6, "to": 19 },
"minigame": "valley",
"difficulty": 40
}
},
"base_sell_value": 75
}
}
+10 -1
View File
@@ -7,6 +7,15 @@
"nutrition": 2,
"saturation_modifier": 0.1
},
"base_sell_value": 1
"components": {
"bworld:fish": {
"weight": 10,
"seasons": ["spring"],
"biomes": ["#bworld:is_ocean"],
"minigame": "valley",
"difficulty": 28
}
},
"base_sell_value": 40
}
}
+10 -1
View File
@@ -7,6 +7,15 @@
"nutrition": 2,
"saturation_modifier": 0.1
},
"base_sell_value": 1
"components": {
"bworld:fish": {
"weight": 10,
"seasons": ["spring", "summer", "autumn", "winter"],
"biomes": ["#bworld:is_river"],
"minigame": "valley",
"difficulty": 25
}
},
"base_sell_value": 35
}
}
+10 -1
View File
@@ -7,6 +7,15 @@
"nutrition": 2,
"saturation_modifier": 0.1
},
"base_sell_value": 1
"components": {
"bworld:fish": {
"weight": 10,
"seasons": ["summer"],
"biomes": ["#bworld:is_ocean"],
"minigame": "valley",
"difficulty": 28
}
},
"base_sell_value": 40
}
}
+10 -1
View File
@@ -7,6 +7,15 @@
"nutrition": 2,
"saturation_modifier": 0.1
},
"base_sell_value": 1
"components": {
"bworld:fish": {
"weight": 5,
"seasons": ["spring", "autumn"],
"biomes": ["#bworld:is_river"],
"minigame": "valley",
"difficulty": 42
}
},
"base_sell_value": 80
}
}
+11 -1
View File
@@ -7,6 +7,16 @@
"nutrition": 2,
"saturation_modifier": 0.1
},
"base_sell_value": 1
"components": {
"bworld:fish": {
"weight": 10,
"seasons": ["spring", "summer"],
"biomes": ["#bworld:is_river"],
"time": { "from": 6, "to": 19 },
"minigame": "valley",
"difficulty": 22
}
},
"base_sell_value": 30
}
}
+10 -1
View File
@@ -7,6 +7,15 @@
"nutrition": 2,
"saturation_modifier": 0.1
},
"base_sell_value": 1
"components": {
"bworld:fish": {
"weight": 5,
"seasons": ["spring", "autumn"],
"biomes": ["#bworld:is_ocean"],
"minigame": "valley",
"difficulty": 42
}
},
"base_sell_value": 80
}
}
+10 -1
View File
@@ -7,6 +7,15 @@
"nutrition": 2,
"saturation_modifier": 0.1
},
"base_sell_value": 1
"components": {
"bworld:fish": {
"weight": 10,
"seasons": ["winter"],
"biomes": ["#bworld:is_forest"],
"minigame": "valley",
"difficulty": 30
}
},
"base_sell_value": 45
}
}
+10 -1
View File
@@ -7,6 +7,15 @@
"nutrition": 2,
"saturation_modifier": 0.1
},
"base_sell_value": 1
"components": {
"bworld:fish": {
"weight": 10,
"seasons": ["spring"],
"biomes": ["#bworld:is_river"],
"minigame": "valley",
"difficulty": 30
}
},
"base_sell_value": 45
}
}
+10 -1
View File
@@ -7,6 +7,15 @@
"nutrition": 2,
"saturation_modifier": 0.1
},
"base_sell_value": 1
"components": {
"bworld:fish": {
"weight": 10,
"seasons": ["spring", "summer", "autumn", "winter"],
"biomes": ["#bworld:is_forest"],
"minigame": "valley",
"difficulty": 40
}
},
"base_sell_value": 75
}
}
+14 -13
View File
@@ -40,6 +40,7 @@ import {
waterlog_placement,
} from "$/common/utils.ts";
import { collision_shape_at, type Shape } from "$/common/block_shapes.ts";
import { physics } from "$/common/physics.ts";
import { EXHAUSTION } from "./vitals.ts";
import {
type BlockComponentOf,
@@ -1744,20 +1745,20 @@ export class GameServer {
}
}
// feet on top of something solid, anywhere under the player's box
// feet on top of something solid, anywhere under the player's box: a thin box just under their feet touches a
// block's collision shape. shapes, not whole blocks, so standing on a fence, a slab or a path counts too
#on_ground(x: number, y: number, z: number) {
const fraction = y - Math.floor(y);
if (fraction > GROUND_EPSILON && fraction < 1 - GROUND_EPSILON) {
return false;
}
const below = Math.floor(y - GROUND_EPSILON);
const half = PLAYER_WIDTH / 2;
for (const [ox, oz] of [[-half, -half], [half, -half], [-half, half], [half, half]]) {
if (this.world.has_collision(Math.floor(x + ox), below, Math.floor(z + oz))) {
return true;
}
}
return false;
const under_feet = {
x,
y: y - GROUND_EPSILON,
z,
vx: 0,
vy: 0,
vz: 0,
width: PLAYER_WIDTH,
height: GROUND_EPSILON,
};
return !physics.box_is_free(under_feet, 0, 0, 0, (bx, by, bz) => this.world.collision_shape(bx, by, bz));
}
// in liquid, a waterlogged block's too
+15
View File
@@ -92,6 +92,21 @@ Deno.test("falling more than 3 blocks hurts, 1 per block after that, and water b
assertEquals(t.player.health, MAX_HEALTH);
});
Deno.test("landing on a fence ends a fall, so jumping on one and stepping off doesn't hurt", async () => {
const t = await setup();
// a fence's top is 1.5 blocks up, so standing on it isn't at a whole block
t.game.set_block(0, 100, 0, "bworld:oak_fence");
const at = (x: number, y: number) => t.send(1, { type: "move", x, y, z: 0.5, yaw: 0, pitch: 0 });
at(0.5, 101.5);
for (let jump = 0; jump < 4; jump++) {
for (const y of [102, 102.5, 102.75, 102.5, 102, 101.5]) at(0.5, y);
}
// off it, onto the stone
at(1.5, 101.5);
for (const y of [101, 100.5, 100]) at(1.5, y);
assertEquals(t.player.health, MAX_HEALTH);
});
Deno.test("health and hunger are sent to the player when they change, and saved", async () => {
const t = await setup();
t.take(1);