@tool extends Node3D @export var seed_drop_rate:float = 1.0 @export var is_chopped:bool = true: get: return is_chopped set(value): if value != is_chopped: is_chopped = value _update_geometry() @onready var grass_large: Node3D = %grassLarge @onready var grow_timer: Timer = %GrowTimer @onready var item_spawner: ItemSpawner = %ItemSpawner # Called when the node enters the scene tree for the first time. func _ready() -> void: _update_geometry() grow_timer.wait_time = grow_timer.wait_time + grow_timer.wait_time * 0.2 * (randf() - 0.5) func _update_geometry() -> void: if grass_large == null: return if is_chopped: grass_large.transform = Transform3D(Basis.IDENTITY, grass_large.position) else: grass_large.transform = Transform3D(Basis.IDENTITY.scaled(Vector3(1, 3, 1)), grass_large.position) func _on_hitbox_area_shape_entered(_area_rid: RID, _area: Area3D, _area_shape_index: int, _local_shape_index: int) -> void: if is_chopped: return is_chopped = true grow_timer.start() item_spawner.spawn() func _on_grow_timer_timeout() -> void: if is_chopped: is_chopped = false