feat(wiring): MobSpawner integration + take_damage API on dolphin

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Floppyrj45
2026-04-19 17:18:31 +02:00
parent 37e66a1350
commit 0c309405a7
3 changed files with 22 additions and 0 deletions

View File

@@ -40,6 +40,15 @@ func _ready() -> void:
inventory.add_item(6, 5) # 5 KELP
inventory.add_item(8, 2) # 2 ICE
# Add dolphin to player group (for mob detection)
dolphin.add_to_group("player")
# Spawner de mobs
var MobSpawnerScene: PackedScene = load("res://scenes/mobs/MobSpawner.tscn")
var mob_spawner: Node3D = MobSpawnerScene.instantiate()
add_child(mob_spawner)
mob_spawner.player = mob_spawner.get_path_to(dolphin)
func _process(_delta: float) -> void:
world.update_player_position(dolphin.global_position)

View File

@@ -250,6 +250,13 @@ func _raycast(reach: float) -> Dictionary:
return result
func take_damage(amount: float) -> void:
health = max(0.0, health - amount)
emit_signal("stats_changed", oxygen, health, hunger)
if health <= 0.0:
emit_signal("player_died")
func _trigger_echolocation() -> void:
if is_echolocating:
return