Add get_stat function to terrain.gd

This commit is contained in:
Zacharie Guet 2024-08-31 16:39:53 +02:00
parent 293663b053
commit ee46a240c2

View File

@ -129,6 +129,20 @@ func modify_rect(
)
update_texture()
func get_stat(
pos: Vector2,
stat : Stats
) :
var pixel_pos = map_to_pixel(pos)
var levels = color_to_levels(image.get_pixelv(pixel_pos))
match stat:
Stats.WATER:
return levels.x
Stats.FERTILITY:
return levels.y
Stats.TEMPERATURE:
return levels.z
func setup_texture(
levels : Vector3i
):