Fishing seasons

This commit is contained in:
2026-10-08 15:14:23 -03:00
parent a2ed562817
commit 9c5a15542a
6 changed files with 56 additions and 5 deletions
+1 -2
View File
@@ -17,8 +17,7 @@
"bite": [
20,
40
],
"loot_table": "bworld:gameplay/fishing"
]
}
}
}
@@ -0,0 +1,15 @@
{
"format_version": 1,
"loot_table": {
"pools": [
{
"entries": [
{
"item": "bworld:salmon",
"weight": 60
}
]
}
]
}
}
@@ -0,0 +1,15 @@
{
"format_version": 1,
"loot_table": {
"pools": [
{
"entries": [
{
"item": "bworld:cod",
"weight": 60
}
]
}
]
}
}
@@ -0,0 +1,19 @@
{
"format_version": 1,
"loot_table": {
"pools": [
{
"entries": [
{
"item": "bworld:cod",
"weight": 60
},
{
"item": "bworld:salmon",
"weight": 25
}
]
}
]
}
}
+6 -3
View File
@@ -628,8 +628,6 @@ interface FishingRodParams {
wait: [number, number];
// ticks it stays on the hook before it gets away
bite: [number, number];
// what's caught, a loot table
loot_table: string;
}
interface Cast {
@@ -706,7 +704,12 @@ function register_fishing(ctx: ServerContext) {
const cast = casts.get(player.id);
if (cast) {
if (cast.escape_at !== undefined) {
const loot = ctx.loot.roll(params.loot_table, { position: cast.position, player, tool: rod });
const season = ctx.world.season_at(
cast.hook.position.x,
cast.hook.position.z,
);
const loot_table = `bworld:gameplay/fishing_${season}`;
const loot = ctx.loot.roll(loot_table, { position: cast.position, player, tool: rod });
for (const item of loot) player.give_item(item.id, item.count, item.data);
}
stop(player, player.id);