asset vibe

This commit is contained in:
Marek Lenczewski
2026-04-16 18:02:03 +02:00
parent f21e30eb55
commit 4b0f82c1de
28 changed files with 713 additions and 60 deletions

View File

@@ -54,6 +54,7 @@ func _chase(entity: Node, data: Dictionary, data_source: Node) -> void:
direction.y = 0
entity.velocity.x = direction.x * base.speed
entity.velocity.z = direction.z * base.speed
_face_target(entity, data["target"])
func _attack(entity: Node, data: Dictionary, data_source: Node, delta: float) -> void:
data["attack_timer"] -= delta
@@ -72,8 +73,21 @@ func _attack(entity: Node, data: Dictionary, data_source: Node, delta: float) ->
data["attack_timer"] = base.attack_cooldown
var scale: float = data.get("scale", 1.0)
EventBus.damage_requested.emit(entity, data["target"], base.attack_damage * scale)
EventBus.attack_executed.emit(entity, entity.global_position, -entity.global_transform.basis.z, base.attack_damage * scale)
entity.velocity.x = 0
entity.velocity.z = 0
_face_target(entity, data["target"])
func _face_target(entity: Node3D, target: Node3D) -> void:
if not is_instance_valid(target):
return
var to_target: Vector3 = target.global_position - entity.global_position
to_target.y = 0
if to_target.length() < 0.01:
return
var yaw: float = atan2(-to_target.x, -to_target.z)
var delta: float = get_physics_process_delta_time()
entity.rotation.y = lerp_angle(entity.rotation.y, yaw, 8.0 * delta)
func _return_to_spawn(entity: Node, data: Dictionary, data_source: Node, delta: float) -> void:
var spawn_pos: Vector3 = data["spawn_position"]