Much stuff wow
This commit is contained in:
parent
7255cbdf64
commit
734730beee
45 changed files with 697 additions and 119 deletions
|
|
@ -5,15 +5,45 @@ extends Control
|
|||
@onready var loaded_ojects_label = $PanelContainer/VBoxContainer/LoadedTreesLabel
|
||||
|
||||
func _ready() -> void:
|
||||
update_map_size()
|
||||
update_cell_count()
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
func _process(_delta: float) -> void:
|
||||
update_map_size()
|
||||
update_loaded_cells_count()
|
||||
update_loaded_objects()
|
||||
|
||||
func update_map_size() -> void:
|
||||
map_size_label.text = 'Map Dimensions: ' + str(Global.map_height) + 'x' + str(Global.map_width)
|
||||
var player_pos = %Player.position
|
||||
var cell_x = int(player_pos.x / 2.0)
|
||||
var cell_z = int(player_pos.z / 2.0)
|
||||
|
||||
# Get biome data for current cell
|
||||
var biome_info = ""
|
||||
if Global.biome_data != null and not Global.biome_data.is_empty():
|
||||
# Check bounds to avoid errors
|
||||
var moisture_img = Global.biome_data.get("moisture")
|
||||
var temp_img = Global.biome_data.get("temperature")
|
||||
var elev_img = Global.biome_data.get("elevation")
|
||||
|
||||
if moisture_img != null and temp_img != null and elev_img != null:
|
||||
# Make sure coordinates are within image bounds
|
||||
var img_width = moisture_img.get_width()
|
||||
var img_height = moisture_img.get_height()
|
||||
|
||||
if cell_x >= 0 and cell_x < img_width and cell_z >= 0 and cell_z < img_height:
|
||||
var moisture = moisture_img.get_pixel(cell_x, cell_z).r
|
||||
var temperature = temp_img.get_pixel(cell_x, cell_z).r
|
||||
var elevation = elev_img.get_pixel(cell_x, cell_z).r
|
||||
|
||||
biome_info = "\nMoisture: %.2f | Temp: %.2f | Elevation: %.2f" % [moisture, temperature, elevation]
|
||||
else:
|
||||
biome_info = "\nBiome: Out of bounds"
|
||||
else:
|
||||
biome_info = "\nBiome: Data not available"
|
||||
else:
|
||||
biome_info = "\nBiome: Not initialized"
|
||||
|
||||
map_size_label.text = 'X: %.1f, Z: %.1f | Cell: (%d, %d)%s' % [player_pos.x, player_pos.z, cell_x, cell_z, biome_info]
|
||||
|
||||
func update_cell_count() -> void:
|
||||
cell_count_label.text = 'Cell Count: ' + str(Global.map_height * Global.map_width)
|
||||
|
|
@ -81,13 +111,3 @@ func format_bytes(bytes: float) -> String:
|
|||
return str(int(bytes / 1024)) + "KB"
|
||||
else:
|
||||
return str(int(bytes / (1024 * 1024))) + "MB"
|
||||
|
||||
# Add to your debug script
|
||||
func track_orphan_creation():
|
||||
# Hook into the scene tree to catch orphan creation
|
||||
get_tree().node_removed.connect(_on_node_orphaned)
|
||||
|
||||
func _on_node_orphaned(node: Node):
|
||||
print("Orphan created: ", node.name, " (", node.get_class(), ")")
|
||||
if node.get_script():
|
||||
print(" Script: ", node.get_script().resource_path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue