WIP: merge recipies
This commit is contained in:
+26
-1
@@ -67,6 +67,11 @@ func _make_kick_arc_mesh() -> ArrayMesh:
|
||||
mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, arrays)
|
||||
return mesh
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event is InputEventKey and event.pressed and not event.echo:
|
||||
if event.keycode == KEY_E:
|
||||
_try_interact()
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if not is_alive:
|
||||
return
|
||||
@@ -130,7 +135,7 @@ func _do_kick() -> void:
|
||||
forward.y = 0.0
|
||||
forward = forward.normalized() if forward.length() > 0.01 else Vector3(0.0, 0.0, -1.0)
|
||||
var half_cos: float = cos(deg_to_rad(kick_angle * 0.5))
|
||||
var enemies := get_tree().get_nodes_in_group("enemies") + get_tree().get_nodes_in_group("rocks")
|
||||
var enemies := get_tree().get_nodes_in_group("enemies") + get_tree().get_nodes_in_group("kickable")
|
||||
var kicked_any := false
|
||||
for e in enemies:
|
||||
if not is_instance_valid(e):
|
||||
@@ -149,6 +154,20 @@ func _do_kick() -> void:
|
||||
if kicked_any:
|
||||
_squish_effect()
|
||||
|
||||
func _try_interact() -> void:
|
||||
var best: Node3D = null
|
||||
var best_dist := 2.5
|
||||
for node in get_tree().get_nodes_in_group("interactable"):
|
||||
var n := node as Node3D
|
||||
if n == null:
|
||||
continue
|
||||
var d := global_position.distance_to(n.global_position)
|
||||
if d < best_dist:
|
||||
best_dist = d
|
||||
best = n
|
||||
if best != null:
|
||||
best.call("interact", self)
|
||||
|
||||
func set_aim_direction(yaw_rad: float) -> void:
|
||||
_aim_yaw = yaw_rad
|
||||
_is_aiming = true
|
||||
@@ -197,3 +216,9 @@ func apply_upgrade(id: String) -> void:
|
||||
max_health += 30
|
||||
health = min(health + 30, max_health)
|
||||
emit_signal("health_changed", health, max_health)
|
||||
|
||||
func apply_upgrade_boots(speed_bonus: float, _tier: int) -> void:
|
||||
move_speed += speed_bonus
|
||||
var tw := create_tween()
|
||||
tw.tween_property(player_mat, "albedo_color", Color(1.0, 0.85, 0.2), 0.1)
|
||||
tw.tween_property(player_mat, "albedo_color", BASE_COLOR, 0.4)
|
||||
|
||||
Reference in New Issue
Block a user