class_name ScaleMultiplier
extends Node3D

@export var target_node: Node3D = null
@export var scale_multiplier: float = 1.0
var parent_node: Node3D

func _enter_tree() -> void:
	parent_node = get_parent()

func _ready() -> void:
	if not parent_node:
		parent_node = get_parent()
	_update_scale()

func _process(_delta: float) -> void:
	if not parent_node:
		parent_node = get_parent()
	_update_scale()

func _update_scale() -> void:
	if not target_node or not parent_node:
		return
		
	# Calculate relative scale from base of 1
	var relative_scale = (target_node.scale - Vector3.ONE) * scale_multiplier + Vector3.ONE
	
	parent_node.scale = relative_scale
