Refactor vault camera and grid logic for improved zoom and positioning. Adjusted zoom step value, refined camera limits based on vault structure, and updated grid depth calculations. Enhanced drawing functions in vault view to include entrance visualization and corrected depth handling for pebbles and dirt rendering.
This commit is contained in:
@@ -11,6 +11,10 @@ const CELL := Vector2(140.0, 120.0)
|
||||
const COLUMNS := 9
|
||||
const FLOORS := 6
|
||||
const ELEVATOR_COLUMN := 0
|
||||
## Насколько верхний этаж утоплен под поверхность. y = 0 — уровень земли,
|
||||
## выше — небо. Смещение живёт здесь, а не в отрисовке, чтобы вместе с
|
||||
## картинкой уехали и попадание мышью, и границы камеры.
|
||||
const DEPTH := 360.0
|
||||
|
||||
## Типы комнат: подпись, цвет, ширина в ячейках и баланс ресурсов за цикл.
|
||||
const KINDS := {
|
||||
@@ -106,7 +110,7 @@ func remove_at(a_floor: int, column: int) -> bool:
|
||||
|
||||
static func cell_rect(a_floor: int, column: int, width: int = 1) -> Rect2:
|
||||
return Rect2(
|
||||
Vector2(column * CELL.x, a_floor * CELL.y),
|
||||
Vector2(column * CELL.x, DEPTH + a_floor * CELL.y),
|
||||
Vector2(CELL.x * width, CELL.y)
|
||||
)
|
||||
|
||||
@@ -120,13 +124,13 @@ static func room_rect(room: Dictionary) -> Rect2:
|
||||
static func cell_at(local_position: Vector2) -> Vector2i:
|
||||
return Vector2i(
|
||||
int(floor(local_position.x / CELL.x)),
|
||||
int(floor(local_position.y / CELL.y))
|
||||
int(floor((local_position.y - DEPTH) / CELL.y))
|
||||
)
|
||||
|
||||
|
||||
## Прямоугольник всего убежища в координатах вида.
|
||||
static func bounds() -> Rect2:
|
||||
return Rect2(Vector2.ZERO, Vector2(COLUMNS * CELL.x, FLOORS * CELL.y))
|
||||
return Rect2(Vector2(0.0, DEPTH), Vector2(COLUMNS * CELL.x, FLOORS * CELL.y))
|
||||
|
||||
|
||||
# --- Сводка по ресурсам -----------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user