Fixing elevation seams
All checks were successful
Deploy Promiscuity Auth API / deploy (push) Successful in 47s
Deploy Promiscuity Character API / deploy (push) Successful in 46s
Deploy Promiscuity Inventory API / deploy (push) Successful in 47s
Deploy Promiscuity Locations API / deploy (push) Successful in 46s
k8s smoke test / test (push) Successful in 8s

This commit is contained in:
Zeeshaun 2026-03-21 13:20:58 -05:00
parent f90de8a98b
commit c596b760cf

View File

@ -10,6 +10,7 @@ const CHARACTER_SLOT_COUNT := 6
@export var tile_size := 8.0
@export var block_height := 1.0
@export var elevation_step_height := 0.5
@export var tile_wall_thickness := 0.08
@export_range(1, 8, 1) var tile_radius := 3
@export var tracked_node_path: NodePath
@export var player_spawn_height := 2.0
@ -292,9 +293,10 @@ func _spawn_tile(coord: Vector2i, location_data: Dictionary) -> void:
var biome_material := _get_biome_material(tile, biome_key)
if biome_material:
tile.material_override = biome_material
tile_body.add_child(tile)
tile.add_child(_create_tile_border())
tile_body.add_child(tile)
_update_tile_edge_walls(tile_root, coord, biome_material)
tile.add_child(_create_tile_border())
if show_tile_labels:
tile_root.add_child(_create_tile_label(String(location_data.get("name", ""))))
_update_tile_object(tile_root, location_data)
@ -308,6 +310,11 @@ func _update_tile(coord: Vector2i, location_data: Dictionary) -> void:
if tile_root == null:
return
tile_root.position = _coord_to_world(coord)
var tile_mesh := tile_root.get_node_or_null("TileBody/TileMesh") as MeshInstance3D
var biome_material: Material = null
if tile_mesh:
biome_material = tile_mesh.material_override
_update_tile_edge_walls(tile_root, coord, biome_material)
if show_tile_labels:
var label := tile_root.get_node_or_null("LocationNameLabel") as Label3D
@ -382,7 +389,7 @@ func _update_tile_inventory(tile_root: Node3D, location_data: Dictionary) -> voi
existing_label.text = _build_floor_inventory_label(floor_items)
func _create_tile_border() -> MeshInstance3D:
func _create_tile_border() -> MeshInstance3D:
var top_y := 0.5 + border_height_bias
var corners := [
Vector3(-0.5, top_y, -0.5),
@ -402,8 +409,47 @@ func _create_tile_border() -> MeshInstance3D:
var border := MeshInstance3D.new()
border.name = "TileBorder"
border.mesh = border_mesh
return border
border.mesh = border_mesh
return border
func _update_tile_edge_walls(tile_root: Node3D, coord: Vector2i, biome_material: Material) -> void:
var walls_root := tile_root.get_node_or_null("TileEdgeWalls") as Node3D
if walls_root == null:
walls_root = Node3D.new()
walls_root.name = "TileEdgeWalls"
tile_root.add_child(walls_root)
for child in walls_root.get_children():
child.queue_free()
var current_bottom := _get_tile_bottom_y(coord)
var directions := [
{"name": "NorthWall", "offset": Vector2i(0, -1), "position": Vector3(0.0, 0.0, -((tile_size * 0.5) - (tile_wall_thickness * 0.5))), "scale": Vector3(tile_size, 1.0, tile_wall_thickness)},
{"name": "SouthWall", "offset": Vector2i(0, 1), "position": Vector3(0.0, 0.0, (tile_size * 0.5) - (tile_wall_thickness * 0.5)), "scale": Vector3(tile_size, 1.0, tile_wall_thickness)},
{"name": "WestWall", "offset": Vector2i(-1, 0), "position": Vector3(-((tile_size * 0.5) - (tile_wall_thickness * 0.5)), 0.0, 0.0), "scale": Vector3(tile_wall_thickness, 1.0, tile_size)},
{"name": "EastWall", "offset": Vector2i(1, 0), "position": Vector3((tile_size * 0.5) - (tile_wall_thickness * 0.5), 0.0, 0.0), "scale": Vector3(tile_wall_thickness, 1.0, tile_size)}
]
for entry_variant in directions:
var entry := entry_variant as Dictionary
var neighbor_coord := coord + (entry["offset"] as Vector2i)
var neighbor_top := _get_neighbor_top_y(neighbor_coord)
if neighbor_top >= current_bottom:
continue
var wall_height := current_bottom - neighbor_top
var wall := MeshInstance3D.new()
wall.name = String(entry["name"])
var wall_mesh := BoxMesh.new()
wall_mesh.size = Vector3(1, 1, 1)
wall.mesh = wall_mesh
wall.scale = (entry["scale"] as Vector3) * Vector3(1.0, wall_height, 1.0)
var wall_position := entry["position"] as Vector3
wall.position = Vector3(wall_position.x, -(block_height * 0.5) - (wall_height * 0.5), wall_position.z)
if biome_material:
wall.material_override = biome_material
walls_root.add_child(wall)
func _get_border_material() -> StandardMaterial3D:
@ -491,10 +537,20 @@ func _get_tile_center_y(coord: Vector2i) -> float:
return (_get_tile_elevation(coord) * elevation_step_height) + (block_height * 0.5)
func _get_tile_bottom_y(coord: Vector2i) -> float:
return _get_tile_elevation(coord) * elevation_step_height
func _get_tile_surface_y(coord: Vector2i) -> float:
return (_get_tile_elevation(coord) * elevation_step_height) + block_height
func _get_neighbor_top_y(coord: Vector2i) -> float:
if _known_locations.has(coord):
return _get_tile_surface_y(coord)
return _get_tile_bottom_y(coord)
func _update_inventory_location_label() -> void:
if _inventory_location_label == null:
return