diff --git a/scripts/terrain.gd b/scripts/terrain.gd index 6ea6604..3609b82 100644 --- a/scripts/terrain.gd +++ b/scripts/terrain.gd @@ -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 ):