22 lines
974 B
GDScript
22 lines
974 B
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 WIDTH := 128.0
|
|
|
|
func configure(map: Dictionary, poi: Dictionary) -> void:
|
|
name = "MineralDeposit%d" % int(poi.id)
|
|
texture = 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(ORE.get_width(),ORE.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
|