2026-04-15 10:45:43 -05:00
|
|
|
extends Building
|
|
|
|
|
|
|
|
|
|
var money: int = 0:
|
|
|
|
|
set(value):
|
|
|
|
|
money = value
|
|
|
|
|
_set_money_label()
|
|
|
|
|
|
|
|
|
|
@onready var money_label: Label = %MoneyLabel
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func can_citizen_enter(coord: Vector2i, direction: Board.Direction) -> bool:
|
|
|
|
|
var up_adjustment := Board.get_next_direction(Board.Direction.UP, get_rotation_count())
|
|
|
|
|
var right_adjustment := Board.get_next_direction(Board.Direction.RIGHT, get_rotation_count())
|
|
|
|
|
var correct_heading_1 := Board.get_next_direction(Board.Direction.LEFT, get_rotation_count())
|
|
|
|
|
var correct_heading_2 := Board.get_next_direction(Board.Direction.UP, get_rotation_count())
|
|
|
|
|
|
|
|
|
|
var entrance_1 := (
|
|
|
|
|
starting_coord
|
|
|
|
|
+ Board.get_direction_vector(up_adjustment)
|
|
|
|
|
+ Board.get_direction_vector(right_adjustment)
|
|
|
|
|
+ Board.get_direction_vector(right_adjustment)
|
|
|
|
|
)
|
|
|
|
|
var entrance_2 := starting_coord - Board.get_direction_vector(up_adjustment)
|
|
|
|
|
return (
|
|
|
|
|
(coord == entrance_1 and direction == correct_heading_1)
|
|
|
|
|
or (coord == entrance_2 and direction == correct_heading_2)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func get_tile_coords() -> Array[Vector2i]:
|
|
|
|
|
var result: Array[Vector2i] = []
|
|
|
|
|
result.push_back(starting_coord)
|
|
|
|
|
result.push_back(
|
|
|
|
|
starting_coord + Vector2i(Vector2.UP.rotated(deg_to_rad(90 * get_rotation_count())))
|
|
|
|
|
)
|
|
|
|
|
result.push_back(
|
|
|
|
|
(
|
|
|
|
|
starting_coord
|
|
|
|
|
+ Vector2i(Vector2.UP.rotated(deg_to_rad(90 * get_rotation_count())))
|
|
|
|
|
+ Vector2i(Vector2.RIGHT.rotated(deg_to_rad(90 * get_rotation_count())))
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
return result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func get_direction_queue(citizen: Citizen) -> Array[Board.Direction]:
|
|
|
|
|
if (citizen.current_tile_coords - starting_coord) == Vector2i.ZERO:
|
|
|
|
|
return [
|
|
|
|
|
Board.get_next_direction(Board.Direction.UP, get_rotation_count()),
|
|
|
|
|
Board.get_next_direction(Board.Direction.RIGHT, get_rotation_count()),
|
|
|
|
|
Board.get_next_direction(Board.Direction.RIGHT, get_rotation_count())
|
|
|
|
|
]
|
|
|
|
|
return [
|
|
|
|
|
Board.get_next_direction(Board.Direction.LEFT, get_rotation_count()),
|
|
|
|
|
Board.get_next_direction(Board.Direction.DOWN, get_rotation_count()),
|
|
|
|
|
Board.get_next_direction(Board.Direction.DOWN, get_rotation_count())
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func activate(citizen: Citizen) -> void:
|
|
|
|
|
if citizen.get_status_count(Citizen.Status.ARMED) > 0:
|
|
|
|
|
citizen.money += money
|
|
|
|
|
citizen.play_money_animation()
|
|
|
|
|
citizen.remove_status(Citizen.Status.ARMED)
|
|
|
|
|
money = 0
|
|
|
|
|
elif citizen.money > 0:
|
|
|
|
|
money += citizen.money
|
|
|
|
|
citizen.money = 0
|
|
|
|
|
#citizen.play_money_animation()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func handle_post_turn_actions() -> void:
|
2026-04-20 13:03:39 -05:00
|
|
|
Globals.board_game.queue_spawn_placement(floori(money / 15.0))
|
2026-04-15 10:45:43 -05:00
|
|
|
money = money % 15
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _set_money_label() -> void:
|
|
|
|
|
money_label.text = "$%d / $15" % money
|