From 9c5a15542a1ca2689ecd4a1b075cc58e84d2947e Mon Sep 17 00:00:00 2001 From: paulaboks Date: Thu, 8 Oct 2026 15:14:23 -0300 Subject: [PATCH] Fishing seasons --- mods/bworld/items/fishing_rod.json | 3 +-- .../loot_tables/gameplay/fishing_autumn.json | 15 +++++++++++++++ .../loot_tables/gameplay/fishing_spring.json | 15 +++++++++++++++ .../{fishing.json => fishing_summer.json} | 0 .../loot_tables/gameplay/fishing_winter.json | 19 +++++++++++++++++++ mods/bworld/scripts/server.ts | 9 ++++++--- 6 files changed, 56 insertions(+), 5 deletions(-) create mode 100644 mods/bworld/loot_tables/gameplay/fishing_autumn.json create mode 100644 mods/bworld/loot_tables/gameplay/fishing_spring.json rename mods/bworld/loot_tables/gameplay/{fishing.json => fishing_summer.json} (100%) create mode 100644 mods/bworld/loot_tables/gameplay/fishing_winter.json diff --git a/mods/bworld/items/fishing_rod.json b/mods/bworld/items/fishing_rod.json index e4d549b..f0c10f7 100644 --- a/mods/bworld/items/fishing_rod.json +++ b/mods/bworld/items/fishing_rod.json @@ -17,8 +17,7 @@ "bite": [ 20, 40 - ], - "loot_table": "bworld:gameplay/fishing" + ] } } } diff --git a/mods/bworld/loot_tables/gameplay/fishing_autumn.json b/mods/bworld/loot_tables/gameplay/fishing_autumn.json new file mode 100644 index 0000000..baae394 --- /dev/null +++ b/mods/bworld/loot_tables/gameplay/fishing_autumn.json @@ -0,0 +1,15 @@ +{ + "format_version": 1, + "loot_table": { + "pools": [ + { + "entries": [ + { + "item": "bworld:salmon", + "weight": 60 + } + ] + } + ] + } +} diff --git a/mods/bworld/loot_tables/gameplay/fishing_spring.json b/mods/bworld/loot_tables/gameplay/fishing_spring.json new file mode 100644 index 0000000..3a3bea5 --- /dev/null +++ b/mods/bworld/loot_tables/gameplay/fishing_spring.json @@ -0,0 +1,15 @@ +{ + "format_version": 1, + "loot_table": { + "pools": [ + { + "entries": [ + { + "item": "bworld:cod", + "weight": 60 + } + ] + } + ] + } +} diff --git a/mods/bworld/loot_tables/gameplay/fishing.json b/mods/bworld/loot_tables/gameplay/fishing_summer.json similarity index 100% rename from mods/bworld/loot_tables/gameplay/fishing.json rename to mods/bworld/loot_tables/gameplay/fishing_summer.json diff --git a/mods/bworld/loot_tables/gameplay/fishing_winter.json b/mods/bworld/loot_tables/gameplay/fishing_winter.json new file mode 100644 index 0000000..3f9d9c5 --- /dev/null +++ b/mods/bworld/loot_tables/gameplay/fishing_winter.json @@ -0,0 +1,19 @@ +{ + "format_version": 1, + "loot_table": { + "pools": [ + { + "entries": [ + { + "item": "bworld:cod", + "weight": 60 + }, + { + "item": "bworld:salmon", + "weight": 25 + } + ] + } + ] + } +} diff --git a/mods/bworld/scripts/server.ts b/mods/bworld/scripts/server.ts index 77b98ce..84cbe0f 100644 --- a/mods/bworld/scripts/server.ts +++ b/mods/bworld/scripts/server.ts @@ -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);