Randoloot/scripts/planets/surface_deposit.gd
2026-10-25 12:34:56 +01:00

23 lines
1.1 KiB
GDScript

extends Sprite2D
## Static world-space ore: no animated shimmer, screen-space noise or UV snapping.
const ORE := preload("res://assets/planets/mineral_deposit.png")
const DEUTERIUM := preload("res://assets/planets/deuterium_deposit.png")
const WIDTH := 128.0
func configure(map: Dictionary, poi: Dictionary) -> void:
name = "MineralDeposit%d" % int(poi.id)
texture = DEUTERIUM if poi.kind == "deep_deposit" else ORE
texture_filter = CanvasItem.TEXTURE_FILTER_LINEAR_WITH_MIPMAPS
position = poi.position
z_index = 10
var rng := RandomNumberGenerator.new()
rng.seed = int(map.seed) ^ (int(poi.id)*7919) ^ 0x4f524553
rotation = rng.randf_range(-0.35,0.35)
scale = Vector2.ONE*WIDTH*rng.randf_range(0.95,1.08)/maxf(texture.get_width(),texture.get_height())
var blend := ShaderMaterial.new()
blend.shader = preload("res://resources/effects/mineral_deposit.gdshader")
var tint: Color = (map.landscape.low as Color).lerp(map.landscape.high,0.4)*0.8
if int(map.profile.temperature) < -10: tint = tint.lerp(Color("b0bbb4"),0.55)
blend.set_shader_parameter("ground_tint",tint)
material = blend