From 5fee47e998751b530c93368d935f4cfb6e5150f9 Mon Sep 17 00:00:00 2001 From: Claude Code Date: Sat, 28 Mar 2026 21:31:37 -0700 Subject: [PATCH] =?UTF-8?q?feat(events):=20=E2=9C=A8=20Add=20event=20handl?= =?UTF-8?q?ers=20and=20callbacks=20for=20marine=20harvesting=20operations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Lilith Autocommit --- engine/src/modules/events/marine_harvest.gd | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/engine/src/modules/events/marine_harvest.gd b/engine/src/modules/events/marine_harvest.gd index 271b25d5..7e13378b 100644 --- a/engine/src/modules/events/marine_harvest.gd +++ b/engine/src/modules/events/marine_harvest.gd @@ -20,9 +20,6 @@ const MARINE_RESOURCE_IDS: Array[String] = [ "pearl_beds", "leviathan_grounds", "kraken_ink_vent", ] -## Water biome IDs where fishing spots can migrate to. -const WATER_BIOMES: Array[String] = ["coast", "ocean", "lake", "inland_sea"] - const STOCK_MAX: int = 100 const STOCK_RECOVERY: int = 1 # +1 stock/turn when no boats present const STOCK_DEPLETION_PER_BOAT: int = 3 # -3 stock/turn per fishing unit on tile @@ -125,7 +122,7 @@ func _migrate_fishing_spot(game_map: RefCounted, axial: Vector2i, tile: Variant) var nb: Variant = game_map.tiles.get(nb_pos) if nb == null: continue - if nb.biome_id not in WATER_BIOMES: + if not BiomeRegistry.has_tag(nb.biome_id, "is_water"): continue if nb.resource_id != "": continue @@ -216,7 +213,7 @@ func apply_iron_seeding(game_map: RefCounted, origin: Vector2i, current_dir: int for _step: int in 6: var nb_pos: Vector2i = pos + HexUtilsScript.AXIAL_DIRECTIONS[current_dir] var nb: Variant = game_map.tiles.get(nb_pos) - if nb == null or nb.biome_id not in WATER_BIOMES: + if nb == null or not BiomeRegistry.has_tag(nb.biome_id, "is_water"): break nb.marine_bloom_turns = maxi(nb.marine_bloom_turns, 6 - _step) if nb.fish_stock >= 0: @@ -297,7 +294,7 @@ func _compute_ocean_dead_fraction(game_map: RefCounted) -> void: var dead_coast: int = 0 for axial: Vector2i in game_map.tiles: var tile: Variant = game_map.tiles[axial] - if tile.biome_id != "coast": + if not BiomeRegistry.has_tag(tile.biome_id, "is_coast"): continue total_coast += 1 if tile.fish_stock == 0 and tile.resource_id == "": @@ -347,7 +344,7 @@ func apply_necro_bloom(game_map: RefCounted, axial: Vector2i) -> void: return # not a dead spot # Resurrect as merfolk_shallows (closest generic coastal resource) - tile.resource_id = "merfolk_shallows" if tile.biome_id == "coast" else "leviathan_grounds" + tile.resource_id = "merfolk_shallows" if BiomeRegistry.has_tag(tile.biome_id, "is_coast") else "leviathan_grounds" tile.fish_stock = 50 EventBus.fishing_spot_migrated.emit(axial, axial) # "migrated" back to same tile @@ -355,7 +352,7 @@ func apply_necro_bloom(game_map: RefCounted, axial: Vector2i) -> void: func spawn_marine_creature(game_map: RefCounted, axial: Vector2i, creature: String) -> void: ## Death/Chaos spell entry point: place a corrupted creature on a water tile. var tile: Variant = game_map.tiles.get(axial) - if tile == null or tile.biome_id not in WATER_BIOMES: + if tile == null or not BiomeRegistry.has_tag(tile.biome_id, "is_water"): return if tile.marine_creature != "": return # already occupied