@tool
extends WorldEnvironment
## Applies its environment only at runtime, so the editor viewport stays lit.
## Assign your dark torchlight environment to `runtime_environment` in the
## inspector instead of the normal `environment` slot.

@export var runtime_environment: Environment :
	set(value):
		runtime_environment = value
		if not Engine.is_editor_hint():
			environment = value


func _enter_tree() -> void:
	if Engine.is_editor_hint():
		environment = null
	else:
		environment = runtime_environment
