Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2cc5d4e013 | ||
|
|
c3bc1b3501 |
@@ -7,6 +7,15 @@
|
|||||||
"nutrition": 2,
|
"nutrition": 2,
|
||||||
"saturation_modifier": 0.1
|
"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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,15 @@
|
|||||||
"nutrition": 2,
|
"nutrition": 2,
|
||||||
"saturation_modifier": 0.1
|
"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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,15 @@
|
|||||||
"nutrition": 2,
|
"nutrition": 2,
|
||||||
"saturation_modifier": 0.1
|
"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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,15 @@
|
|||||||
"nutrition": 2,
|
"nutrition": 2,
|
||||||
"saturation_modifier": 0.1
|
"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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,15 @@
|
|||||||
"nutrition": 2,
|
"nutrition": 2,
|
||||||
"saturation_modifier": 0.1
|
"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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,15 @@
|
|||||||
"nutrition": 2,
|
"nutrition": 2,
|
||||||
"saturation_modifier": 0.1
|
"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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,15 @@
|
|||||||
"nutrition": 2,
|
"nutrition": 2,
|
||||||
"saturation_modifier": 0.1
|
"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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,15 @@
|
|||||||
"nutrition": 2,
|
"nutrition": 2,
|
||||||
"saturation_modifier": 0.1
|
"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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,15 @@
|
|||||||
"nutrition": 2,
|
"nutrition": 2,
|
||||||
"saturation_modifier": 0.1
|
"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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,15 @@
|
|||||||
"nutrition": 2,
|
"nutrition": 2,
|
||||||
"saturation_modifier": 0.1
|
"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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,16 @@
|
|||||||
"nutrition": 2,
|
"nutrition": 2,
|
||||||
"saturation_modifier": 0.1
|
"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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,15 @@
|
|||||||
"nutrition": 2,
|
"nutrition": 2,
|
||||||
"saturation_modifier": 0.1
|
"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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,15 @@
|
|||||||
"nutrition": 2,
|
"nutrition": 2,
|
||||||
"saturation_modifier": 0.1
|
"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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,16 @@
|
|||||||
"nutrition": 2,
|
"nutrition": 2,
|
||||||
"saturation_modifier": 0.1
|
"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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,15 @@
|
|||||||
"nutrition": 2,
|
"nutrition": 2,
|
||||||
"saturation_modifier": 0.1
|
"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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,15 @@
|
|||||||
"nutrition": 2,
|
"nutrition": 2,
|
||||||
"saturation_modifier": 0.1
|
"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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,15 @@
|
|||||||
"nutrition": 2,
|
"nutrition": 2,
|
||||||
"saturation_modifier": 0.1
|
"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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,15 @@
|
|||||||
"nutrition": 2,
|
"nutrition": 2,
|
||||||
"saturation_modifier": 0.1
|
"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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,16 @@
|
|||||||
"nutrition": 2,
|
"nutrition": 2,
|
||||||
"saturation_modifier": 0.1
|
"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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,15 @@
|
|||||||
"nutrition": 2,
|
"nutrition": 2,
|
||||||
"saturation_modifier": 0.1
|
"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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,15 @@
|
|||||||
"nutrition": 2,
|
"nutrition": 2,
|
||||||
"saturation_modifier": 0.1
|
"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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,15 @@
|
|||||||
"nutrition": 2,
|
"nutrition": 2,
|
||||||
"saturation_modifier": 0.1
|
"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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,15 @@
|
|||||||
"nutrition": 2,
|
"nutrition": 2,
|
||||||
"saturation_modifier": 0.1
|
"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
@@ -40,6 +40,7 @@ import {
|
|||||||
waterlog_placement,
|
waterlog_placement,
|
||||||
} from "$/common/utils.ts";
|
} from "$/common/utils.ts";
|
||||||
import { collision_shape_at, type Shape } from "$/common/block_shapes.ts";
|
import { collision_shape_at, type Shape } from "$/common/block_shapes.ts";
|
||||||
|
import { physics } from "$/common/physics.ts";
|
||||||
import { EXHAUSTION } from "./vitals.ts";
|
import { EXHAUSTION } from "./vitals.ts";
|
||||||
import {
|
import {
|
||||||
type BlockComponentOf,
|
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) {
|
#on_ground(x: number, y: number, z: number) {
|
||||||
const fraction = y - Math.floor(y);
|
const under_feet = {
|
||||||
if (fraction > GROUND_EPSILON && fraction < 1 - GROUND_EPSILON) {
|
x,
|
||||||
return false;
|
y: y - GROUND_EPSILON,
|
||||||
}
|
z,
|
||||||
const below = Math.floor(y - GROUND_EPSILON);
|
vx: 0,
|
||||||
const half = PLAYER_WIDTH / 2;
|
vy: 0,
|
||||||
for (const [ox, oz] of [[-half, -half], [half, -half], [-half, half], [half, half]]) {
|
vz: 0,
|
||||||
if (this.world.has_collision(Math.floor(x + ox), below, Math.floor(z + oz))) {
|
width: PLAYER_WIDTH,
|
||||||
return true;
|
height: GROUND_EPSILON,
|
||||||
}
|
};
|
||||||
}
|
return !physics.box_is_free(under_feet, 0, 0, 0, (bx, by, bz) => this.world.collision_shape(bx, by, bz));
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// in liquid, a waterlogged block's too
|
// in liquid, a waterlogged block's too
|
||||||
|
|||||||
@@ -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);
|
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 () => {
|
Deno.test("health and hunger are sent to the player when they change, and saved", async () => {
|
||||||
const t = await setup();
|
const t = await setup();
|
||||||
t.take(1);
|
t.take(1);
|
||||||
|
|||||||
Reference in New Issue
Block a user