Randoloot/scripts/planets/surface_cave.gd
2026-10-18 16:22:39 +02:00

17 lines
748 B
GDScript

extends Sprite2D
## Static artwork attached to a preserved mountain foothill.
const TEXTURE := preload("res://assets/planets/poi/cave_entrance.png")
func configure(map: Dictionary, poi: Dictionary) -> void:
name = "MountainCave%d" % int(poi.id)
texture = TEXTURE
texture_filter = CanvasItem.TEXTURE_FILTER_LINEAR_WITH_MIPMAPS
position = poi.position
scale = Vector2.ONE*195.0/TEXTURE.get_width()
offset = Vector2(0,-TEXTURE.get_height()*0.10)
z_index = 10
var blend := ShaderMaterial.new()
blend.shader = preload("res://resources/effects/cave_blend.gdshader")
blend.set_shader_parameter("rock_tint",map.landscape.rock)
blend.set_shader_parameter("ground_tint",(map.landscape.low as Color).lerp(map.landscape.high,0.4))
material = blend