Adding elevation
Deploy Promiscuity Auth API / deploy (push) Successful in 48s
Deploy Promiscuity Character API / deploy (push) Successful in 1m0s
Deploy Promiscuity Inventory API / deploy (push) Successful in 47s
Deploy Promiscuity Locations API / deploy (push) Successful in 1m0s
k8s smoke test / test (push) Successful in 9s

This commit is contained in:
2026-03-21 13:09:41 -05:00
parent c5e692c051
commit f90de8a98b
5 changed files with 108 additions and 14 deletions
+29 -12
View File
@@ -8,8 +8,9 @@ const SETTINGS_SCENE := "res://scenes/UI/Settings.tscn"
const CHARACTER_SLOT_COUNT := 6
@export var tile_size := 8.0
@export var block_height := 1.0
@export_range(1, 8, 1) var tile_radius := 3
@export var block_height := 1.0
@export var elevation_step_height := 0.5
@export_range(1, 8, 1) var tile_radius := 3
@export var tracked_node_path: NodePath
@export var player_spawn_height := 2.0
@export var border_color: Color = Color(0.05, 0.05, 0.05, 1.0)
@@ -129,14 +130,14 @@ func _world_to_coord(world_pos: Vector3) -> Vector2i:
)
func _coord_to_world(coord: Vector2i) -> Vector3:
return Vector3(coord.x * tile_size, block_height * 0.5, coord.y * tile_size)
func _coord_to_world(coord: Vector2i) -> Vector3:
return Vector3(coord.x * tile_size, _get_tile_center_y(coord), coord.y * tile_size)
func _move_player_to_coord(coord: Vector2i) -> void:
if _player == null:
return
_player.global_position = Vector3(coord.x * tile_size, player_spawn_height, coord.y * tile_size)
_player.global_position = Vector3(coord.x * tile_size, _get_tile_surface_y(coord) + player_spawn_height, coord.y * tile_size)
_player.linear_velocity = Vector3.ZERO
_player.angular_velocity = Vector3.ZERO
@@ -302,11 +303,12 @@ func _spawn_tile(coord: Vector2i, location_data: Dictionary) -> void:
_tile_nodes[coord] = tile_root
func _update_tile(coord: Vector2i, location_data: Dictionary) -> void:
var tile_root := _tile_nodes.get(coord) as Node3D
if tile_root == null:
return
func _update_tile(coord: Vector2i, location_data: Dictionary) -> void:
var tile_root := _tile_nodes.get(coord) as Node3D
if tile_root == null:
return
tile_root.position = _coord_to_world(coord)
if show_tile_labels:
var label := tile_root.get_node_or_null("LocationNameLabel") as Label3D
if label:
@@ -480,6 +482,19 @@ func _build_floor_inventory_label(floor_items: Array) -> String:
return label
func _get_tile_elevation(coord: Vector2i) -> int:
var location_data := _get_location_data(coord)
return int(location_data.get("elevation", 0))
func _get_tile_center_y(coord: Vector2i) -> float:
return (_get_tile_elevation(coord) * elevation_step_height) + (block_height * 0.5)
func _get_tile_surface_y(coord: Vector2i) -> float:
return (_get_tile_elevation(coord) * elevation_step_height) + block_height
func _update_inventory_location_label() -> void:
if _inventory_location_label == null:
return
@@ -812,6 +827,7 @@ func _ensure_selected_location_exists(coord: Vector2i) -> void:
"id": "",
"name": _selected_location_name(coord),
"biomeKey": "plains",
"elevation": 0,
"locationObject": {},
"floorItems": []
}
@@ -889,6 +905,7 @@ func _load_existing_locations() -> void:
"id": String(location.get("id", "")).strip_edges(),
"name": location_name,
"biomeKey": String(location.get("biomeKey", "plains")).strip_edges(),
"elevation": int(location.get("elevation", 0)),
"locationObject": _parse_location_object(location.get("locationObject", {})),
"floorItems": _parse_floor_inventory_items(location.get("floorItems", []))
}