Add get_stat function to terrain.gd
This commit is contained in:
parent
293663b053
commit
ee46a240c2
@ -129,6 +129,20 @@ func modify_rect(
|
|||||||
)
|
)
|
||||||
update_texture()
|
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(
|
func setup_texture(
|
||||||
levels : Vector3i
|
levels : Vector3i
|
||||||
):
|
):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user