From c33d892cf0fecec27e7dfc616d19257d9503d3c0 Mon Sep 17 00:00:00 2001 From: RealMelwei Date: Sat, 11 Oct 2025 18:22:15 +0200 Subject: [PATCH] Active Vines now apply statusses --- player/player.gd | 4 +++- statusses/status.gd | 7 ++++++- vines_petals/vine.gd | 2 +- world/grid.gd | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/player/player.gd b/player/player.gd index 0d109b0..3576d41 100644 --- a/player/player.gd +++ b/player/player.gd @@ -76,6 +76,7 @@ func _ready() -> void: func _physics_process(delta: float) -> void: manage_velocity(delta) move_and_slide() + update_vine_statuses() func _process(delta: float) -> void: manage_iframes(delta) @@ -214,4 +215,5 @@ func play_double_jump_animation() -> void: func update_vine_statuses(): var location = Grid.get_location_from_world_pos(global_position) for vine : Vine in Grid.vines_per_node[location.x][location.y]: - Status.apply(vine.status_name, self, 0.1, vine.status_params) + if vine.active_depth > 0: #TODO: Properly manage procedural activation + Status.apply(vine.status_name, self, 0.1, vine.status_params) diff --git a/statusses/status.gd b/statusses/status.gd index 294f970..ae165bc 100644 --- a/statusses/status.gd +++ b/statusses/status.gd @@ -31,8 +31,13 @@ static func get_status(status_name : String, target : Node) -> Status: func _enter_tree() -> void: timeout.connect(expire) -func reapply(duration_new : float): +func reapply(duration_new : float, params_new : Dictionary = {}): self.start(max(duration_new, time_left)) + merge_params(params_new) + +func merge_params(params_new): + if name == "Slow": + params.slow_factor = min(params.slow_factor, params_new.slow_factor) func expire(): queue_free() diff --git a/vines_petals/vine.gd b/vines_petals/vine.gd index 88163e4..658e74c 100644 --- a/vines_petals/vine.gd +++ b/vines_petals/vine.gd @@ -5,7 +5,7 @@ class_name Vine extends Node2D @export var bud_resource : PackedScene var img_path_inactive = "res://vines_petals/vine_inactive.png" @export var img_path_active = "res://vines_petals/vine_active_green.png" -@export var status_name : String +@export var status_name : String = "Slow" @export var status_params : Dictionary = {} var active_depth = -1 var fully_active = false diff --git a/world/grid.gd b/world/grid.gd index d2cb1eb..c24cb99 100644 --- a/world/grid.gd +++ b/world/grid.gd @@ -53,7 +53,7 @@ func get_world_position (location: Vector2, offset: Vector2 = Vector2.ZERO) -> V func get_location_from_world_pos(pos : Vector2): var angle = pos.angle() - var x = floor(num_collumns * angle / TAU) + var x = floor(num_collumns * fposmod(angle, TAU) / TAU) var height = pos.length() var y = ceil((height - ground_radius)/cell_height) return Vector2(x, y)