generated from krampus/template-godot4
Compare commits
No commits in common. "main" and "v_0.0.1" have entirely different histories.
BIN
assets/bomb/bomb.png
(Stored with Git LFS)
BIN
assets/bomb/bomb.png
(Stored with Git LFS)
Binary file not shown.
@ -1,40 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dijho2wx1l4sm"
|
||||
path="res://.godot/imported/bomb.png-defa1459eb51e10e5f11260ea47d7b09.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/bomb/bomb.png"
|
||||
dest_files=["res://.godot/imported/bomb.png-defa1459eb51e10e5f11260ea47d7b09.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
BIN
assets/bomb/coin.png
(Stored with Git LFS)
BIN
assets/bomb/coin.png
(Stored with Git LFS)
Binary file not shown.
@ -1,40 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c6jd75xpvuekx"
|
||||
path="res://.godot/imported/coin.png-73301db8282686b68bdf173328572e68.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/bomb/coin.png"
|
||||
dest_files=["res://.godot/imported/coin.png-73301db8282686b68bdf173328572e68.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
Binary file not shown.
@ -1,36 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://cv63xhs0xcoc1"
|
||||
path="res://.godot/imported/NotoColorEmoji.ttf-5bcefd16ba84146614613f6de606de52.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/fonts/NotoColorEmoji.ttf"
|
||||
dest_files=["res://.godot/imported/NotoColorEmoji.ttf-5bcefd16ba84146614613f6de606de52.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
disable_embedded_bitmaps=true
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
modulate_color_glyphs=false
|
||||
hinting=1
|
||||
subpixel_positioning=4
|
||||
keep_rounding_remainders=true
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
||||
BIN
assets/package/boxes_SpriteSheet.png
(Stored with Git LFS)
BIN
assets/package/boxes_SpriteSheet.png
(Stored with Git LFS)
Binary file not shown.
@ -1,40 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://s1kqdqdvvrxf"
|
||||
path="res://.godot/imported/boxes_SpriteSheet.png-971c2ed38a50dc5fe065e5b69e2ea946.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/package/boxes_SpriteSheet.png"
|
||||
dest_files=["res://.godot/imported/boxes_SpriteSheet.png-971c2ed38a50dc5fe065e5b69e2ea946.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
191
prefabs/board.gd
191
prefabs/board.gd
@ -9,17 +9,14 @@ const UP_SPAWN = preload("uid://6ywvgci44ttv")
|
||||
const RIGHT_SPAWN = preload("uid://c1y3s7daosghf")
|
||||
const DOWN_SPAWN = preload("uid://d4ltd1geg7s2p")
|
||||
const LEFT_SPAWN = preload("uid://noi2ko4hceus")
|
||||
const SOUP_KITCHEN_SCENE = preload("uid://dmfnipmjntenc")
|
||||
|
||||
var tiles: Dictionary[Vector2i, Tile] = {}
|
||||
var buildings: Dictionary[Vector2i, Building] = {}
|
||||
var active_building: Building
|
||||
var active_tile: Tile
|
||||
var is_destroying_building: bool = false
|
||||
var current_map_coord: Vector2i
|
||||
var prev_map_coord: Vector2i
|
||||
var is_controlling_camera: bool = false
|
||||
var is_placing_post_office: bool = false
|
||||
|
||||
@onready var tile_map: TileMapLayer = %Tiles
|
||||
@onready var board_state: Node2D = %BoardState
|
||||
@ -41,75 +38,40 @@ func _input(event: InputEvent) -> void:
|
||||
active_tile.position = tile_map.map_to_local(current_map_coord)
|
||||
if active_building != null:
|
||||
active_building.position = tile_map.map_to_local(current_map_coord)
|
||||
if is_destroying_building:
|
||||
if buildings.has(current_map_coord):
|
||||
buildings[current_map_coord].show_bomb()
|
||||
if prev_map_coord != current_map_coord and buildings.has(prev_map_coord):
|
||||
buildings[prev_map_coord].hide_bomb()
|
||||
prev_map_coord = current_map_coord
|
||||
if event.is_action_pressed("select"):
|
||||
if active_tile != null:
|
||||
place_active_tile()
|
||||
elif active_building != null:
|
||||
place_active_building()
|
||||
if is_destroying_building:
|
||||
destroy_current_building()
|
||||
_handle_building_rotation(event)
|
||||
_handle_spawn_rotation(event)
|
||||
#_handle_spawn_rotation(event)
|
||||
|
||||
|
||||
func set_active_tile(tile: Tile) -> void:
|
||||
active_tile = tile
|
||||
board_state.add_child(active_tile)
|
||||
active_tile.modulate = Color(1, 1, 1, 0.5)
|
||||
active_tile.player = Globals.board_game.current_board_state.current_player
|
||||
active_tile.is_placing = true
|
||||
|
||||
|
||||
func set_active_building(building: Building) -> void:
|
||||
active_building = building
|
||||
board_state.add_child(active_building)
|
||||
if active_building is Home:
|
||||
active_building.player = Globals.board_game.current_board_state.current_player
|
||||
active_building.modulate = Color(1, 1, 1, 0.5)
|
||||
active_building.is_placing = true
|
||||
if active_building is PostOffice:
|
||||
is_placing_post_office = !is_placing_post_office
|
||||
active_building.place()
|
||||
|
||||
|
||||
func place_active_tile() -> void:
|
||||
if tiles.has(current_map_coord) and tiles[current_map_coord] is Ground:
|
||||
tiles[current_map_coord].free()
|
||||
tiles[current_map_coord].queue_free()
|
||||
tiles.erase(current_map_coord)
|
||||
if !tiles.has(current_map_coord) and !buildings.has(current_map_coord):
|
||||
Globals.board_game.current_board_state.players[0].money -= active_tile.cost
|
||||
if Globals.board_game.current_board_state.state != BoardState.State.INITIAL_SETUP:
|
||||
Globals.board_game.current_board_state.players[0].build_actions_taken += 1
|
||||
active_tile.modulate = Color(1, 1, 1, 1)
|
||||
active_tile.coords = current_map_coord
|
||||
active_tile.day_placed = Globals.board_game.current_board_state.day
|
||||
tiles[current_map_coord] = active_tile
|
||||
active_tile = null
|
||||
board_state_changed.emit()
|
||||
elif (
|
||||
tiles.has(current_map_coord)
|
||||
and tiles[current_map_coord].day_placed < Globals.board_game.current_board_state.day
|
||||
):
|
||||
var tile = tiles[current_map_coord]
|
||||
if (
|
||||
Globals.board_game.current_board_state.players[0].money
|
||||
>= ((tile.cost * 2) + active_tile.cost)
|
||||
):
|
||||
var tile_player_index = Globals.board_game.current_board_state.get_player_index(
|
||||
tile.player
|
||||
)
|
||||
Globals.board_game.current_board_state.players[tile_player_index].money += tile.cost * 2
|
||||
Globals.board_game.current_board_state.players[0].money -= tile.cost * 2
|
||||
Globals.board_game.current_board_state.players[0].money -= active_tile.cost
|
||||
tiles[current_map_coord].free()
|
||||
active_tile.modulate = Color(1, 1, 1, 1)
|
||||
active_tile.coords = current_map_coord
|
||||
active_tile.day_placed = Globals.board_game.current_board_state.day
|
||||
tiles[current_map_coord] = active_tile
|
||||
active_tile = null
|
||||
board_state_changed.emit()
|
||||
@ -117,6 +79,7 @@ func place_active_tile() -> void:
|
||||
|
||||
func place_active_building() -> void:
|
||||
active_building.starting_coord = current_map_coord
|
||||
if active_building is Home:
|
||||
active_building.player = Globals.board_game.current_board_state.current_player
|
||||
for coord in active_building.get_tile_coords():
|
||||
if tiles.has(coord) and !(tiles[coord] is Ground):
|
||||
@ -126,58 +89,18 @@ func place_active_building() -> void:
|
||||
for surr_coord in tile_map.get_surrounding_cells(coord):
|
||||
if buildings.has(surr_coord):
|
||||
return
|
||||
Globals.board_game.current_board_state.players[0].money -= active_building.cost
|
||||
active_building.modulate = Color(1, 1, 1, 1)
|
||||
for coord in active_building.get_tile_coords():
|
||||
buildings[coord] = active_building
|
||||
tiles[coord].free()
|
||||
tiles[coord].queue_free()
|
||||
tiles.erase(coord)
|
||||
if active_building is Spawn:
|
||||
Globals.board_game.current_board_state.spawn_placements -= 1
|
||||
if active_building is PostOffice and is_placing_post_office:
|
||||
set_active_building(Building.deserialize(active_building.serialize()))
|
||||
return
|
||||
Globals.board_game.current_board_state.players[0].money -= active_building.cost
|
||||
if Globals.board_game.current_board_state.state != BoardState.State.INITIAL_SETUP:
|
||||
Globals.board_game.current_board_state.players[0].build_actions_taken += 1
|
||||
board_state_changed.emit()
|
||||
active_building = null
|
||||
|
||||
|
||||
func destroy_current_building() -> void:
|
||||
if buildings.has(current_map_coord):
|
||||
var building = buildings[current_map_coord]
|
||||
if building is not Home and building is not HQ:
|
||||
remove_building(building)
|
||||
Globals.board_game.current_board_state.buildings_to_destroy -= 1
|
||||
|
||||
|
||||
func remove_home(player: Player) -> void:
|
||||
for coord in buildings.keys():
|
||||
var building = buildings[coord]
|
||||
if building is Home and building.player.id == player.id:
|
||||
remove_building(building)
|
||||
|
||||
|
||||
func remove_hq(player: Player) -> void:
|
||||
for coord in buildings.keys():
|
||||
var building = buildings[coord]
|
||||
if building is HQ and building.player.id == player.id:
|
||||
remove_building(building)
|
||||
|
||||
|
||||
func remove_building(building: Building) -> void:
|
||||
for coord in building.get_tile_coords():
|
||||
buildings.erase(coord)
|
||||
var ground: Ground = GROUND.instantiate()
|
||||
board_state.add_child(ground)
|
||||
ground.position = tile_map.map_to_local(coord)
|
||||
ground.coords = coord
|
||||
tiles[coord] = ground
|
||||
building.free()
|
||||
board_state_changed.emit()
|
||||
|
||||
|
||||
func _handle_building_rotation(event: InputEvent) -> void:
|
||||
if active_building == null or active_building is Spawn:
|
||||
if active_building == null:
|
||||
return
|
||||
if event.is_action_pressed("rotate_tile_up"):
|
||||
active_building.rotation_degrees += 90
|
||||
@ -187,45 +110,12 @@ func _handle_building_rotation(event: InputEvent) -> void:
|
||||
active_building.tile_rotation = get_previous_direction(active_building.tile_rotation)
|
||||
|
||||
|
||||
func _handle_spawn_rotation(event: InputEvent) -> void:
|
||||
if active_building == null or active_building is not Spawn:
|
||||
return
|
||||
if event.is_action_pressed("rotate_tile_up"):
|
||||
var curr_position = active_building.position
|
||||
active_building.queue_free()
|
||||
match active_building.direction:
|
||||
Direction.UP:
|
||||
set_active_building(RIGHT_SPAWN.instantiate())
|
||||
Direction.RIGHT:
|
||||
set_active_building(DOWN_SPAWN.instantiate())
|
||||
Direction.DOWN:
|
||||
set_active_building(LEFT_SPAWN.instantiate())
|
||||
Direction.LEFT:
|
||||
set_active_building(UP_SPAWN.instantiate())
|
||||
active_building.position = curr_position
|
||||
elif event.is_action_pressed("rotate_tile_down"):
|
||||
var curr_position = active_building.position
|
||||
active_building.queue_free()
|
||||
match active_building.direction:
|
||||
Direction.UP:
|
||||
set_active_building(LEFT_SPAWN.instantiate())
|
||||
Direction.RIGHT:
|
||||
set_active_building(UP_SPAWN.instantiate())
|
||||
Direction.DOWN:
|
||||
set_active_building(RIGHT_SPAWN.instantiate())
|
||||
Direction.LEFT:
|
||||
set_active_building(DOWN_SPAWN.instantiate())
|
||||
active_building.position = curr_position
|
||||
|
||||
|
||||
func reset() -> void:
|
||||
for child in board_state.get_children():
|
||||
child.free()
|
||||
child.queue_free()
|
||||
|
||||
|
||||
func set_board_state(bs: BoardState) -> void:
|
||||
tiles.clear()
|
||||
buildings.clear()
|
||||
for tile in bs.tiles:
|
||||
board_state.add_child(tile)
|
||||
tiles[tile.coords] = tile
|
||||
@ -236,11 +126,11 @@ func set_board_state(bs: BoardState) -> void:
|
||||
buildings[coord] = building
|
||||
building.position = tile_map.map_to_local(building.starting_coord)
|
||||
building.rotation_degrees += 90 * building.get_rotation_count()
|
||||
if building is PostOffice:
|
||||
building.place()
|
||||
|
||||
|
||||
func initialize() -> void:
|
||||
var max_x: int = 0
|
||||
var max_y: int = 0
|
||||
for i in range(Globals.game.players.size()):
|
||||
var random_spawn = Vector2i(randi_range(0, 9), randi_range(0, 9))
|
||||
for x in range(10):
|
||||
@ -252,6 +142,8 @@ func initialize() -> void:
|
||||
coord.y += 10
|
||||
if i == 3:
|
||||
coord += Vector2i(10, 10)
|
||||
max_x = coord.x
|
||||
max_y = coord.y
|
||||
if x == random_spawn.x and y == random_spawn.y:
|
||||
var possible_spawns = [UP_SPAWN, RIGHT_SPAWN, DOWN_SPAWN, LEFT_SPAWN]
|
||||
if random_spawn.x == 9:
|
||||
@ -262,54 +154,23 @@ func initialize() -> void:
|
||||
possible_spawns.erase(DOWN_SPAWN)
|
||||
elif random_spawn.y == 0:
|
||||
possible_spawns.erase(UP_SPAWN)
|
||||
var spawn: Building = possible_spawns.pick_random().instantiate()
|
||||
var spawn: Tile = possible_spawns.pick_random().instantiate()
|
||||
board_state.add_child(spawn)
|
||||
spawn.starting_coord = coord
|
||||
spawn.coords = coord
|
||||
spawn.position = tile_map.map_to_local(coord)
|
||||
buildings[coord] = spawn
|
||||
tiles[coord] = spawn
|
||||
else:
|
||||
var ground: Tile = GROUND.instantiate()
|
||||
board_state.add_child(ground)
|
||||
ground.coords = coord
|
||||
ground.position = tile_map.map_to_local(coord)
|
||||
tiles[coord] = ground
|
||||
var extra_spawn_coord := get_random_available_tile_coord()
|
||||
var extra_spawn_coord := Vector2i(randi_range(1, max_x - 1), randi_range(1, max_y - 1))
|
||||
var extra_spawn = [UP_SPAWN, RIGHT_SPAWN, DOWN_SPAWN, LEFT_SPAWN].pick_random().instantiate()
|
||||
board_state.add_child(extra_spawn)
|
||||
extra_spawn.starting_coord = extra_spawn_coord
|
||||
extra_spawn.coords = extra_spawn_coord
|
||||
extra_spawn.position = tile_map.map_to_local(extra_spawn_coord)
|
||||
tiles[extra_spawn_coord].queue_free()
|
||||
tiles.erase(extra_spawn_coord)
|
||||
buildings[extra_spawn_coord] = extra_spawn
|
||||
|
||||
var soup_kitchen_coords := get_random_available_tile_coord()
|
||||
var soup_kitchen: SoupKitchen = SOUP_KITCHEN_SCENE.instantiate()
|
||||
board_state.add_child(soup_kitchen)
|
||||
soup_kitchen.starting_coord = soup_kitchen_coords
|
||||
for skc in soup_kitchen.get_tile_coords():
|
||||
buildings[skc] = soup_kitchen
|
||||
tiles[skc].free()
|
||||
tiles.erase(skc)
|
||||
soup_kitchen.position = tile_map.map_to_local(soup_kitchen_coords)
|
||||
|
||||
|
||||
func get_random_available_tile_coord() -> Vector2i:
|
||||
return tiles.keys().filter(is_cross_shape_available).pick_random()
|
||||
|
||||
|
||||
func is_cross_shape_available(coord: Vector2i) -> bool:
|
||||
return (
|
||||
tiles[coord] is Ground
|
||||
and !buildings.has(coord)
|
||||
and tiles.get(Vector2i(coord.x + 1, coord.y)) is Ground
|
||||
and !buildings.has(Vector2i(coord.x + 1, coord.y))
|
||||
and tiles.get(Vector2i(coord.x - 1, coord.y)) is Ground
|
||||
and !buildings.has(Vector2i(coord.x - 1, coord.y))
|
||||
and tiles.get(Vector2i(coord.x, coord.y + 1)) is Ground
|
||||
and !buildings.has(Vector2i(coord.x, coord.y + 1))
|
||||
and tiles.get(Vector2i(coord.x, coord.y - 1)) is Ground
|
||||
and !buildings.has(Vector2i(coord.x, coord.y - 1))
|
||||
)
|
||||
tiles[extra_spawn_coord] = extra_spawn
|
||||
|
||||
|
||||
static func get_next_direction(direction: Direction, count: int = 1) -> Direction:
|
||||
@ -356,3 +217,17 @@ static func get_direction_vector(direction: Direction) -> Vector2i:
|
||||
return Vector2i.LEFT
|
||||
_:
|
||||
return Vector2i.ZERO
|
||||
|
||||
#func generate() -> void:
|
||||
#for child in get_children():
|
||||
#child.queue_free()
|
||||
#for x in range(width):
|
||||
#for y in range(height):
|
||||
#var tile: Control
|
||||
#if x == 1 and y == 1:
|
||||
#tile = spawn_scene.instantiate()
|
||||
#else:
|
||||
#tile = ground_scene.instantiate()
|
||||
#add_child(tile)
|
||||
#tile.position = get_coordinate(x, y)
|
||||
#tile.owner = self
|
||||
|
||||
@ -1,11 +1,10 @@
|
||||
class_name Citizen extends CharacterBody2D
|
||||
|
||||
enum Status { NONE, DRUNK, ARMED, CAFFEINATED, PACKAGED }
|
||||
enum Status { NONE, DRUNK, ARMED, CAFFEINATED }
|
||||
|
||||
const DRUNK_ICON = preload("uid://28x2e52skdt1")
|
||||
const COFFEE_ICON = preload("uid://0644a3psplk8")
|
||||
const ARMED_ICON = preload("uid://cn8biugbtcns5")
|
||||
const PACKAGE_ICON = preload("uid://drhv16h2tgoju")
|
||||
|
||||
var direction: Board.Direction:
|
||||
set(new_direction):
|
||||
@ -30,7 +29,6 @@ var money: int = 0
|
||||
var money_label_tween: Tween
|
||||
var tiles_visited: Dictionary[Tile, int] = {}
|
||||
var buildings_visited: Dictionary[Building, int] = {}
|
||||
var package_distance: int = 0
|
||||
|
||||
var _statuses: Array[Status] = []
|
||||
|
||||
@ -43,7 +41,6 @@ var _statuses: Array[Status] = []
|
||||
|
||||
func _ready() -> void:
|
||||
Globals.board_game.citizen_count += 1
|
||||
money = Globals.board_game.current_board_state.citizens_starting_money
|
||||
|
||||
|
||||
func pause() -> void:
|
||||
@ -63,8 +60,6 @@ func add_status(status: Status) -> void:
|
||||
status_container.add_child(COFFEE_ICON.instantiate())
|
||||
Status.ARMED:
|
||||
status_container.add_child(ARMED_ICON.instantiate())
|
||||
Status.PACKAGED:
|
||||
status_container.add_child(PACKAGE_ICON.instantiate())
|
||||
|
||||
|
||||
func remove_status(status: Status) -> void:
|
||||
@ -160,13 +155,6 @@ func check_for_turn(tile: Tile) -> void:
|
||||
direction = tile.direction
|
||||
|
||||
|
||||
func check_for_adjacent_building() -> void:
|
||||
for adj in [Vector2i.UP, Vector2i.RIGHT, Vector2i.DOWN, Vector2i.LEFT]:
|
||||
var building = Globals.board_game.board.buildings.get(current_tile_coords + adj)
|
||||
if building is SoupKitchen:
|
||||
building.activate(self)
|
||||
|
||||
|
||||
func check_for_building() -> void:
|
||||
if Globals.board_game.board.buildings.has(
|
||||
current_tile_coords + Board.get_direction_vector(direction)
|
||||
@ -190,8 +178,6 @@ func handle_tile_area_exited(_area: Area2D):
|
||||
if direction != Board.Direction.NONE:
|
||||
direction = Board.Direction.NONE
|
||||
return
|
||||
if get_status_count(Citizen.Status.PACKAGED) > 0:
|
||||
package_distance += 1
|
||||
if !direction_queue.is_empty():
|
||||
direction = direction_queue.pop_front()
|
||||
elif Globals.board_game.board.buildings.has(current_tile_coords):
|
||||
@ -201,14 +187,12 @@ func handle_tile_area_exited(_area: Area2D):
|
||||
buildings_visited[building] += 1
|
||||
building.activate(self)
|
||||
direction_queue = building.get_direction_queue(self)
|
||||
if !direction_queue.is_empty():
|
||||
direction = direction_queue.pop_front()
|
||||
elif Globals.board_game.board.tiles.has(current_tile_coords):
|
||||
var tile = Globals.board_game.board.tiles[current_tile_coords]
|
||||
if !tiles_visited.has(tile):
|
||||
tiles_visited.set(tile, 0)
|
||||
tiles_visited[tile as Tile] += 1
|
||||
check_for_adjacent_building()
|
||||
check_for_building()
|
||||
check_for_turn(tile)
|
||||
if (
|
||||
|
||||
@ -65,10 +65,5 @@ func handle_post_turn_actions() -> void:
|
||||
money *= 2
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_set_money_label()
|
||||
|
||||
|
||||
func _set_money_label() -> void:
|
||||
if is_node_ready():
|
||||
money_label.text = "$%d" % money
|
||||
|
||||
@ -2,10 +2,6 @@
|
||||
|
||||
[ext_resource type="Script" uid="uid://dqivl44ibmsl6" path="res://prefabs/tiles/buildings/bank.gd" id="1_q4p5y"]
|
||||
[ext_resource type="Texture2D" uid="uid://t8n660a0vqvm" path="res://assets/Pixelart arrow icon pack 1.0.png" id="2_68e07"]
|
||||
[ext_resource type="Texture2D" uid="uid://dijho2wx1l4sm" path="res://assets/bomb/bomb.png" id="3_68e07"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_q4p5y"]
|
||||
colors = PackedColorArray(0, 1, 0, 1, 1, 0, 0, 1)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_vwg8v"]
|
||||
outline_size = 4
|
||||
@ -62,35 +58,6 @@ offset_bottom = -55.0
|
||||
mouse_filter = 2
|
||||
color = Color(0, 1, 0, 1)
|
||||
|
||||
[node name="Edge1" type="Line2D" parent="." unique_id=339174361]
|
||||
position = Vector2(55, -165)
|
||||
points = PackedVector2Array(0, 0, 0, 220)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Edge2" type="Line2D" parent="." unique_id=13095279]
|
||||
position = Vector2(-55, -55)
|
||||
points = PackedVector2Array(0, 0, 220, 0)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Path1" type="Line2D" parent="." unique_id=1853389348]
|
||||
points = PackedVector2Array(-10, -155, -10, 45, 10, 45, 10, -155)
|
||||
width = 2.0
|
||||
gradient = SubResource("Gradient_q4p5y")
|
||||
joint_mode = 2
|
||||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
|
||||
[node name="Path2" type="Line2D" parent="." unique_id=1557159962]
|
||||
position = Vector2(110, 0)
|
||||
points = PackedVector2Array(-10, -155, -10, 45, 10, 45, 10, -155)
|
||||
width = 2.0
|
||||
gradient = SubResource("Gradient_q4p5y")
|
||||
joint_mode = 2
|
||||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="." unique_id=29286194]
|
||||
custom_minimum_size = Vector2(220, 110)
|
||||
offset_left = -55.0
|
||||
@ -191,9 +158,7 @@ offset_right = 165.0
|
||||
offset_bottom = 55.0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="BombSprite" type="Sprite2D" parent="." unique_id=325490289]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
position = Vector2(55, -55)
|
||||
scale = Vector2(0.415, 0.415)
|
||||
texture = ExtResource("3_68e07")
|
||||
[connection signal="area_entered" from="Square1" to="." method="_on_building_area_entered"]
|
||||
[connection signal="area_entered" from="Square2" to="." method="_on_building_area_entered"]
|
||||
[connection signal="area_entered" from="Square3" to="." method="_on_building_area_entered"]
|
||||
[connection signal="area_entered" from="Square4" to="." method="_on_building_area_entered"]
|
||||
|
||||
@ -2,10 +2,6 @@
|
||||
|
||||
[ext_resource type="Script" uid="uid://ptm2cd3y5f14" path="res://prefabs/tiles/buildings/bar.gd" id="1_cy06p"]
|
||||
[ext_resource type="Texture2D" uid="uid://t8n660a0vqvm" path="res://assets/Pixelart arrow icon pack 1.0.png" id="2_iv3ev"]
|
||||
[ext_resource type="Texture2D" uid="uid://dijho2wx1l4sm" path="res://assets/bomb/bomb.png" id="3_iv3ev"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_cy06p"]
|
||||
colors = PackedColorArray(0, 1, 0, 1, 1, 0, 0, 1)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_vwg8v"]
|
||||
outline_size = 4
|
||||
@ -44,28 +40,6 @@ offset_bottom = -55.0
|
||||
mouse_filter = 2
|
||||
color = Color(0.735357, 0, 1, 1)
|
||||
|
||||
[node name="Edge1" type="Line2D" parent="." unique_id=1476024039]
|
||||
position = Vector2(-55, -55)
|
||||
points = PackedVector2Array(0, 0, 110, 0)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Path1" type="Line2D" parent="." unique_id=69409061]
|
||||
points = PackedVector2Array(-10, 45, -10, -155)
|
||||
width = 2.0
|
||||
gradient = SubResource("Gradient_cy06p")
|
||||
joint_mode = 2
|
||||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
|
||||
[node name="Path2" type="Line2D" parent="." unique_id=143275132]
|
||||
points = PackedVector2Array(10, -155, 10, 45)
|
||||
width = 2.0
|
||||
gradient = SubResource("Gradient_cy06p")
|
||||
joint_mode = 2
|
||||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="." unique_id=29286194]
|
||||
custom_minimum_size = Vector2(110, 220)
|
||||
offset_left = -55.0
|
||||
@ -136,12 +110,5 @@ offset_right = 55.0
|
||||
offset_bottom = 95.0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="BombSprite" type="Sprite2D" parent="." unique_id=1443290680]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
position = Vector2(0, -55)
|
||||
scale = Vector2(0.415, 0.415)
|
||||
texture = ExtResource("3_iv3ev")
|
||||
|
||||
[connection signal="area_entered" from="Square1" to="." method="_on_building_area_entered"]
|
||||
[connection signal="area_entered" from="Square2" to="." method="_on_building_area_entered"]
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
class_name Building extends Node2D
|
||||
|
||||
@export var cost: int = 0
|
||||
@export var player: Player:
|
||||
set = _set_player
|
||||
|
||||
var is_placing: bool = false:
|
||||
set(value):
|
||||
@ -15,22 +13,6 @@ var starting_coord: Vector2i
|
||||
var tile_rotation: Board.Direction = Board.Direction.UP
|
||||
|
||||
@onready var size_node: Control = %Size
|
||||
@onready var bomb_sprite: Sprite2D = %BombSprite
|
||||
|
||||
|
||||
func can_citizen_enter(_coord: Vector2i, _direction: Board.Direction) -> bool:
|
||||
print("The extending class has to implement this!")
|
||||
return false
|
||||
|
||||
|
||||
func get_tile_coords() -> Array[Vector2i]:
|
||||
print("The extending class has to implement this!")
|
||||
return []
|
||||
|
||||
|
||||
func get_direction_queue(_citizen: Citizen) -> Array[Board.Direction]:
|
||||
print("The extending class has to implement this!")
|
||||
return []
|
||||
|
||||
|
||||
func building_entered(body: Node2D) -> void:
|
||||
@ -57,18 +39,6 @@ func get_rotation_count() -> int:
|
||||
return rotation_count
|
||||
|
||||
|
||||
func _set_player(new_player: Player) -> void:
|
||||
player = new_player
|
||||
|
||||
|
||||
func show_bomb() -> void:
|
||||
bomb_sprite.show()
|
||||
|
||||
|
||||
func hide_bomb() -> void:
|
||||
bomb_sprite.hide()
|
||||
|
||||
|
||||
func serialize() -> Dictionary:
|
||||
var result = {}
|
||||
result["scene_file_path"] = scene_file_path
|
||||
@ -78,10 +48,6 @@ func serialize() -> Dictionary:
|
||||
result["player"] = null
|
||||
if get("player") != null:
|
||||
result["player"] = get("player").serialize()
|
||||
if get("money") != null:
|
||||
result["money"] = get("money")
|
||||
if get("required_money") != null:
|
||||
result["required_money"] = get("required_money")
|
||||
return result
|
||||
|
||||
|
||||
@ -92,8 +58,4 @@ static func deserialize(data: Dictionary) -> Building:
|
||||
building.cost = data["cost"]
|
||||
if data["player"] != null:
|
||||
building.player = Player.deserialize(data["player"])
|
||||
if data.get("money") != null:
|
||||
building.money = data["money"]
|
||||
if data.get("required_money") != null:
|
||||
building.required_money = data["required_money"]
|
||||
return building
|
||||
|
||||
@ -2,10 +2,6 @@
|
||||
|
||||
[ext_resource type="Script" uid="uid://2m1djjoa3vji" path="res://prefabs/tiles/buildings/cafe.gd" id="1_rc38y"]
|
||||
[ext_resource type="Texture2D" uid="uid://t8n660a0vqvm" path="res://assets/Pixelart arrow icon pack 1.0.png" id="2_721qv"]
|
||||
[ext_resource type="Texture2D" uid="uid://dijho2wx1l4sm" path="res://assets/bomb/bomb.png" id="3_gcpgr"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_rc38y"]
|
||||
colors = PackedColorArray(0, 1, 0, 1, 1, 0, 0, 1)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_vwg8v"]
|
||||
outline_size = 4
|
||||
@ -62,37 +58,6 @@ offset_bottom = -55.0
|
||||
mouse_filter = 2
|
||||
color = Color(1, 0.41822335, 0, 1)
|
||||
|
||||
[node name="Edge1" type="Line2D" parent="." unique_id=1571287153]
|
||||
points = PackedVector2Array(55, -55, 55, 55)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Edge2" type="Line2D" parent="." unique_id=1717512039]
|
||||
points = PackedVector2Array(55, -55, 165, -55)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Edge3" type="Line2D" parent="." unique_id=1513651550]
|
||||
points = PackedVector2Array(165, -165, 165, -55)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Path1" type="Line2D" parent="." unique_id=1015237330]
|
||||
points = PackedVector2Array(-35, -10, 100, -10, 100, -120, 255, -120)
|
||||
width = 2.0
|
||||
gradient = SubResource("Gradient_rc38y")
|
||||
joint_mode = 2
|
||||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
|
||||
[node name="Path2" type="Line2D" parent="." unique_id=529957110]
|
||||
points = PackedVector2Array(255, -100, 120, -100, 120, 10, -35, 10)
|
||||
width = 2.0
|
||||
gradient = SubResource("Gradient_rc38y")
|
||||
joint_mode = 2
|
||||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="." unique_id=29286194]
|
||||
custom_minimum_size = Vector2(110, 220)
|
||||
offset_left = 55.0
|
||||
@ -183,13 +148,6 @@ offset_right = 315.0
|
||||
offset_bottom = 55.0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="BombSprite" type="Sprite2D" parent="." unique_id=1984797233]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
position = Vector2(110, -55)
|
||||
scale = Vector2(0.415, 0.415)
|
||||
texture = ExtResource("3_gcpgr")
|
||||
|
||||
[connection signal="area_entered" from="Square1" to="." method="_on_building_area_entered"]
|
||||
[connection signal="area_entered" from="Square2" to="." method="_on_building_area_entered"]
|
||||
[connection signal="area_entered" from="Square3" to="." method="_on_building_area_entered"]
|
||||
|
||||
@ -1,92 +0,0 @@
|
||||
extends Building
|
||||
|
||||
|
||||
func can_citizen_enter(coord: Vector2i, direction: Board.Direction) -> bool:
|
||||
var down_adjustment := Board.get_next_direction(Board.Direction.DOWN, get_rotation_count())
|
||||
var left_adjustment := Board.get_next_direction(Board.Direction.LEFT, get_rotation_count())
|
||||
var right_adjustment := Board.get_next_direction(Board.Direction.RIGHT, get_rotation_count())
|
||||
var correct_heading := Board.get_next_direction(Board.Direction.UP, get_rotation_count())
|
||||
|
||||
var entrance_1 := starting_coord + Board.get_direction_vector(down_adjustment)
|
||||
var entrance_2 := (
|
||||
starting_coord
|
||||
+ Board.get_direction_vector(left_adjustment)
|
||||
+ Board.get_direction_vector(down_adjustment)
|
||||
)
|
||||
var entrance_3 := (
|
||||
starting_coord
|
||||
+ Board.get_direction_vector(left_adjustment)
|
||||
+ Board.get_direction_vector(left_adjustment)
|
||||
+ Board.get_direction_vector(down_adjustment)
|
||||
)
|
||||
var entrance_4 := (
|
||||
starting_coord
|
||||
+ Board.get_direction_vector(right_adjustment)
|
||||
+ Board.get_direction_vector(down_adjustment)
|
||||
)
|
||||
var entrance_5 := (
|
||||
starting_coord
|
||||
+ Board.get_direction_vector(right_adjustment)
|
||||
+ Board.get_direction_vector(right_adjustment)
|
||||
+ Board.get_direction_vector(down_adjustment)
|
||||
)
|
||||
|
||||
return (
|
||||
(
|
||||
coord == entrance_1
|
||||
or coord == entrance_2
|
||||
or coord == entrance_3
|
||||
or coord == entrance_4
|
||||
or coord == entrance_5
|
||||
)
|
||||
and direction == correct_heading
|
||||
)
|
||||
|
||||
|
||||
func get_tile_coords() -> Array[Vector2i]:
|
||||
var result: Array[Vector2i] = []
|
||||
result.push_back(starting_coord)
|
||||
result.push_back(
|
||||
starting_coord + Vector2i(Vector2.RIGHT.rotated(deg_to_rad(90 * get_rotation_count())))
|
||||
)
|
||||
result.push_back(
|
||||
starting_coord + Vector2i(Vector2.RIGHT.rotated(deg_to_rad(90 * get_rotation_count()))) * 2
|
||||
)
|
||||
result.push_back(
|
||||
starting_coord + Vector2i(Vector2.LEFT.rotated(deg_to_rad(90 * get_rotation_count())))
|
||||
)
|
||||
result.push_back(
|
||||
starting_coord + Vector2i(Vector2.LEFT.rotated(deg_to_rad(90 * get_rotation_count()))) * 2
|
||||
)
|
||||
return result
|
||||
|
||||
|
||||
func get_direction_queue(citizen: Citizen) -> Array[Board.Direction]:
|
||||
var result: Array[Board.Direction] = []
|
||||
match citizen.current_tile_coords - starting_coord:
|
||||
Vector2i(-2, 0):
|
||||
result.append(Board.Direction.RIGHT)
|
||||
result.append(Board.Direction.RIGHT)
|
||||
Vector2i(-1, 0):
|
||||
result.append(Board.Direction.RIGHT)
|
||||
Vector2i(2, 0):
|
||||
result.append(Board.Direction.LEFT)
|
||||
result.append(Board.Direction.LEFT)
|
||||
Vector2i(1, 0):
|
||||
result.append(Board.Direction.LEFT)
|
||||
Vector2i(0, -2):
|
||||
result.append(Board.Direction.DOWN)
|
||||
result.append(Board.Direction.DOWN)
|
||||
Vector2i(0, -1):
|
||||
result.append(Board.Direction.DOWN)
|
||||
Vector2i(0, 2):
|
||||
result.append(Board.Direction.UP)
|
||||
result.append(Board.Direction.UP)
|
||||
Vector2i(0, 1):
|
||||
result.append(Board.Direction.UP)
|
||||
result.append(Board.get_next_direction(Board.Direction.UP, get_rotation_count()))
|
||||
return result
|
||||
|
||||
|
||||
func activate(_citizen: Citizen) -> void:
|
||||
pass
|
||||
@ -1 +0,0 @@
|
||||
uid://evjo56hrv60t
|
||||
@ -1,257 +0,0 @@
|
||||
[gd_scene format=3 uid="uid://brn0nbkela0m4"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://evjo56hrv60t" path="res://prefabs/tiles/buildings/church.gd" id="1_8f6g1"]
|
||||
[ext_resource type="Texture2D" uid="uid://t8n660a0vqvm" path="res://assets/Pixelart arrow icon pack 1.0.png" id="2_rjttq"]
|
||||
[ext_resource type="Texture2D" uid="uid://dijho2wx1l4sm" path="res://assets/bomb/bomb.png" id="3_rjttq"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_8f6g1"]
|
||||
colors = PackedColorArray(0, 1, 0, 1, 1, 0, 0, 1)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_vwg8v"]
|
||||
outline_size = 4
|
||||
outline_color = Color(0, 0, 0, 1)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vwg8v"]
|
||||
size = Vector2(109, 109)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_fupku"]
|
||||
atlas = ExtResource("2_rjttq")
|
||||
region = Rect2(0, 16, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_wwwaf"]
|
||||
atlas = ExtResource("2_rjttq")
|
||||
region = Rect2(16, 16, 16, 16)
|
||||
|
||||
[node name="Church" type="Node2D" unique_id=746270571]
|
||||
process_mode = 3
|
||||
script = ExtResource("1_8f6g1")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="." unique_id=889061850]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
offset_left = -55.0
|
||||
offset_top = -55.0
|
||||
offset_right = 55.0
|
||||
offset_bottom = 55.0
|
||||
mouse_filter = 2
|
||||
color = Color(0.3070573, 0.15230635, 4.813075e-08, 1)
|
||||
|
||||
[node name="ColorRect2" type="ColorRect" parent="." unique_id=76291108]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
offset_left = -165.0
|
||||
offset_top = -55.0
|
||||
offset_right = -55.0
|
||||
offset_bottom = 55.0
|
||||
mouse_filter = 2
|
||||
color = Color(0.3070573, 0.15230635, 4.813075e-08, 1)
|
||||
|
||||
[node name="ColorRect3" type="ColorRect" parent="." unique_id=786140755]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
offset_left = -275.0
|
||||
offset_top = -55.0
|
||||
offset_right = -165.0
|
||||
offset_bottom = 55.0
|
||||
mouse_filter = 2
|
||||
color = Color(0.3070573, 0.15230635, 4.813075e-08, 1)
|
||||
|
||||
[node name="ColorRect4" type="ColorRect" parent="." unique_id=557224551]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
offset_left = 55.0
|
||||
offset_top = -55.0
|
||||
offset_right = 165.0
|
||||
offset_bottom = 55.0
|
||||
mouse_filter = 2
|
||||
color = Color(0.3070573, 0.15230635, 4.813075e-08, 1)
|
||||
|
||||
[node name="ColorRect5" type="ColorRect" parent="." unique_id=1896618491]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
offset_left = 165.0
|
||||
offset_top = -55.0
|
||||
offset_right = 275.0
|
||||
offset_bottom = 55.0
|
||||
mouse_filter = 2
|
||||
color = Color(0.3070573, 0.15230635, 4.813075e-08, 1)
|
||||
|
||||
[node name="Edge1" type="Line2D" parent="." unique_id=1622669833]
|
||||
points = PackedVector2Array(-55, -55, -55, 55)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Edge2" type="Line2D" parent="." unique_id=634160434]
|
||||
points = PackedVector2Array(-165, -55, -165, 55)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Edge3" type="Line2D" parent="." unique_id=1462778911]
|
||||
points = PackedVector2Array(55, -55, 55, 55)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Edge4" type="Line2D" parent="." unique_id=305038753]
|
||||
points = PackedVector2Array(165, -55, 165, 55)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Path1" type="Line2D" parent="." unique_id=1746998022]
|
||||
points = PackedVector2Array(-220, 35, -220, 0, 0, 0, 0, -35)
|
||||
width = 2.0
|
||||
gradient = SubResource("Gradient_8f6g1")
|
||||
joint_mode = 2
|
||||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
|
||||
[node name="Path2" type="Line2D" parent="." unique_id=1220526561]
|
||||
points = PackedVector2Array(-110, 35, -110, 0, 0, 0, 0, -35)
|
||||
width = 2.0
|
||||
gradient = SubResource("Gradient_8f6g1")
|
||||
joint_mode = 2
|
||||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
|
||||
[node name="Path3" type="Line2D" parent="." unique_id=1172147913]
|
||||
points = PackedVector2Array(0, 35, 0, 0, 0, 0, 0, -35)
|
||||
width = 2.0
|
||||
gradient = SubResource("Gradient_8f6g1")
|
||||
joint_mode = 2
|
||||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
|
||||
[node name="Path5" type="Line2D" parent="." unique_id=1243414944]
|
||||
points = PackedVector2Array(220, 35, 220, 0, 0, 0, 0, -35)
|
||||
width = 2.0
|
||||
gradient = SubResource("Gradient_8f6g1")
|
||||
joint_mode = 2
|
||||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
|
||||
[node name="Path4" type="Line2D" parent="." unique_id=288012436]
|
||||
points = PackedVector2Array(110, 35, 110, 0, 0, 0, 0, -35)
|
||||
width = 2.0
|
||||
gradient = SubResource("Gradient_8f6g1")
|
||||
joint_mode = 2
|
||||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="." unique_id=29286194]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
offset_left = -55.0
|
||||
offset_top = -55.0
|
||||
offset_right = 55.0
|
||||
offset_bottom = 55.0
|
||||
text = "CHURCH"
|
||||
label_settings = SubResource("LabelSettings_vwg8v")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Square1" type="Area2D" parent="." unique_id=333775731]
|
||||
process_mode = 3
|
||||
monitoring = false
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square1" unique_id=1122204523]
|
||||
process_mode = 3
|
||||
shape = SubResource("RectangleShape2D_vwg8v")
|
||||
|
||||
[node name="Square2" type="Area2D" parent="." unique_id=871528471]
|
||||
process_mode = 3
|
||||
position = Vector2(-110, 0)
|
||||
monitoring = false
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square2" unique_id=1328243658]
|
||||
process_mode = 3
|
||||
shape = SubResource("RectangleShape2D_vwg8v")
|
||||
|
||||
[node name="Square3" type="Area2D" parent="." unique_id=1642876812]
|
||||
process_mode = 3
|
||||
position = Vector2(-220, 0)
|
||||
monitoring = false
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square3" unique_id=1392094497]
|
||||
process_mode = 3
|
||||
shape = SubResource("RectangleShape2D_vwg8v")
|
||||
|
||||
[node name="Square4" type="Area2D" parent="." unique_id=2108585971]
|
||||
process_mode = 3
|
||||
position = Vector2(110, 0)
|
||||
monitoring = false
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square4" unique_id=11446925]
|
||||
process_mode = 3
|
||||
shape = SubResource("RectangleShape2D_vwg8v")
|
||||
|
||||
[node name="Square5" type="Area2D" parent="." unique_id=304733612]
|
||||
process_mode = 3
|
||||
position = Vector2(220, 0)
|
||||
monitoring = false
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square5" unique_id=676150133]
|
||||
process_mode = 3
|
||||
shape = SubResource("RectangleShape2D_vwg8v")
|
||||
|
||||
[node name="Sprite2D2" type="Sprite2D" parent="." unique_id=1969702659]
|
||||
texture_filter = 1
|
||||
position = Vector2(0, -75)
|
||||
rotation = 3.1415927
|
||||
scale = Vector2(2, 2)
|
||||
texture = SubResource("AtlasTexture_fupku")
|
||||
flip_v = true
|
||||
|
||||
[node name="Sprite2D3" type="Sprite2D" parent="." unique_id=1370361419]
|
||||
texture_filter = 1
|
||||
position = Vector2(0, 75)
|
||||
rotation = 3.1415927
|
||||
scale = Vector2(2, 2)
|
||||
texture = SubResource("AtlasTexture_wwwaf")
|
||||
flip_v = true
|
||||
|
||||
[node name="Sprite2D4" type="Sprite2D" parent="." unique_id=412091220]
|
||||
texture_filter = 1
|
||||
position = Vector2(110, 75)
|
||||
rotation = 3.1415927
|
||||
scale = Vector2(2, 2)
|
||||
texture = SubResource("AtlasTexture_wwwaf")
|
||||
flip_v = true
|
||||
|
||||
[node name="Sprite2D5" type="Sprite2D" parent="." unique_id=644104858]
|
||||
texture_filter = 1
|
||||
position = Vector2(220, 75)
|
||||
rotation = 3.1415927
|
||||
scale = Vector2(2, 2)
|
||||
texture = SubResource("AtlasTexture_wwwaf")
|
||||
flip_v = true
|
||||
|
||||
[node name="Sprite2D6" type="Sprite2D" parent="." unique_id=1305702192]
|
||||
texture_filter = 1
|
||||
position = Vector2(-110, 75)
|
||||
rotation = 3.1415927
|
||||
scale = Vector2(2, 2)
|
||||
texture = SubResource("AtlasTexture_wwwaf")
|
||||
flip_v = true
|
||||
|
||||
[node name="Sprite2D7" type="Sprite2D" parent="." unique_id=981017878]
|
||||
texture_filter = 1
|
||||
position = Vector2(-220, 75)
|
||||
rotation = 3.1415927
|
||||
scale = Vector2(2, 2)
|
||||
texture = SubResource("AtlasTexture_wwwaf")
|
||||
flip_v = true
|
||||
|
||||
[node name="Size" type="Control" parent="." unique_id=1036213581]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_left = -275.0
|
||||
offset_top = -90.0
|
||||
offset_right = 275.0
|
||||
offset_bottom = 90.0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="BombSprite" type="Sprite2D" parent="." unique_id=1369493792]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
scale = Vector2(0.415, 0.415)
|
||||
texture = ExtResource("3_rjttq")
|
||||
|
||||
[connection signal="area_entered" from="Square1" to="." method="_on_building_area_entered"]
|
||||
[connection signal="area_entered" from="Square2" to="." method="_on_building_area_entered"]
|
||||
[connection signal="area_entered" from="Square3" to="." method="_on_building_area_entered"]
|
||||
[connection signal="area_entered" from="Square4" to="." method="_on_building_area_entered"]
|
||||
[connection signal="area_entered" from="Square5" to="." method="_on_building_area_entered"]
|
||||
@ -1,91 +0,0 @@
|
||||
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 heading_1 := Board.get_next_direction(Board.Direction.DOWN, get_rotation_count())
|
||||
var heading_2 := Board.get_next_direction(Board.Direction.LEFT, get_rotation_count())
|
||||
var heading_3 := Board.get_next_direction(Board.Direction.RIGHT, get_rotation_count())
|
||||
|
||||
var entrance_1 := starting_coord + Board.get_direction_vector(up_adjustment)
|
||||
var entrance_2 := (
|
||||
starting_coord
|
||||
+ Board.get_direction_vector(right_adjustment)
|
||||
+ Board.get_direction_vector(up_adjustment)
|
||||
)
|
||||
return (
|
||||
(coord == entrance_1 and direction == heading_1)
|
||||
or (coord == entrance_2 and direction == heading_1)
|
||||
or (coord == entrance_1 and direction == heading_2)
|
||||
or (coord == entrance_2 and direction == heading_3)
|
||||
)
|
||||
|
||||
|
||||
func get_tile_coords() -> Array[Vector2i]:
|
||||
var result: Array[Vector2i] = []
|
||||
result.push_back(starting_coord)
|
||||
result.push_back(
|
||||
starting_coord + Vector2i(Vector2.LEFT.rotated(deg_to_rad(90 * get_rotation_count())))
|
||||
)
|
||||
result.push_back(
|
||||
(
|
||||
starting_coord
|
||||
+ Vector2i(Vector2.LEFT.rotated(deg_to_rad(90 * get_rotation_count())))
|
||||
+ Vector2i(Vector2.UP.rotated(deg_to_rad(90 * get_rotation_count())))
|
||||
)
|
||||
)
|
||||
result.push_back(
|
||||
starting_coord + Vector2i(Vector2.RIGHT.rotated(deg_to_rad(90 * get_rotation_count())))
|
||||
)
|
||||
result.push_back(
|
||||
(
|
||||
starting_coord
|
||||
+ Vector2i(Vector2.RIGHT.rotated(deg_to_rad(90 * get_rotation_count())))
|
||||
+ Vector2i(Vector2.RIGHT.rotated(deg_to_rad(90 * get_rotation_count())))
|
||||
)
|
||||
)
|
||||
result.push_back(
|
||||
(
|
||||
starting_coord
|
||||
+ Vector2i(Vector2.RIGHT.rotated(deg_to_rad(90 * get_rotation_count())))
|
||||
+ Vector2i(Vector2.RIGHT.rotated(deg_to_rad(90 * get_rotation_count())))
|
||||
+ Vector2i(Vector2.UP.rotated(deg_to_rad(90 * get_rotation_count())))
|
||||
)
|
||||
)
|
||||
return result
|
||||
|
||||
|
||||
func get_direction_queue(_citizen: Citizen) -> Array[Board.Direction]:
|
||||
return [Board.Direction.NONE]
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
func handle_post_turn_actions() -> void:
|
||||
Globals.board_game.current_board_state.citizens_starting_money += floori(money / 20.0)
|
||||
money = money % 20
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_set_money_label()
|
||||
|
||||
|
||||
func _set_money_label() -> void:
|
||||
if is_node_ready():
|
||||
money_label.text = "$%d / $20" % money
|
||||
@ -1 +0,0 @@
|
||||
uid://o6nqgcvqrcvu
|
||||
@ -1,275 +0,0 @@
|
||||
[gd_scene format=3 uid="uid://dtnejoimqiu0o"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://o6nqgcvqrcvu" path="res://prefabs/tiles/buildings/city_hall.gd" id="1_fjery"]
|
||||
[ext_resource type="Texture2D" uid="uid://t8n660a0vqvm" path="res://assets/Pixelart arrow icon pack 1.0.png" id="2_ffriu"]
|
||||
[ext_resource type="Texture2D" uid="uid://dijho2wx1l4sm" path="res://assets/bomb/bomb.png" id="3_ffriu"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_q4p5y"]
|
||||
colors = PackedColorArray(0, 1, 0, 1, 1, 0, 0, 1)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_vwg8v"]
|
||||
outline_size = 4
|
||||
outline_color = Color(0, 0, 0, 1)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vwg8v"]
|
||||
size = Vector2(109, 109)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_wwwaf"]
|
||||
atlas = ExtResource("2_ffriu")
|
||||
region = Rect2(16, 16, 16, 16)
|
||||
|
||||
[node name="CityHall" type="Node2D" unique_id=746270571 groups=["PostTurnActions"]]
|
||||
process_mode = 3
|
||||
script = ExtResource("1_fjery")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="." unique_id=889061850]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
offset_left = -55.0
|
||||
offset_top = -55.0
|
||||
offset_right = 55.0
|
||||
offset_bottom = 55.0
|
||||
mouse_filter = 2
|
||||
color = Color(0.76862746, 0.76862746, 0.76862746, 1)
|
||||
|
||||
[node name="ColorRect2" type="ColorRect" parent="." unique_id=2077475895]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
offset_left = 165.0
|
||||
offset_top = -165.0
|
||||
offset_right = 275.0
|
||||
offset_bottom = -55.0
|
||||
mouse_filter = 2
|
||||
color = Color(0.76862746, 0.76862746, 0.76862746, 1)
|
||||
|
||||
[node name="ColorRect3" type="ColorRect" parent="." unique_id=1401405224]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
offset_left = 55.0
|
||||
offset_top = -55.0
|
||||
offset_right = 165.0
|
||||
offset_bottom = 55.0
|
||||
mouse_filter = 2
|
||||
color = Color(0.76862746, 0.76862746, 0.76862746, 1)
|
||||
|
||||
[node name="ColorRect5" type="ColorRect" parent="." unique_id=1828290008]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
offset_left = -165.0
|
||||
offset_top = -55.0
|
||||
offset_right = -55.0
|
||||
offset_bottom = 55.0
|
||||
mouse_filter = 2
|
||||
color = Color(0.76862746, 0.76862746, 0.76862746, 1)
|
||||
|
||||
[node name="ColorRect6" type="ColorRect" parent="." unique_id=1870057015]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
offset_left = 165.0
|
||||
offset_top = -55.0
|
||||
offset_right = 275.0
|
||||
offset_bottom = 55.0
|
||||
mouse_filter = 2
|
||||
color = Color(0.76862746, 0.76862746, 0.76862746, 1)
|
||||
|
||||
[node name="ColorRect4" type="ColorRect" parent="." unique_id=255418342]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
offset_left = -165.0
|
||||
offset_top = -165.0
|
||||
offset_right = -55.0
|
||||
offset_bottom = -55.0
|
||||
mouse_filter = 2
|
||||
color = Color(0.76862746, 0.76862746, 0.76862746, 1)
|
||||
|
||||
[node name="Edge1" type="Line2D" parent="." unique_id=339174361]
|
||||
position = Vector2(55, -55)
|
||||
points = PackedVector2Array(0, 0, 0, 110)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Edge4" type="Line2D" parent="." unique_id=1932588550]
|
||||
position = Vector2(165, -55)
|
||||
points = PackedVector2Array(0, 0, 0, 110)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Edge3" type="Line2D" parent="." unique_id=834803169]
|
||||
position = Vector2(-55, -55)
|
||||
points = PackedVector2Array(0, 0, 0, 110)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Edge2" type="Line2D" parent="." unique_id=13095279]
|
||||
position = Vector2(-165, -55)
|
||||
points = PackedVector2Array(0, 0, 110, 0)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Edge5" type="Line2D" parent="." unique_id=1862206542]
|
||||
position = Vector2(165, -55)
|
||||
points = PackedVector2Array(0, 0, 110, 0)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Path1" type="Line2D" parent="." unique_id=1853389348]
|
||||
points = PackedVector2Array(0, -45, 0, 0)
|
||||
width = 2.0
|
||||
gradient = SubResource("Gradient_q4p5y")
|
||||
joint_mode = 2
|
||||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
|
||||
[node name="Path3" type="Line2D" parent="." unique_id=1156504221]
|
||||
points = PackedVector2Array(110, -45, 110, 0)
|
||||
width = 2.0
|
||||
gradient = SubResource("Gradient_q4p5y")
|
||||
joint_mode = 2
|
||||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
|
||||
[node name="Path2" type="Line2D" parent="." unique_id=1557159962]
|
||||
visible = false
|
||||
points = PackedVector2Array(-60, -110, -110, -110, -110, 0, 0, 0)
|
||||
width = 2.0
|
||||
gradient = SubResource("Gradient_q4p5y")
|
||||
joint_mode = 2
|
||||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
|
||||
[node name="Path5" type="Line2D" parent="." unique_id=133940427]
|
||||
points = PackedVector2Array(-60, -110, -110, -110)
|
||||
width = 2.0
|
||||
gradient = SubResource("Gradient_q4p5y")
|
||||
joint_mode = 2
|
||||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
|
||||
[node name="Path4" type="Line2D" parent="." unique_id=2009894608]
|
||||
visible = false
|
||||
points = PackedVector2Array(170, -110, 220, -110, 220, 0, 110, 0)
|
||||
width = 2.0
|
||||
gradient = SubResource("Gradient_q4p5y")
|
||||
joint_mode = 2
|
||||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
|
||||
[node name="Path6" type="Line2D" parent="." unique_id=566619967]
|
||||
points = PackedVector2Array(170, -110, 220, -110)
|
||||
width = 2.0
|
||||
gradient = SubResource("Gradient_q4p5y")
|
||||
joint_mode = 2
|
||||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="." unique_id=29286194]
|
||||
custom_minimum_size = Vector2(220, 110)
|
||||
offset_left = -165.0
|
||||
offset_top = -55.0
|
||||
offset_right = 55.0
|
||||
offset_bottom = 55.0
|
||||
text = "CITY HALL"
|
||||
label_settings = SubResource("LabelSettings_vwg8v")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="MoneyLabel" type="Label" parent="." unique_id=1651554831]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(220, 110)
|
||||
offset_left = 55.0
|
||||
offset_top = -55.0
|
||||
offset_right = 275.0
|
||||
offset_bottom = 55.0
|
||||
text = "$0 / $20"
|
||||
label_settings = SubResource("LabelSettings_vwg8v")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Square1" type="Area2D" parent="." unique_id=333775731]
|
||||
process_mode = 3
|
||||
position = Vector2(-110, -110)
|
||||
monitoring = false
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square1" unique_id=1122204523]
|
||||
process_mode = 3
|
||||
shape = SubResource("RectangleShape2D_vwg8v")
|
||||
|
||||
[node name="Square2" type="Area2D" parent="." unique_id=1695837302]
|
||||
process_mode = 3
|
||||
position = Vector2(-110, 0)
|
||||
monitoring = false
|
||||
|
||||
[node name="CollisionShape2D2" type="CollisionShape2D" parent="Square2" unique_id=451761201]
|
||||
shape = SubResource("RectangleShape2D_vwg8v")
|
||||
|
||||
[node name="Square3" type="Area2D" parent="." unique_id=1667620998]
|
||||
process_mode = 3
|
||||
monitoring = false
|
||||
|
||||
[node name="CollisionShape2D3" type="CollisionShape2D" parent="Square3" unique_id=636207289]
|
||||
shape = SubResource("RectangleShape2D_vwg8v")
|
||||
|
||||
[node name="Square4" type="Area2D" parent="." unique_id=2144774838]
|
||||
process_mode = 3
|
||||
position = Vector2(110, 0)
|
||||
monitoring = false
|
||||
|
||||
[node name="CollisionShape2D4" type="CollisionShape2D" parent="Square4" unique_id=847000506]
|
||||
shape = SubResource("RectangleShape2D_vwg8v")
|
||||
|
||||
[node name="Square5" type="Area2D" parent="." unique_id=487050690]
|
||||
process_mode = 3
|
||||
position = Vector2(220, 0)
|
||||
monitoring = false
|
||||
|
||||
[node name="CollisionShape2D3" type="CollisionShape2D" parent="Square5" unique_id=443838422]
|
||||
shape = SubResource("RectangleShape2D_vwg8v")
|
||||
|
||||
[node name="Square6" type="Area2D" parent="." unique_id=166209419]
|
||||
process_mode = 3
|
||||
position = Vector2(220, -110)
|
||||
monitoring = false
|
||||
|
||||
[node name="CollisionShape2D4" type="CollisionShape2D" parent="Square6" unique_id=1139295646]
|
||||
shape = SubResource("RectangleShape2D_vwg8v")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=1585332168]
|
||||
texture_filter = 1
|
||||
position = Vector2(0, -75)
|
||||
scale = Vector2(2, 2)
|
||||
texture = SubResource("AtlasTexture_wwwaf")
|
||||
flip_v = true
|
||||
|
||||
[node name="Sprite2D3" type="Sprite2D" parent="." unique_id=1370361419]
|
||||
texture_filter = 1
|
||||
position = Vector2(110, -75)
|
||||
scale = Vector2(2, 2)
|
||||
texture = SubResource("AtlasTexture_wwwaf")
|
||||
flip_v = true
|
||||
|
||||
[node name="Sprite2D2" type="Sprite2D" parent="." unique_id=642202825]
|
||||
texture_filter = 1
|
||||
position = Vector2(-35, -110)
|
||||
rotation = 1.5707964
|
||||
scale = Vector2(2, 2)
|
||||
texture = SubResource("AtlasTexture_wwwaf")
|
||||
flip_v = true
|
||||
|
||||
[node name="Sprite2D4" type="Sprite2D" parent="." unique_id=1304871355]
|
||||
texture_filter = 1
|
||||
position = Vector2(145, -110)
|
||||
rotation = -1.5707964
|
||||
scale = Vector2(2, 2)
|
||||
texture = SubResource("AtlasTexture_wwwaf")
|
||||
flip_v = true
|
||||
|
||||
[node name="Size" type="Control" parent="." unique_id=1957708982]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_left = -165.0
|
||||
offset_top = -165.0
|
||||
offset_right = 275.0
|
||||
offset_bottom = 55.0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="BombSprite" type="Sprite2D" parent="." unique_id=359242472]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
position = Vector2(55, 0)
|
||||
scale = Vector2(0.415, 0.415)
|
||||
texture = ExtResource("3_ffriu")
|
||||
@ -1,106 +0,0 @@
|
||||
extends Building
|
||||
|
||||
var money: int = 0:
|
||||
set(value):
|
||||
money = value
|
||||
_set_money_label()
|
||||
|
||||
var required_money: int = 25
|
||||
|
||||
@onready var money_label: Label = %MoneyLabel
|
||||
|
||||
|
||||
func can_citizen_enter(coord: Vector2i, direction: Board.Direction) -> bool:
|
||||
var down_adjustment := Board.get_next_direction(Board.Direction.DOWN, get_rotation_count())
|
||||
var left_adjustment := Board.get_next_direction(Board.Direction.LEFT, get_rotation_count())
|
||||
var right_adjustment := Board.get_next_direction(Board.Direction.RIGHT, get_rotation_count())
|
||||
var heading_1 := Board.get_next_direction(Board.Direction.RIGHT, get_rotation_count())
|
||||
var heading_2 := Board.get_next_direction(Board.Direction.UP, get_rotation_count())
|
||||
|
||||
var entrance_1 := starting_coord + Board.get_direction_vector(left_adjustment)
|
||||
var entrance_2 := (
|
||||
starting_coord
|
||||
+ Board.get_direction_vector(right_adjustment)
|
||||
+ Board.get_direction_vector(down_adjustment)
|
||||
+ Board.get_direction_vector(down_adjustment)
|
||||
)
|
||||
return (
|
||||
(coord == entrance_1 and direction == heading_1)
|
||||
or (coord == entrance_2 and direction == heading_2)
|
||||
)
|
||||
|
||||
|
||||
func get_tile_coords() -> Array[Vector2i]:
|
||||
var result: Array[Vector2i] = []
|
||||
result.push_back(starting_coord)
|
||||
result.push_back(
|
||||
starting_coord + Vector2i(Vector2.RIGHT.rotated(deg_to_rad(90 * get_rotation_count())))
|
||||
)
|
||||
result.push_back(
|
||||
(
|
||||
starting_coord
|
||||
+ Vector2i(Vector2.RIGHT.rotated(deg_to_rad(90 * get_rotation_count())))
|
||||
+ Vector2i(Vector2.DOWN.rotated(deg_to_rad(90 * get_rotation_count())))
|
||||
)
|
||||
)
|
||||
result.push_back(
|
||||
(
|
||||
starting_coord
|
||||
+ Vector2i(Vector2.RIGHT.rotated(deg_to_rad(90 * get_rotation_count())))
|
||||
+ Vector2i(Vector2.RIGHT.rotated(deg_to_rad(90 * get_rotation_count())))
|
||||
)
|
||||
)
|
||||
result.push_back(
|
||||
(
|
||||
starting_coord
|
||||
+ Vector2i(Vector2.RIGHT.rotated(deg_to_rad(90 * get_rotation_count())))
|
||||
+ Vector2i(Vector2.RIGHT.rotated(deg_to_rad(90 * get_rotation_count())))
|
||||
+ Vector2i(Vector2.UP.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.RIGHT, get_rotation_count()),
|
||||
Board.get_next_direction(Board.Direction.RIGHT, get_rotation_count()),
|
||||
Board.get_next_direction(Board.Direction.UP, get_rotation_count()),
|
||||
Board.get_next_direction(Board.Direction.UP, get_rotation_count())
|
||||
]
|
||||
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.UP, get_rotation_count()),
|
||||
Board.get_next_direction(Board.Direction.UP, 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:
|
||||
var buildings_to_destroy := floori(money / (required_money as float))
|
||||
if buildings_to_destroy > 0:
|
||||
money = money % required_money
|
||||
required_money *= 2
|
||||
Globals.board_game.queue_building_destruction(buildings_to_destroy)
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_set_money_label()
|
||||
|
||||
|
||||
func _set_money_label() -> void:
|
||||
if is_node_ready():
|
||||
money_label.text = "$%d / $%d" % [money, required_money]
|
||||
@ -1 +0,0 @@
|
||||
uid://vqn4mgyjkijm
|
||||
@ -1,219 +0,0 @@
|
||||
[gd_scene format=3 uid="uid://dvmglvbersupv"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://vqn4mgyjkijm" path="res://prefabs/tiles/buildings/demolitions.gd" id="1_veblj"]
|
||||
[ext_resource type="Texture2D" uid="uid://t8n660a0vqvm" path="res://assets/Pixelart arrow icon pack 1.0.png" id="2_gnrqc"]
|
||||
[ext_resource type="Texture2D" uid="uid://dijho2wx1l4sm" path="res://assets/bomb/bomb.png" id="3_gnrqc"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_rc38y"]
|
||||
colors = PackedColorArray(0, 1, 0, 1, 1, 0, 0, 1)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_vwg8v"]
|
||||
outline_size = 4
|
||||
outline_color = Color(0, 0, 0, 1)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vwg8v"]
|
||||
size = Vector2(109, 109)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_wwwaf"]
|
||||
atlas = ExtResource("2_gnrqc")
|
||||
region = Rect2(16, 16, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_fupku"]
|
||||
atlas = ExtResource("2_gnrqc")
|
||||
region = Rect2(0, 16, 16, 16)
|
||||
|
||||
[node name="Demolitions" type="Node2D" unique_id=746270571 groups=["PostTurnActions"]]
|
||||
process_mode = 3
|
||||
script = ExtResource("1_veblj")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="." unique_id=889061850]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
offset_left = -55.0
|
||||
offset_top = -55.0
|
||||
offset_right = 55.0
|
||||
offset_bottom = 55.0
|
||||
mouse_filter = 2
|
||||
color = Color(1, 0.32086813, 0.41687015, 1)
|
||||
|
||||
[node name="ColorRect2" type="ColorRect" parent="." unique_id=2077475895]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
offset_left = 55.0
|
||||
offset_top = 55.0
|
||||
offset_right = 165.0
|
||||
offset_bottom = 165.0
|
||||
mouse_filter = 2
|
||||
color = Color(1, 0.32086813, 0.41687015, 1)
|
||||
|
||||
[node name="ColorRect3" type="ColorRect" parent="." unique_id=1401405224]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
offset_left = 55.0
|
||||
offset_top = -55.0
|
||||
offset_right = 165.0
|
||||
offset_bottom = 55.0
|
||||
mouse_filter = 2
|
||||
color = Color(1, 0.32086813, 0.41687015, 1)
|
||||
|
||||
[node name="ColorRect4" type="ColorRect" parent="." unique_id=255418342]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
offset_left = 165.0
|
||||
offset_top = -165.0
|
||||
offset_right = 275.0
|
||||
offset_bottom = -55.0
|
||||
mouse_filter = 2
|
||||
color = Color(1, 0.32086813, 0.41687015, 1)
|
||||
|
||||
[node name="ColorRect5" type="ColorRect" parent="." unique_id=835614422]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
offset_left = 165.0
|
||||
offset_top = -55.0
|
||||
offset_right = 275.0
|
||||
offset_bottom = 55.0
|
||||
mouse_filter = 2
|
||||
color = Color(1, 0.32086813, 0.41687015, 1)
|
||||
|
||||
[node name="Edge1" type="Line2D" parent="." unique_id=1571287153]
|
||||
points = PackedVector2Array(55, -55, 55, 55)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Edge2" type="Line2D" parent="." unique_id=1717512039]
|
||||
points = PackedVector2Array(55, 55, 165, 55)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Edge4" type="Line2D" parent="." unique_id=1861531130]
|
||||
points = PackedVector2Array(165, -55, 275, -55)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Edge3" type="Line2D" parent="." unique_id=1513651550]
|
||||
points = PackedVector2Array(165, -55, 165, 55)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Path1" type="Line2D" parent="." unique_id=1015237330]
|
||||
points = PackedVector2Array(-45, 0, 220, 0, 220, -155)
|
||||
width = 2.0
|
||||
gradient = SubResource("Gradient_rc38y")
|
||||
joint_mode = 2
|
||||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
|
||||
[node name="Path2" type="Line2D" parent="." unique_id=1737173036]
|
||||
points = PackedVector2Array(110, 155, 110, 0, 220, 0, 220, -155)
|
||||
width = 2.0
|
||||
gradient = SubResource("Gradient_rc38y")
|
||||
joint_mode = 2
|
||||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="." unique_id=29286194]
|
||||
custom_minimum_size = Vector2(220, 110)
|
||||
offset_left = -55.0
|
||||
offset_top = -55.0
|
||||
offset_right = 165.0
|
||||
offset_bottom = 55.0
|
||||
text = "DEMOLITIONS"
|
||||
label_settings = SubResource("LabelSettings_vwg8v")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="MoneyLabel" type="Label" parent="." unique_id=1384875448]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(220, 110)
|
||||
offset_left = 165.0
|
||||
offset_top = 55.0
|
||||
offset_right = 385.0
|
||||
offset_bottom = 165.0
|
||||
rotation = -1.5707964
|
||||
text = "$0 / $25"
|
||||
label_settings = SubResource("LabelSettings_vwg8v")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Square1" type="Area2D" parent="." unique_id=333775731]
|
||||
process_mode = 3
|
||||
monitoring = false
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square1" unique_id=1122204523]
|
||||
process_mode = 3
|
||||
shape = SubResource("RectangleShape2D_vwg8v")
|
||||
|
||||
[node name="Square2" type="Area2D" parent="." unique_id=1384097423]
|
||||
process_mode = 3
|
||||
position = Vector2(110, 0)
|
||||
monitoring = false
|
||||
|
||||
[node name="CollisionShape2D2" type="CollisionShape2D" parent="Square2" unique_id=686018821]
|
||||
shape = SubResource("RectangleShape2D_vwg8v")
|
||||
|
||||
[node name="Square3" type="Area2D" parent="." unique_id=837457110]
|
||||
process_mode = 3
|
||||
position = Vector2(110, 110)
|
||||
monitoring = false
|
||||
|
||||
[node name="CollisionShape2D3" type="CollisionShape2D" parent="Square3" unique_id=1976346563]
|
||||
shape = SubResource("RectangleShape2D_vwg8v")
|
||||
|
||||
[node name="Square4" type="Area2D" parent="." unique_id=1074092983]
|
||||
process_mode = 3
|
||||
position = Vector2(220, 0)
|
||||
monitoring = false
|
||||
|
||||
[node name="CollisionShape2D4" type="CollisionShape2D" parent="Square4" unique_id=442777190]
|
||||
shape = SubResource("RectangleShape2D_vwg8v")
|
||||
|
||||
[node name="Square5" type="Area2D" parent="." unique_id=1891937507]
|
||||
process_mode = 3
|
||||
position = Vector2(220, -110)
|
||||
monitoring = false
|
||||
|
||||
[node name="CollisionShape2D4" type="CollisionShape2D" parent="Square5" unique_id=1224759052]
|
||||
shape = SubResource("RectangleShape2D_vwg8v")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=1585332168]
|
||||
texture_filter = 1
|
||||
position = Vector2(-80, 0)
|
||||
rotation = -1.5707964
|
||||
scale = Vector2(2, 2)
|
||||
texture = SubResource("AtlasTexture_wwwaf")
|
||||
flip_v = true
|
||||
|
||||
[node name="Sprite2D2" type="Sprite2D" parent="." unique_id=1969702659]
|
||||
texture_filter = 1
|
||||
position = Vector2(220, -185)
|
||||
rotation = 3.1415927
|
||||
scale = Vector2(2, 2)
|
||||
texture = SubResource("AtlasTexture_fupku")
|
||||
flip_v = true
|
||||
|
||||
[node name="Sprite2D3" type="Sprite2D" parent="." unique_id=1607154314]
|
||||
texture_filter = 1
|
||||
position = Vector2(110, 185)
|
||||
rotation = 3.1415927
|
||||
scale = Vector2(2, 2)
|
||||
texture = SubResource("AtlasTexture_wwwaf")
|
||||
flip_v = true
|
||||
|
||||
[node name="Size" type="Control" parent="." unique_id=705793849]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_left = -95.0
|
||||
offset_top = -205.0
|
||||
offset_right = 275.0
|
||||
offset_bottom = 200.0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="BombSprite" type="Sprite2D" parent="." unique_id=969295810]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
position = Vector2(110, 0)
|
||||
scale = Vector2(0.415, 0.415)
|
||||
texture = ExtResource("3_gnrqc")
|
||||
|
||||
[connection signal="area_entered" from="Square1" to="." method="_on_building_area_entered"]
|
||||
[connection signal="area_entered" from="Square2" to="." method="_on_building_area_entered"]
|
||||
[connection signal="area_entered" from="Square3" to="." method="_on_building_area_entered"]
|
||||
[connection signal="area_entered" from="Square4" to="." method="_on_building_area_entered"]
|
||||
[connection signal="area_entered" from="Square5" to="." method="_on_building_area_entered"]
|
||||
@ -2,7 +2,6 @@
|
||||
|
||||
[ext_resource type="Script" uid="uid://dib6oco6b3wfl" path="res://prefabs/tiles/buildings/fork.gd" id="1_pht35"]
|
||||
[ext_resource type="Texture2D" uid="uid://t8n660a0vqvm" path="res://assets/Pixelart arrow icon pack 1.0.png" id="2_rnjsh"]
|
||||
[ext_resource type="Texture2D" uid="uid://dijho2wx1l4sm" path="res://assets/bomb/bomb.png" id="3_rnjsh"]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_vwg8v"]
|
||||
outline_size = 4
|
||||
@ -85,10 +84,4 @@ offset_right = 95.0
|
||||
offset_bottom = 95.0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="BombSprite" type="Sprite2D" parent="." unique_id=2024150262]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
scale = Vector2(0.415, 0.415)
|
||||
texture = ExtResource("3_rnjsh")
|
||||
|
||||
[connection signal="area_entered" from="Square1" to="." method="_on_building_area_entered"]
|
||||
|
||||
@ -2,10 +2,6 @@
|
||||
|
||||
[ext_resource type="Script" uid="uid://bnyy0ojlolrjj" path="res://prefabs/tiles/buildings/gun_shop.gd" id="1_llmep"]
|
||||
[ext_resource type="Texture2D" uid="uid://t8n660a0vqvm" path="res://assets/Pixelart arrow icon pack 1.0.png" id="2_qam00"]
|
||||
[ext_resource type="Texture2D" uid="uid://dijho2wx1l4sm" path="res://assets/bomb/bomb.png" id="3_qam00"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_llmep"]
|
||||
colors = PackedColorArray(0, 1, 0, 1, 1, 0, 0, 1)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_vwg8v"]
|
||||
outline_size = 4
|
||||
@ -80,52 +76,6 @@ offset_bottom = -165.0
|
||||
mouse_filter = 2
|
||||
color = Color(1, 0, 0, 1)
|
||||
|
||||
[node name="Edge1" type="Line2D" parent="." unique_id=449391407]
|
||||
points = PackedVector2Array(-55, -55, 55, -55)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Edge2" type="Line2D" parent="." unique_id=1445681514]
|
||||
points = PackedVector2Array(-55, -165, 55, -165)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Edge6" type="Line2D" parent="." unique_id=972653058]
|
||||
points = PackedVector2Array(55, -165, 165, -165)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Edge3" type="Line2D" parent="." unique_id=660094100]
|
||||
points = PackedVector2Array(55, -55, 55, -165)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Edge4" type="Line2D" parent="." unique_id=809290006]
|
||||
points = PackedVector2Array(55, -165, 55, -275)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Edge5" type="Line2D" parent="." unique_id=1293100381]
|
||||
points = PackedVector2Array(165, -165, 165, -275)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Path1" type="Line2D" parent="." unique_id=11871023]
|
||||
points = PackedVector2Array(-10, 45, -10, -120, 100, -120, 100, -230, 265, -230)
|
||||
width = 2.0
|
||||
gradient = SubResource("Gradient_llmep")
|
||||
joint_mode = 2
|
||||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
|
||||
[node name="Path2" type="Line2D" parent="." unique_id=971383413]
|
||||
points = PackedVector2Array(265, -210, 120, -210, 120, -100, 10, -100, 10, 45)
|
||||
width = 2.0
|
||||
gradient = SubResource("Gradient_llmep")
|
||||
joint_mode = 2
|
||||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="." unique_id=29286194]
|
||||
custom_minimum_size = Vector2(220, 220)
|
||||
offset_left = -55.0
|
||||
@ -233,13 +183,6 @@ offset_right = 315.0
|
||||
offset_bottom = 95.0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="BombSprite" type="Sprite2D" parent="." unique_id=1461776445]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
position = Vector2(55, -165)
|
||||
scale = Vector2(0.415, 0.415)
|
||||
texture = ExtResource("3_qam00")
|
||||
|
||||
[connection signal="area_entered" from="Square1" to="." method="_on_building_area_entered"]
|
||||
[connection signal="area_entered" from="Square2" to="." method="_on_building_area_entered"]
|
||||
[connection signal="area_entered" from="Square3" to="." method="_on_building_area_entered"]
|
||||
|
||||
@ -1,5 +1,10 @@
|
||||
class_name Home extends Building
|
||||
|
||||
var player: Player:
|
||||
set(value):
|
||||
player = value
|
||||
_set_border_color()
|
||||
|
||||
@onready var border: PanelContainer = %Border
|
||||
|
||||
|
||||
@ -9,7 +14,6 @@ func _ready() -> void:
|
||||
|
||||
func activate(citizen: Citizen) -> void:
|
||||
player.money += citizen.money
|
||||
Globals.board_game.update_player_money(player, player.money)
|
||||
|
||||
|
||||
func can_citizen_enter(_coord: Vector2i, _direction: Board.Direction) -> bool:
|
||||
@ -24,11 +28,6 @@ func get_tile_coords() -> Array[Vector2i]:
|
||||
return [starting_coord]
|
||||
|
||||
|
||||
func _set_player(new_player: Player) -> void:
|
||||
super(new_player)
|
||||
_set_border_color()
|
||||
|
||||
|
||||
func _set_border_color() -> void:
|
||||
if !is_node_ready() or player == null:
|
||||
return
|
||||
|
||||
@ -104,9 +104,5 @@ offset_right = 55.0
|
||||
offset_bottom = 55.0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="BombSprite" type="Sprite2D" parent="." unique_id=945306262]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
|
||||
[connection signal="tree_entered" from="." to="." method="_on_tree_entered"]
|
||||
[connection signal="area_entered" from="BuildingArea" to="." method="_on_building_area_entered"]
|
||||
|
||||
@ -2,10 +2,6 @@
|
||||
|
||||
[ext_resource type="Script" uid="uid://covp0ql04uour" path="res://prefabs/tiles/buildings/hospital.gd" id="1_sjpox"]
|
||||
[ext_resource type="Texture2D" uid="uid://t8n660a0vqvm" path="res://assets/Pixelart arrow icon pack 1.0.png" id="2_kp5oa"]
|
||||
[ext_resource type="Texture2D" uid="uid://dijho2wx1l4sm" path="res://assets/bomb/bomb.png" id="3_kp5oa"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_sjpox"]
|
||||
colors = PackedColorArray(0, 1, 0, 1, 1, 0, 0, 1)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_vwg8v"]
|
||||
outline_size = 4
|
||||
@ -80,52 +76,6 @@ offset_bottom = 55.0
|
||||
mouse_filter = 2
|
||||
color = Color(0, 1, 1, 1)
|
||||
|
||||
[node name="Edge1" type="Line2D" parent="." unique_id=432626063]
|
||||
points = PackedVector2Array(55, -55, 55, 55)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Edge4" type="Line2D" parent="." unique_id=657614006]
|
||||
points = PackedVector2Array(55, -55, 165, -55)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Edge5" type="Line2D" parent="." unique_id=622851887]
|
||||
points = PackedVector2Array(165, -55, 275, -55)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Edge2" type="Line2D" parent="." unique_id=1457217309]
|
||||
points = PackedVector2Array(165, -55, 165, 55)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Edge6" type="Line2D" parent="." unique_id=808573455]
|
||||
points = PackedVector2Array(165, -165, 165, -55)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Edge3" type="Line2D" parent="." unique_id=1549839878]
|
||||
points = PackedVector2Array(275, -55, 275, 55)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Path1" type="Line2D" parent="." unique_id=390139329]
|
||||
points = PackedVector2Array(110, -155, 110, 0, -45, 0)
|
||||
width = 2.0
|
||||
gradient = SubResource("Gradient_sjpox")
|
||||
joint_mode = 2
|
||||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
|
||||
[node name="Path2" type="Line2D" parent="." unique_id=586585998]
|
||||
points = PackedVector2Array(220, -155, 220, 0, 375, 0)
|
||||
width = 2.0
|
||||
gradient = SubResource("Gradient_sjpox")
|
||||
joint_mode = 2
|
||||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="." unique_id=29286194]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
offset_left = 55.0
|
||||
@ -232,13 +182,6 @@ offset_right = 425.0
|
||||
offset_bottom = 55.0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="BombSprite" type="Sprite2D" parent="." unique_id=2046559622]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
position = Vector2(165, -55)
|
||||
scale = Vector2(0.415, 0.415)
|
||||
texture = ExtResource("3_kp5oa")
|
||||
|
||||
[connection signal="area_entered" from="Square1" to="." method="_on_building_area_entered"]
|
||||
[connection signal="area_entered" from="Square2" to="." method="_on_building_area_entered"]
|
||||
[connection signal="area_entered" from="Square3" to="." method="_on_building_area_entered"]
|
||||
|
||||
@ -1,36 +0,0 @@
|
||||
class_name HQ extends Building
|
||||
|
||||
@onready var border: PanelContainer = %Border
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_set_border_color()
|
||||
|
||||
|
||||
func activate(_citizen: Citizen) -> void:
|
||||
player.votes += 1
|
||||
Globals.board_game.update_player_votes(player, player.votes)
|
||||
|
||||
|
||||
func can_citizen_enter(_coord: Vector2i, _direction: Board.Direction) -> bool:
|
||||
return true
|
||||
|
||||
|
||||
func get_direction_queue(_citizen: Citizen) -> Array[Board.Direction]:
|
||||
return [Board.Direction.NONE]
|
||||
|
||||
|
||||
func get_tile_coords() -> Array[Vector2i]:
|
||||
return [starting_coord]
|
||||
|
||||
|
||||
func _set_player(new_player: Player) -> void:
|
||||
super(new_player)
|
||||
_set_border_color()
|
||||
|
||||
|
||||
func _set_border_color() -> void:
|
||||
if !is_node_ready() or player == null:
|
||||
return
|
||||
var style_box: StyleBoxFlat = border.get_theme_stylebox("panel")
|
||||
style_box.border_color = player.color
|
||||
@ -1 +0,0 @@
|
||||
uid://csds0yc7qiqbk
|
||||
@ -1,112 +0,0 @@
|
||||
[gd_scene format=3 uid="uid://wdgig5aclnpx"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://csds0yc7qiqbk" path="res://prefabs/tiles/buildings/hq.gd" id="1_4lnov"]
|
||||
[ext_resource type="Texture2D" uid="uid://1fs47aytjsp6" path="res://assets/2d_city/2dcitywithoutoutline/house1/1house0001.png" id="2_a4yr4"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_6ic3m"]
|
||||
resource_local_to_scene = true
|
||||
content_margin_left = 10.0
|
||||
content_margin_top = 10.0
|
||||
content_margin_right = 10.0
|
||||
content_margin_bottom = 10.0
|
||||
bg_color = Color(0.6, 0.6, 0.6, 0)
|
||||
border_width_left = 5
|
||||
border_width_top = 5
|
||||
border_width_right = 5
|
||||
border_width_bottom = 5
|
||||
border_color = Color(1, 1, 1, 0)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_2y6xd"]
|
||||
atlas = ExtResource("2_a4yr4")
|
||||
region = Rect2(799, 82, 374, 364)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_26feb"]
|
||||
font_size = 24
|
||||
outline_size = 4
|
||||
outline_color = Color(0, 0, 0, 1)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ja20k"]
|
||||
size = Vector2(109, 109)
|
||||
|
||||
[node name="HQ" type="Node2D" unique_id=1701297833]
|
||||
script = ExtResource("1_4lnov")
|
||||
|
||||
[node name="Border" type="PanelContainer" parent="." unique_id=1535918688]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(100, 100)
|
||||
offset_left = -50.0
|
||||
offset_top = -50.0
|
||||
offset_right = 50.0
|
||||
offset_bottom = 50.0
|
||||
mouse_filter = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_6ic3m")
|
||||
|
||||
[node name="Icon" type="TextureRect" parent="Border" unique_id=1316631070]
|
||||
texture_filter = 1
|
||||
layout_mode = 2
|
||||
mouse_filter = 2
|
||||
texture = SubResource("AtlasTexture_2y6xd")
|
||||
expand_mode = 5
|
||||
|
||||
[node name="Label" type="Label" parent="Border/Icon" unique_id=134308374]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -42.5
|
||||
offset_top = -17.0
|
||||
offset_right = 42.5
|
||||
offset_bottom = 17.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 4
|
||||
text = "HQ"
|
||||
label_settings = SubResource("LabelSettings_26feb")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Amount" type="Label" parent="Border/Icon" unique_id=1728513182]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -42.5
|
||||
offset_top = -17.0
|
||||
offset_right = 42.5
|
||||
offset_bottom = 17.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 4
|
||||
text = "SPAWN"
|
||||
label_settings = SubResource("LabelSettings_26feb")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="BuildingArea" type="Area2D" parent="." unique_id=812662804]
|
||||
unique_name_in_owner = true
|
||||
monitoring = false
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="BuildingArea" unique_id=660262437]
|
||||
shape = SubResource("RectangleShape2D_ja20k")
|
||||
|
||||
[node name="Size" type="Control" parent="." unique_id=1792197698]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_left = -55.0
|
||||
offset_top = -55.0
|
||||
offset_right = 55.0
|
||||
offset_bottom = 55.0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="BombSprite" type="Sprite2D" parent="." unique_id=654703245]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
|
||||
[connection signal="tree_entered" from="." to="." method="_on_tree_entered"]
|
||||
[connection signal="area_entered" from="BuildingArea" to="." method="_on_building_area_entered"]
|
||||
@ -40,6 +40,6 @@ func get_direction_queue(_citizen: Citizen) -> Array[Board.Direction]:
|
||||
|
||||
|
||||
func activate(citizen: Citizen) -> void:
|
||||
citizen.money += 2 ** citizen.get_status_count(Citizen.Status.CAFFEINATED) + 1
|
||||
citizen.money += 1 * (citizen.get_status_count(Citizen.Status.CAFFEINATED) + 1)
|
||||
citizen.remove_all_statuses(Citizen.Status.CAFFEINATED)
|
||||
citizen.play_money_animation()
|
||||
|
||||
@ -2,10 +2,6 @@
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://t8n660a0vqvm" path="res://assets/Pixelart arrow icon pack 1.0.png" id="1_fupku"]
|
||||
[ext_resource type="Script" uid="uid://bgw6vkq71d14n" path="res://prefabs/tiles/buildings/office.gd" id="1_wwwaf"]
|
||||
[ext_resource type="Texture2D" uid="uid://dijho2wx1l4sm" path="res://assets/bomb/bomb.png" id="3_jfbo3"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_wwwaf"]
|
||||
colors = PackedColorArray(0, 1, 0, 1, 1, 0, 0, 1)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_vwg8v"]
|
||||
outline_size = 4
|
||||
@ -62,29 +58,6 @@ offset_bottom = 55.0
|
||||
mouse_filter = 2
|
||||
color = Color(0, 0, 1, 1)
|
||||
|
||||
[node name="Edge1" type="Line2D" parent="." unique_id=1683209880]
|
||||
points = PackedVector2Array(55, -55, 55, 55)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Edge3" type="Line2D" parent="." unique_id=1674138530]
|
||||
points = PackedVector2Array(55, -55, 165, -55)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Edge2" type="Line2D" parent="." unique_id=1448230976]
|
||||
points = PackedVector2Array(165, -55, 165, 55)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Path1" type="Line2D" parent="." unique_id=251146500]
|
||||
points = PackedVector2Array(0, -45, 0, 0, 100, 0, 100, -110, 120, -110, 120, 0, 220, 0, 220, -45)
|
||||
width = 2.0
|
||||
gradient = SubResource("Gradient_wwwaf")
|
||||
joint_mode = 2
|
||||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="." unique_id=29286194]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
offset_left = 55.0
|
||||
@ -162,13 +135,6 @@ offset_right = 275.0
|
||||
offset_bottom = 55.0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="BombSprite" type="Sprite2D" parent="." unique_id=325213782]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
position = Vector2(110, 0)
|
||||
scale = Vector2(0.415, 0.415)
|
||||
texture = ExtResource("3_jfbo3")
|
||||
|
||||
[connection signal="area_entered" from="Square1" to="." method="_on_building_area_entered"]
|
||||
[connection signal="area_entered" from="Square2" to="." method="_on_building_area_entered"]
|
||||
[connection signal="area_entered" from="Square3" to="." method="_on_building_area_entered"]
|
||||
|
||||
@ -1,31 +0,0 @@
|
||||
class_name PostOffice extends Building
|
||||
|
||||
@onready var preview_node: Node2D = %Preview
|
||||
@onready var board_node: Node2D = %Board
|
||||
|
||||
|
||||
func place() -> void:
|
||||
preview_node.hide()
|
||||
board_node.show()
|
||||
|
||||
|
||||
func can_citizen_enter(_coord: Vector2i, _direction: Board.Direction) -> bool:
|
||||
return true
|
||||
|
||||
|
||||
func get_tile_coords() -> Array[Vector2i]:
|
||||
return [starting_coord]
|
||||
|
||||
|
||||
func get_direction_queue(_citizen: Citizen) -> Array[Board.Direction]:
|
||||
return []
|
||||
|
||||
|
||||
func activate(citizen: Citizen) -> void:
|
||||
if citizen.get_status_count(Citizen.Status.PACKAGED) > 0:
|
||||
citizen.remove_all_statuses(Citizen.Status.PACKAGED)
|
||||
citizen.money += ceili(citizen.package_distance / 2.0)
|
||||
citizen.play_money_animation()
|
||||
citizen.package_distance = 0
|
||||
else:
|
||||
citizen.add_status(Citizen.Status.PACKAGED)
|
||||
@ -1 +0,0 @@
|
||||
uid://bgde73oxvye5t
|
||||
@ -1,119 +0,0 @@
|
||||
[gd_scene format=3 uid="uid://bpi8owv5lxyjy"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bgde73oxvye5t" path="res://prefabs/tiles/buildings/post_office.gd" id="1_0ascf"]
|
||||
[ext_resource type="Texture2D" uid="uid://dijho2wx1l4sm" path="res://assets/bomb/bomb.png" id="3_vwkts"]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_vwg8v"]
|
||||
outline_size = 4
|
||||
outline_color = Color(0, 0, 0, 1)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vwg8v"]
|
||||
size = Vector2(109, 109)
|
||||
|
||||
[node name="PostOffice" type="Node2D" unique_id=746270571]
|
||||
process_mode = 3
|
||||
script = ExtResource("1_0ascf")
|
||||
|
||||
[node name="Preview" type="Node2D" parent="." unique_id=515630033]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[node name="Outline" type="ColorRect" parent="Preview" unique_id=889061850]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
offset_left = -82.5
|
||||
offset_top = -28.0
|
||||
offset_right = 27.5
|
||||
offset_bottom = 82.0
|
||||
mouse_filter = 2
|
||||
color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="Preview/Outline" unique_id=803405966]
|
||||
custom_minimum_size = Vector2(108, 108)
|
||||
layout_mode = 0
|
||||
offset_left = 1.0
|
||||
offset_top = 1.0
|
||||
offset_right = 109.0
|
||||
offset_bottom = 109.0
|
||||
mouse_filter = 2
|
||||
color = Color(0, 0.71932274, 0.79595864, 1)
|
||||
|
||||
[node name="Outline2" type="ColorRect" parent="Preview" unique_id=1396499698]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
offset_left = -28.0
|
||||
offset_top = -82.0
|
||||
offset_right = 82.0
|
||||
offset_bottom = 28.0
|
||||
mouse_filter = 2
|
||||
color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="Preview/Outline2" unique_id=167610173]
|
||||
custom_minimum_size = Vector2(108, 108)
|
||||
layout_mode = 0
|
||||
offset_left = 1.0
|
||||
offset_top = 1.0
|
||||
offset_right = 109.0
|
||||
offset_bottom = 109.0
|
||||
mouse_filter = 2
|
||||
color = Color(0, 0.71932274, 0.79595864, 1)
|
||||
|
||||
[node name="Size" type="Control" parent="Preview" unique_id=1036213581]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_left = -82.5
|
||||
offset_top = -82.5
|
||||
offset_right = 82.5
|
||||
offset_bottom = 82.5
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="Label" type="Label" parent="Preview" unique_id=29286194]
|
||||
custom_minimum_size = Vector2(165, 165)
|
||||
offset_left = -82.5
|
||||
offset_top = -82.5
|
||||
offset_right = 82.5
|
||||
offset_bottom = 82.5
|
||||
text = "POST
|
||||
OFFICE"
|
||||
label_settings = SubResource("LabelSettings_vwg8v")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Board" type="Node2D" parent="." unique_id=1675613235]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
|
||||
[node name="Outline" type="ColorRect" parent="Board" unique_id=1599746913]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
offset_left = -55.0
|
||||
offset_top = -55.0
|
||||
offset_right = 55.0
|
||||
offset_bottom = 55.0
|
||||
mouse_filter = 2
|
||||
color = Color(0, 0.7176471, 0.79607844, 1)
|
||||
|
||||
[node name="Label2" type="Label" parent="Board" unique_id=1535058806]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
offset_left = -55.0
|
||||
offset_top = -55.0
|
||||
offset_right = 55.0
|
||||
offset_bottom = 55.0
|
||||
text = "POST
|
||||
OFFICE"
|
||||
label_settings = SubResource("LabelSettings_vwg8v")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Square1" type="Area2D" parent="Board" unique_id=333775731]
|
||||
process_mode = 3
|
||||
monitoring = false
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Board/Square1" unique_id=1122204523]
|
||||
process_mode = 3
|
||||
shape = SubResource("RectangleShape2D_vwg8v")
|
||||
|
||||
[node name="BombSprite" type="Sprite2D" parent="Board" unique_id=2024150262]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
scale = Vector2(0.415, 0.415)
|
||||
texture = ExtResource("3_vwkts")
|
||||
|
||||
[connection signal="area_entered" from="Board/Square1" to="." method="_on_building_area_entered"]
|
||||
@ -74,10 +74,5 @@ func handle_post_turn_actions() -> void:
|
||||
money = money % 15
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_set_money_label()
|
||||
|
||||
|
||||
func _set_money_label() -> void:
|
||||
if is_node_ready():
|
||||
money_label.text = "$%d / $15" % money
|
||||
|
||||
@ -2,10 +2,6 @@
|
||||
|
||||
[ext_resource type="Script" uid="uid://jp4x1q01no6l" path="res://prefabs/tiles/buildings/shop.gd" id="1_cugdd"]
|
||||
[ext_resource type="Texture2D" uid="uid://t8n660a0vqvm" path="res://assets/Pixelart arrow icon pack 1.0.png" id="2_6buuw"]
|
||||
[ext_resource type="Texture2D" uid="uid://dijho2wx1l4sm" path="res://assets/bomb/bomb.png" id="3_6buuw"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_cugdd"]
|
||||
colors = PackedColorArray(0, 1, 0, 1, 1, 0, 0, 1)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_vwg8v"]
|
||||
outline_size = 4
|
||||
@ -53,32 +49,6 @@ offset_bottom = -55.0
|
||||
mouse_filter = 2
|
||||
color = Color(1, 1, 0, 1)
|
||||
|
||||
[node name="Edge1" type="Line2D" parent="." unique_id=1892520188]
|
||||
points = PackedVector2Array(-55, -55, 55, -55)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Edge2" type="Line2D" parent="." unique_id=385177492]
|
||||
points = PackedVector2Array(55, -165, 55, -55)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Path1" type="Line2D" parent="." unique_id=1796228130]
|
||||
points = PackedVector2Array(-10, 45, -10, -120, 155, -120)
|
||||
width = 2.0
|
||||
gradient = SubResource("Gradient_cugdd")
|
||||
joint_mode = 2
|
||||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
|
||||
[node name="Path2" type="Line2D" parent="." unique_id=8496436]
|
||||
points = PackedVector2Array(155, -100, 10, -100, 10, 45)
|
||||
width = 2.0
|
||||
gradient = SubResource("Gradient_cugdd")
|
||||
joint_mode = 2
|
||||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="." unique_id=29286194]
|
||||
custom_minimum_size = Vector2(110, 55)
|
||||
offset_left = -55.0
|
||||
@ -171,13 +141,6 @@ offset_right = 205.0
|
||||
offset_bottom = 95.0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="BombSprite" type="Sprite2D" parent="." unique_id=275916931]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
position = Vector2(0, -110)
|
||||
scale = Vector2(0.415, 0.415)
|
||||
texture = ExtResource("3_6buuw")
|
||||
|
||||
[connection signal="area_entered" from="Square1" to="." method="_on_building_area_entered"]
|
||||
[connection signal="area_entered" from="Square2" to="." method="_on_building_area_entered"]
|
||||
[connection signal="area_entered" from="Square3" to="." method="_on_building_area_entered"]
|
||||
|
||||
@ -1,32 +0,0 @@
|
||||
class_name SoupKitchen extends Building
|
||||
|
||||
var citizens_served: Array[Citizen] = []
|
||||
|
||||
|
||||
func activate(citizen: Citizen) -> void:
|
||||
if !citizens_served.has(citizen):
|
||||
citizen.money += 1
|
||||
citizens_served.append(citizen)
|
||||
citizen.play_money_animation()
|
||||
|
||||
|
||||
func handle_post_turn_actions() -> void:
|
||||
citizens_served.clear()
|
||||
|
||||
|
||||
func can_citizen_enter(_coord: Vector2i, _direction: Board.Direction) -> bool:
|
||||
return false
|
||||
|
||||
|
||||
func get_direction_queue(_citizen: Citizen) -> Array[Board.Direction]:
|
||||
return []
|
||||
|
||||
|
||||
func get_tile_coords() -> Array[Vector2i]:
|
||||
return [
|
||||
starting_coord,
|
||||
starting_coord + Vector2i.UP,
|
||||
starting_coord + Vector2i.RIGHT,
|
||||
starting_coord + Vector2i.DOWN,
|
||||
starting_coord + Vector2i.LEFT
|
||||
]
|
||||
@ -1 +0,0 @@
|
||||
uid://dnvub78p70s5j
|
||||
@ -1,158 +0,0 @@
|
||||
[gd_scene format=3 uid="uid://dmfnipmjntenc"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dnvub78p70s5j" path="res://prefabs/tiles/buildings/soup_kitchen.gd" id="1_sj7qw"]
|
||||
[ext_resource type="Texture2D" uid="uid://dijho2wx1l4sm" path="res://assets/bomb/bomb.png" id="2_33ap7"]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_vwg8v"]
|
||||
outline_size = 4
|
||||
outline_color = Color(0, 0, 0, 1)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vwg8v"]
|
||||
size = Vector2(109, 109)
|
||||
|
||||
[node name="SoupKitchen" type="Node2D" unique_id=746270571 groups=["PostTurnActions"]]
|
||||
process_mode = 3
|
||||
script = ExtResource("1_sj7qw")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="." unique_id=889061850]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
offset_left = -55.0
|
||||
offset_top = -55.0
|
||||
offset_right = 55.0
|
||||
offset_bottom = 55.0
|
||||
mouse_filter = 2
|
||||
color = Color(0.6253981, 0.68505514, 0.24526232, 1)
|
||||
|
||||
[node name="ColorRect2" type="ColorRect" parent="." unique_id=76291108]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
offset_left = -165.0
|
||||
offset_top = -55.0
|
||||
offset_right = -55.0
|
||||
offset_bottom = 55.0
|
||||
mouse_filter = 2
|
||||
color = Color(0.6253981, 0.68505514, 0.24526232, 1)
|
||||
|
||||
[node name="ColorRect3" type="ColorRect" parent="." unique_id=786140755]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
offset_left = -55.0
|
||||
offset_top = -165.0
|
||||
offset_right = 55.0
|
||||
offset_bottom = -55.0
|
||||
mouse_filter = 2
|
||||
color = Color(0.6253981, 0.68505514, 0.24526232, 1)
|
||||
|
||||
[node name="ColorRect4" type="ColorRect" parent="." unique_id=557224551]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
offset_left = 55.0
|
||||
offset_top = -55.0
|
||||
offset_right = 165.0
|
||||
offset_bottom = 55.0
|
||||
mouse_filter = 2
|
||||
color = Color(0.6253981, 0.68505514, 0.24526232, 1)
|
||||
|
||||
[node name="ColorRect5" type="ColorRect" parent="." unique_id=1896618491]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
offset_left = -55.0
|
||||
offset_top = 55.0
|
||||
offset_right = 55.0
|
||||
offset_bottom = 165.0
|
||||
mouse_filter = 2
|
||||
color = Color(0.6253981, 0.68505514, 0.24526232, 1)
|
||||
|
||||
[node name="Edge1" type="Line2D" parent="." unique_id=729686179]
|
||||
points = PackedVector2Array(-55, -55, 55, -55)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Edge3" type="Line2D" parent="." unique_id=517881771]
|
||||
points = PackedVector2Array(-55, -55, -55, 55)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Edge4" type="Line2D" parent="." unique_id=1010396228]
|
||||
points = PackedVector2Array(55, -55, 55, 55)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Edge2" type="Line2D" parent="." unique_id=462983650]
|
||||
points = PackedVector2Array(-55, 55, 55, 55)
|
||||
width = 1.0
|
||||
default_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Label" type="Label" parent="." unique_id=29286194]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
offset_left = -55.0
|
||||
offset_top = -55.0
|
||||
offset_right = 55.0
|
||||
offset_bottom = 55.0
|
||||
text = "SOUP
|
||||
KITCHEN"
|
||||
label_settings = SubResource("LabelSettings_vwg8v")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Square1" type="Area2D" parent="." unique_id=333775731]
|
||||
process_mode = 3
|
||||
monitoring = false
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square1" unique_id=1122204523]
|
||||
process_mode = 3
|
||||
shape = SubResource("RectangleShape2D_vwg8v")
|
||||
|
||||
[node name="Square2" type="Area2D" parent="." unique_id=871528471]
|
||||
process_mode = 3
|
||||
position = Vector2(-110, 0)
|
||||
monitoring = false
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square2" unique_id=1328243658]
|
||||
process_mode = 3
|
||||
shape = SubResource("RectangleShape2D_vwg8v")
|
||||
|
||||
[node name="Square3" type="Area2D" parent="." unique_id=1642876812]
|
||||
process_mode = 3
|
||||
position = Vector2(0, -110)
|
||||
monitoring = false
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square3" unique_id=1392094497]
|
||||
process_mode = 3
|
||||
shape = SubResource("RectangleShape2D_vwg8v")
|
||||
|
||||
[node name="Square4" type="Area2D" parent="." unique_id=2108585971]
|
||||
process_mode = 3
|
||||
position = Vector2(110, 0)
|
||||
monitoring = false
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square4" unique_id=11446925]
|
||||
process_mode = 3
|
||||
shape = SubResource("RectangleShape2D_vwg8v")
|
||||
|
||||
[node name="Square5" type="Area2D" parent="." unique_id=304733612]
|
||||
process_mode = 3
|
||||
position = Vector2(0, 110)
|
||||
monitoring = false
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square5" unique_id=676150133]
|
||||
process_mode = 3
|
||||
shape = SubResource("RectangleShape2D_vwg8v")
|
||||
|
||||
[node name="Size" type="Control" parent="." unique_id=1036213581]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_left = -165.0
|
||||
offset_top = -165.0
|
||||
offset_right = 165.0
|
||||
offset_bottom = 165.0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="BombSprite" type="Sprite2D" parent="." unique_id=794532636]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
scale = Vector2(0.415, 0.415)
|
||||
texture = ExtResource("2_33ap7")
|
||||
|
||||
[connection signal="area_entered" from="Square1" to="." method="_on_building_area_entered"]
|
||||
[connection signal="area_entered" from="Square2" to="." method="_on_building_area_entered"]
|
||||
[connection signal="area_entered" from="Square3" to="." method="_on_building_area_entered"]
|
||||
[connection signal="area_entered" from="Square4" to="." method="_on_building_area_entered"]
|
||||
[connection signal="area_entered" from="Square5" to="." method="_on_building_area_entered"]
|
||||
@ -1,4 +1,4 @@
|
||||
class_name Spawn extends Building
|
||||
class_name Spawn extends Tile
|
||||
|
||||
enum Size { SMALL, MEDIUM, LARGE }
|
||||
|
||||
@ -50,19 +50,3 @@ func _physics_process(delta: float) -> void:
|
||||
citizen.set_offset(Vector2(randf_range(-40, 40), randf_range(-40, 40)))
|
||||
citizen.direction = direction
|
||||
citizen.handle_tile_area_exited(null)
|
||||
|
||||
|
||||
func activate(_citizen: Citizen) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func can_citizen_enter(_coord: Vector2i, _direction: Board.Direction) -> bool:
|
||||
return true
|
||||
|
||||
|
||||
func get_direction_queue(_citizen: Citizen) -> Array[Board.Direction]:
|
||||
return []
|
||||
|
||||
|
||||
func get_tile_coords() -> Array[Vector2i]:
|
||||
return [starting_coord]
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://t8n660a0vqvm" path="res://assets/Pixelart arrow icon pack 1.0.png" id="2_26feb"]
|
||||
[ext_resource type="Script" uid="uid://cp87ydrew7phy" path="res://prefabs/tiles/spawns/spawn.gd" id="2_c3hvl"]
|
||||
[ext_resource type="Texture2D" uid="uid://dijho2wx1l4sm" path="res://assets/bomb/bomb.png" id="3_rjtpm"]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_26feb"]
|
||||
font_size = 24
|
||||
@ -82,19 +81,3 @@ collision_mask = 0
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D" unique_id=2097036302]
|
||||
shape = SubResource("RectangleShape2D_bs4fa")
|
||||
|
||||
[node name="Size" type="Control" parent="." unique_id=1199044498]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_left = -55.0
|
||||
offset_top = -55.0
|
||||
offset_right = 55.0
|
||||
offset_bottom = 55.0
|
||||
|
||||
[node name="BombSprite" type="Sprite2D" parent="." unique_id=231655141]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
scale = Vector2(0.415, 0.415)
|
||||
texture = ExtResource("3_rjtpm")
|
||||
|
||||
@ -5,9 +5,6 @@ signal tile_selected(tile: Tile)
|
||||
|
||||
@export var coords: Vector2i
|
||||
@export var cost: int = 0
|
||||
@export var day_placed: int = 0
|
||||
@export var player: Player:
|
||||
set = _set_player
|
||||
|
||||
var highlighted: bool = false
|
||||
var is_placing: bool = false
|
||||
@ -21,18 +18,11 @@ func handle_mouse_exited() -> void:
|
||||
highlighted = false
|
||||
|
||||
|
||||
func _set_player(value: Player) -> void:
|
||||
player = value
|
||||
|
||||
|
||||
func serialize() -> Dictionary:
|
||||
var result = {}
|
||||
result["scene_file_path"] = scene_file_path
|
||||
result["coords"] = coords
|
||||
result["cost"] = cost
|
||||
result["day_placed"] = day_placed
|
||||
if player != null:
|
||||
result["player"] = player.serialize()
|
||||
return result
|
||||
|
||||
|
||||
@ -40,7 +30,4 @@ static func deserialize(data: Dictionary) -> Tile:
|
||||
var tile: Tile = load(data["scene_file_path"]).instantiate()
|
||||
tile.coords = data["coords"]
|
||||
tile.cost = data["cost"]
|
||||
tile.day_placed = data["day_placed"]
|
||||
if data.get("player") != null:
|
||||
tile.player = Player.deserialize(data["player"])
|
||||
return tile
|
||||
|
||||
@ -23,17 +23,8 @@ expand_margin_bottom = 8.0
|
||||
[node name="DownTurn" unique_id=1363157270 instance=ExtResource("1_xxpct")]
|
||||
direction = 2
|
||||
|
||||
[node name="Icon" parent="PlayerBorder" parent_id_path=PackedInt32Array(1009643853) index="0" unique_id=1363157270]
|
||||
[node name="Icon" parent="." index="0" unique_id=1363157270]
|
||||
texture = SubResource("AtlasTexture_s65nw")
|
||||
|
||||
[node name="Icon#Highlight" type="Panel" parent="PlayerBorder/Icon" index="0" unique_id=715172504]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
[node name="Highlight" parent="Icon" index="0" unique_id=715172504]
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_xxpct")
|
||||
|
||||
@ -1,12 +1,10 @@
|
||||
[gd_scene format=3 uid="uid://7jht5hlggey1"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cdb6bf7dat3bw" path="res://prefabs/tiles/turns/turn.tscn" id="1_exig8"]
|
||||
|
||||
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_exig8"]
|
||||
load_path = "res://.godot/imported/Points-and-Pulses.png-edf75043efa977f8c5e27105136679fb.ctex"
|
||||
[ext_resource type="Texture2D" uid="uid://8b86ftb4iwfj" path="res://assets/Pattern-Panic-10x10/no-background/Points-and-Pulses.png" id="2_4tde2"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_4tde2"]
|
||||
atlas = SubResource("CompressedTexture2D_exig8")
|
||||
atlas = ExtResource("2_4tde2")
|
||||
region = Rect2(1, 1, 9, 9)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_41d4x"]
|
||||
@ -25,18 +23,9 @@ expand_margin_bottom = 8.0
|
||||
[node name="LeftTurn" unique_id=1363157270 instance=ExtResource("1_exig8")]
|
||||
direction = 3
|
||||
|
||||
[node name="Icon" parent="PlayerBorder" parent_id_path=PackedInt32Array(1009643853) index="0" unique_id=1363157270]
|
||||
[node name="Icon" parent="." index="0" unique_id=1363157270]
|
||||
texture = SubResource("AtlasTexture_4tde2")
|
||||
flip_h = true
|
||||
|
||||
[node name="Icon#Highlight" type="Panel" parent="PlayerBorder/Icon" index="0" unique_id=715172504]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
[node name="Highlight" parent="Icon" index="0" unique_id=715172504]
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_41d4x")
|
||||
|
||||
@ -1,12 +1,10 @@
|
||||
[gd_scene format=3 uid="uid://ce25rk1nl0pqn"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cdb6bf7dat3bw" path="res://prefabs/tiles/turns/turn.tscn" id="1_2yiqp"]
|
||||
|
||||
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_2yiqp"]
|
||||
load_path = "res://.godot/imported/Points-and-Pulses.png-edf75043efa977f8c5e27105136679fb.ctex"
|
||||
[ext_resource type="Texture2D" uid="uid://8b86ftb4iwfj" path="res://assets/Pattern-Panic-10x10/no-background/Points-and-Pulses.png" id="2_3t120"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3t120"]
|
||||
atlas = SubResource("CompressedTexture2D_2yiqp")
|
||||
atlas = ExtResource("2_3t120")
|
||||
region = Rect2(1, 1, 9, 9)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_dlxmt"]
|
||||
@ -22,36 +20,11 @@ expand_margin_top = 8.0
|
||||
expand_margin_right = 8.0
|
||||
expand_margin_bottom = 8.0
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_2yiqp"]
|
||||
resource_local_to_scene = true
|
||||
bg_color = Color(1, 1, 1, 0)
|
||||
border_width_left = 5
|
||||
border_width_top = 5
|
||||
border_width_right = 5
|
||||
border_width_bottom = 5
|
||||
border_color = Color(1, 1, 1, 1)
|
||||
expand_margin_left = 8.0
|
||||
expand_margin_top = 8.0
|
||||
expand_margin_right = 8.0
|
||||
expand_margin_bottom = 8.0
|
||||
|
||||
[node name="RightTurn" unique_id=1363157270 instance=ExtResource("1_2yiqp")]
|
||||
direction = 4
|
||||
|
||||
[node name="Icon" parent="PlayerBorder" parent_id_path=PackedInt32Array(1009643853) index="0" unique_id=1363157270]
|
||||
[node name="Icon" parent="." index="0" unique_id=1363157270]
|
||||
texture = SubResource("AtlasTexture_3t120")
|
||||
|
||||
[node name="Icon#Highlight" type="Panel" parent="PlayerBorder/Icon" index="0" unique_id=715172504]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
[node name="Highlight" parent="Icon" index="0" unique_id=715172504]
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_dlxmt")
|
||||
|
||||
[node name="Highlight" parent="PlayerBorder/Icon" index="1" unique_id=715172504]
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_2yiqp")
|
||||
|
||||
@ -3,11 +3,6 @@ class_name Turn extends Tile
|
||||
@export var direction: Board.Direction
|
||||
|
||||
@onready var highlight: Panel = %Highlight
|
||||
@onready var player_border: PanelContainer = %PlayerBorder
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_set_border_color()
|
||||
|
||||
|
||||
func handle_turn_mouse_entered() -> void:
|
||||
@ -21,15 +16,3 @@ func handle_turn_mouse_exited() -> void:
|
||||
func handle_gui_input(event: InputEvent):
|
||||
if event.is_action_pressed("select") and !is_placing:
|
||||
tile_selected.emit(self)
|
||||
|
||||
|
||||
func _set_player(value: Player) -> void:
|
||||
super(value)
|
||||
_set_border_color()
|
||||
|
||||
|
||||
func _set_border_color() -> void:
|
||||
if !is_node_ready() or player == null:
|
||||
return
|
||||
var style_box: StyleBoxFlat = player_border.get_theme_stylebox("panel")
|
||||
style_box.border_color = player.color
|
||||
|
||||
@ -3,15 +3,6 @@
|
||||
[ext_resource type="Texture2D" uid="uid://8b86ftb4iwfj" path="res://assets/Pattern-Panic-10x10/no-background/Points-and-Pulses.png" id="1_qqie6"]
|
||||
[ext_resource type="Script" uid="uid://df5v873offcdf" path="res://prefabs/tiles/turns/turn.gd" id="2_qqie6"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ix7w3"]
|
||||
resource_local_to_scene = true
|
||||
bg_color = Color(0, 0, 0, 0)
|
||||
border_width_left = 5
|
||||
border_width_top = 5
|
||||
border_width_right = 5
|
||||
border_width_bottom = 5
|
||||
border_color = Color(0.8001019, 0.8001019, 0.8001019, 0)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_x2hlk"]
|
||||
atlas = ExtResource("1_qqie6")
|
||||
region = Rect2(30, 70, 10, 10)
|
||||
@ -35,22 +26,16 @@ size = Vector2(110, 110)
|
||||
[node name="Turn" type="Node2D" unique_id=397844073]
|
||||
script = ExtResource("2_qqie6")
|
||||
|
||||
[node name="PlayerBorder" type="PanelContainer" parent="." unique_id=1009643853]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
offset_left = -55.0
|
||||
offset_top = -55.0
|
||||
offset_right = 45.0
|
||||
offset_bottom = 45.0
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_ix7w3")
|
||||
|
||||
[node name="Icon" type="TextureRect" parent="PlayerBorder" unique_id=1363157270]
|
||||
[node name="Icon" type="TextureRect" parent="." unique_id=1363157270]
|
||||
texture_filter = 1
|
||||
custom_minimum_size = Vector2(100, 100)
|
||||
layout_mode = 2
|
||||
offset_left = -50.0
|
||||
offset_top = -50.0
|
||||
offset_right = 50.0
|
||||
offset_bottom = 50.0
|
||||
texture = SubResource("AtlasTexture_x2hlk")
|
||||
|
||||
[node name="Highlight" type="Panel" parent="PlayerBorder/Icon" unique_id=715172504]
|
||||
[node name="Highlight" type="Panel" parent="Icon" unique_id=715172504]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
@ -69,6 +54,6 @@ collision_mask = 0
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D2" unique_id=1032001784]
|
||||
shape = SubResource("RectangleShape2D_qqie6")
|
||||
|
||||
[connection signal="gui_input" from="PlayerBorder/Icon" to="." method="handle_gui_input"]
|
||||
[connection signal="mouse_entered" from="PlayerBorder/Icon" to="." method="handle_turn_mouse_entered"]
|
||||
[connection signal="mouse_exited" from="PlayerBorder/Icon" to="." method="handle_turn_mouse_exited"]
|
||||
[connection signal="gui_input" from="Icon" to="." method="handle_gui_input"]
|
||||
[connection signal="mouse_entered" from="Icon" to="." method="handle_turn_mouse_entered"]
|
||||
[connection signal="mouse_exited" from="Icon" to="." method="handle_turn_mouse_exited"]
|
||||
|
||||
@ -1,12 +1,10 @@
|
||||
[gd_scene format=3 uid="uid://cisd4grq8kxqn"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cdb6bf7dat3bw" path="res://prefabs/tiles/turns/turn.tscn" id="1_3bmx7"]
|
||||
|
||||
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_2w6nq"]
|
||||
load_path = "res://.godot/imported/Points-and-Pulses.png-edf75043efa977f8c5e27105136679fb.ctex"
|
||||
[ext_resource type="Texture2D" uid="uid://8b86ftb4iwfj" path="res://assets/Pattern-Panic-10x10/no-background/Points-and-Pulses.png" id="2_3ect2"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3bmx7"]
|
||||
atlas = SubResource("CompressedTexture2D_2w6nq")
|
||||
atlas = ExtResource("2_3ect2")
|
||||
region = Rect2(0, 11, 9, 9)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_3ect2"]
|
||||
@ -25,18 +23,9 @@ expand_margin_bottom = 8.0
|
||||
[node name="UpTurn" unique_id=1363157270 instance=ExtResource("1_3bmx7")]
|
||||
direction = 1
|
||||
|
||||
[node name="Icon" parent="PlayerBorder" parent_id_path=PackedInt32Array(1009643853) index="0" unique_id=1363157270]
|
||||
[node name="Icon" parent="." index="0" unique_id=1363157270]
|
||||
texture = SubResource("AtlasTexture_3bmx7")
|
||||
flip_v = true
|
||||
|
||||
[node name="Icon#Highlight" type="Panel" parent="PlayerBorder/Icon" index="0" unique_id=715172504]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
[node name="Highlight" parent="Icon" index="0" unique_id=715172504]
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_3ect2")
|
||||
|
||||
@ -33,5 +33,5 @@ func _on_child_entered_tree(node: Node) -> void:
|
||||
await node.ready
|
||||
if is_instance_valid(node.size_node):
|
||||
custom_minimum_size = node.size_node.size + Vector2(10, 10)
|
||||
node.position = -node.size_node.position
|
||||
node.position = position - node.size_node.position
|
||||
node.position += Vector2(5, 5)
|
||||
|
||||
@ -58,9 +58,6 @@ func set_info() -> void:
|
||||
|
||||
|
||||
func check_controls_enabled() -> void:
|
||||
#print(Globals.board_game.current_board_state.current_player.id == Globals.game.this_player.id)
|
||||
#print(Globals.board_game.current_board_state.state != BoardState.State.PLAY)
|
||||
#print(Globals.board_game.pending_board_state != null)
|
||||
if Globals.board_game.current_board_state.current_player.id == Globals.game.this_player.id:
|
||||
if Globals.board_game.current_board_state.state != BoardState.State.PLAY:
|
||||
pass_button.hide()
|
||||
@ -78,7 +75,7 @@ func check_controls_enabled() -> void:
|
||||
pass_button.show()
|
||||
submit_button.hide()
|
||||
submit_button.disabled = true
|
||||
pass_button.disabled = Globals.board_game.is_playing_day
|
||||
pass_button.disabled = false
|
||||
undo_button.disabled = true
|
||||
rem_button.disabled = false
|
||||
else:
|
||||
@ -89,19 +86,6 @@ func check_controls_enabled() -> void:
|
||||
undo_button.disabled = true
|
||||
submit_button.disabled = true
|
||||
|
||||
# TODO: Fix undo
|
||||
# undo_button.disabled = true
|
||||
|
||||
|
||||
func set_board_state(board_state: BoardState) -> void:
|
||||
for child in draft_container.get_children():
|
||||
child.queue_free()
|
||||
for building in board_state.real_estate_market:
|
||||
var db: DraftBuilding = DRAFT_BUILDING_SCENE.instantiate()
|
||||
draft_container.add_child(db)
|
||||
db.set_building(building.duplicate())
|
||||
db.building_selector.select_building.connect(handle_building_selected)
|
||||
|
||||
|
||||
func end_day() -> void:
|
||||
undo_button.hide()
|
||||
@ -121,7 +105,7 @@ func _on_submit_pressed():
|
||||
|
||||
|
||||
func _on_undo_pressed():
|
||||
Globals.board_game.reset_turn()
|
||||
print("TODO: Handle undo!")
|
||||
|
||||
|
||||
func _on_pause_pressed():
|
||||
@ -141,26 +125,16 @@ func _on_blueprints_pressed():
|
||||
|
||||
|
||||
func handle_tile_selected(tile: Tile):
|
||||
if (
|
||||
tile.cost <= Globals.board_game.current_board_state.current_player.money
|
||||
and (
|
||||
Globals.board_game.current_board_state.current_player.build_actions_taken
|
||||
< Globals.board_game.current_board_state.current_player.building_permits
|
||||
)
|
||||
):
|
||||
_hide_real_estate_market()
|
||||
Globals.board_game.select_tile(tile)
|
||||
|
||||
|
||||
func handle_building_selected(building: Building) -> void:
|
||||
if (
|
||||
building.cost <= Globals.board_game.current_board_state.current_player.money
|
||||
and (
|
||||
Globals.board_game.current_board_state.current_player.build_actions_taken
|
||||
< Globals.board_game.current_board_state.current_player.building_permits
|
||||
)
|
||||
):
|
||||
_hide_real_estate_market()
|
||||
var db = building.get_parent().get_parent()
|
||||
if db is DraftBuilding:
|
||||
Globals.board_game.select_building(building, db.get_index())
|
||||
else:
|
||||
Globals.board_game.select_building(building)
|
||||
|
||||
|
||||
@ -213,8 +187,16 @@ func _show_hand() -> void:
|
||||
hand_tween.tween_property(hand, "offset_top", -hand.size.y, 0.5)
|
||||
|
||||
|
||||
func _speed_up_engine(speed: float) -> void:
|
||||
if is_instance_valid(es_tween):
|
||||
es_tween.kill()
|
||||
es_tween = create_tween()
|
||||
es_tween.set_ignore_time_scale(true)
|
||||
es_tween.tween_property(Engine, "time_scale", speed, 0.5)
|
||||
|
||||
|
||||
func _on_fast_forward_1_pressed():
|
||||
Engine.time_scale = 2
|
||||
_speed_up_engine(2)
|
||||
fast_1.hide()
|
||||
fast_2.show()
|
||||
fast_4.hide()
|
||||
@ -222,7 +204,7 @@ func _on_fast_forward_1_pressed():
|
||||
|
||||
|
||||
func _on_fast_forward_2_pressed():
|
||||
Engine.time_scale = 4
|
||||
_speed_up_engine(4)
|
||||
fast_1.hide()
|
||||
fast_2.hide()
|
||||
fast_4.show()
|
||||
@ -230,7 +212,7 @@ func _on_fast_forward_2_pressed():
|
||||
|
||||
|
||||
func _on_fast_forward_4_pressed():
|
||||
Engine.time_scale = 10
|
||||
_speed_up_engine(10)
|
||||
fast_1.hide()
|
||||
fast_2.hide()
|
||||
fast_4.hide()
|
||||
@ -238,7 +220,7 @@ func _on_fast_forward_4_pressed():
|
||||
|
||||
|
||||
func _on_fast_forward_10_pressed():
|
||||
Engine.time_scale = 1
|
||||
_speed_up_engine(1)
|
||||
fast_1.show()
|
||||
fast_2.hide()
|
||||
fast_4.hide()
|
||||
@ -246,7 +228,6 @@ func _on_fast_forward_10_pressed():
|
||||
|
||||
|
||||
func _on_cancel_placement_pressed():
|
||||
Globals.board_game.cancel_placement()
|
||||
_hide_real_estate_market()
|
||||
|
||||
|
||||
@ -258,13 +239,23 @@ func _on_hand_building_selected(building: Building) -> void:
|
||||
draft_cost_container.show()
|
||||
|
||||
|
||||
@rpc("any_peer", "call_local", "reliable")
|
||||
func add_to_draft(building_data: Dictionary) -> void:
|
||||
Globals.board_game.add_building_to_draft.rpc()
|
||||
var db: DraftBuilding = DRAFT_BUILDING_SCENE.instantiate()
|
||||
draft_container.add_child(db)
|
||||
draft_building = Building.deserialize(building_data)
|
||||
db.set_building(draft_building)
|
||||
db.building_selector.select_building.connect(handle_building_selected)
|
||||
|
||||
|
||||
@rpc("any_peer", "call_local", "reliable")
|
||||
func remove_from_draft(draft_building_index: int) -> void:
|
||||
draft_container.get_child(draft_building_index).queue_free()
|
||||
|
||||
|
||||
func _on_set_draft_cost_pressed():
|
||||
_hide_hand()
|
||||
draft_cost_container.hide()
|
||||
draft_building.cost = roundi(draft_cost_spinner.value)
|
||||
Globals.board_game.add_building_to_draft.rpc(draft_building.serialize())
|
||||
|
||||
|
||||
func _on_sell_building_permit_pressed():
|
||||
Globals.board_game.sell_building_permit()
|
||||
_hide_real_estate_market()
|
||||
add_to_draft.rpc(draft_building.serialize())
|
||||
|
||||
@ -8,7 +8,6 @@
|
||||
[ext_resource type="PackedScene" uid="uid://7jht5hlggey1" path="res://prefabs/tiles/turns/left_turn.tscn" id="5_dxd6m"]
|
||||
[ext_resource type="PackedScene" uid="uid://cpmlj6muvdwix" path="res://prefabs/ui/building_selector.tscn" id="6_7r4kk"]
|
||||
[ext_resource type="PackedScene" uid="uid://bto4vblqk2inb" path="res://prefabs/tiles/buildings/home.tscn" id="7_dxd6m"]
|
||||
[ext_resource type="PackedScene" uid="uid://wdgig5aclnpx" path="res://prefabs/tiles/buildings/hq.tscn" id="9_wxj2g"]
|
||||
[ext_resource type="Script" uid="uid://s7x0q87dps5d" path="res://prefabs/ui/hand.gd" id="17_r0188"]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_qhv1l"]
|
||||
@ -32,14 +31,9 @@ font_size = 24
|
||||
font_size = 24
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_7r4kk"]
|
||||
font_size = 24
|
||||
font_size = 32
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_w3n6g"]
|
||||
resource_local_to_scene = true
|
||||
bg_color = Color(0, 0, 0, 0)
|
||||
border_color = Color(1, 1, 1, 1)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_di23u"]
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_j4kb6"]
|
||||
resource_local_to_scene = true
|
||||
bg_color = Color(0, 0, 0, 0)
|
||||
border_color = Color(1, 1, 1, 1)
|
||||
@ -87,20 +81,20 @@ size_flags_vertical = 4
|
||||
|
||||
[node name="Undo" type="Button" parent="HBoxContainer/Controls" unique_id=1480835490]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(125, 0)
|
||||
custom_minimum_size = Vector2(100, 0)
|
||||
layout_mode = 2
|
||||
disabled = true
|
||||
text = "Reset Turn"
|
||||
text = "Undo"
|
||||
|
||||
[node name="Pass" type="Button" parent="HBoxContainer/Controls" unique_id=1183096687]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(125, 0)
|
||||
custom_minimum_size = Vector2(100, 0)
|
||||
layout_mode = 2
|
||||
text = "Pass"
|
||||
|
||||
[node name="Submit" type="Button" parent="HBoxContainer/Controls" unique_id=122864337]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(125, 0)
|
||||
custom_minimum_size = Vector2(100, 0)
|
||||
layout_mode = 2
|
||||
disabled = true
|
||||
text = "Confirm"
|
||||
@ -204,18 +198,7 @@ layout_mode = 2
|
||||
theme_override_constants/separation = 50
|
||||
alignment = 1
|
||||
|
||||
[node name="Actions" type="VBoxContainer" parent="BlueprintsContainer/VBoxContainer/HBoxContainer" unique_id=60554643]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 25
|
||||
alignment = 1
|
||||
|
||||
[node name="SellBuildingPermit" type="Button" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/Actions" unique_id=1608782007]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(220, 0)
|
||||
layout_mode = 2
|
||||
text = "Sell Building Permit - $20"
|
||||
|
||||
[node name="CancelPlacement" type="Button" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/Actions" unique_id=1945532062]
|
||||
[node name="CancelPlacement" type="Button" parent="BlueprintsContainer/VBoxContainer/HBoxContainer" unique_id=1945532062]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 4
|
||||
@ -257,7 +240,7 @@ alignment = 1
|
||||
|
||||
[node name="Label" type="Label" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/BasicTiles" unique_id=1978827830]
|
||||
layout_mode = 2
|
||||
text = "Basic Tiles - $2"
|
||||
text = "Basic Tiles - $1"
|
||||
label_settings = SubResource("LabelSettings_j4kb6")
|
||||
horizontal_alignment = 1
|
||||
|
||||
@ -266,7 +249,7 @@ layout_mode = 2
|
||||
size_flags_vertical = 6
|
||||
theme_override_constants/h_separation = 10
|
||||
theme_override_constants/v_separation = 10
|
||||
columns = 2
|
||||
columns = 4
|
||||
|
||||
[node name="Up" type="Control" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/BasicTiles/GridContainer" unique_id=748424964]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
@ -274,7 +257,7 @@ layout_mode = 2
|
||||
|
||||
[node name="UpTurn" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/BasicTiles/GridContainer/Up" unique_id=1363157270 instance=ExtResource("2_eu1vu")]
|
||||
position = Vector2(55, 55)
|
||||
cost = 2
|
||||
cost = 1
|
||||
|
||||
[node name="Right" type="Control" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/BasicTiles/GridContainer" unique_id=1274279814]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
@ -282,7 +265,7 @@ layout_mode = 2
|
||||
|
||||
[node name="RightTurn" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/BasicTiles/GridContainer/Right" unique_id=1688209745 instance=ExtResource("3_7r4kk")]
|
||||
position = Vector2(55, 55)
|
||||
cost = 2
|
||||
cost = 1
|
||||
|
||||
[node name="Down" type="Control" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/BasicTiles/GridContainer" unique_id=871055726]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
@ -290,7 +273,7 @@ layout_mode = 2
|
||||
|
||||
[node name="DownTurn" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/BasicTiles/GridContainer/Down" unique_id=269046840 instance=ExtResource("4_c56vf")]
|
||||
position = Vector2(55, 55)
|
||||
cost = 2
|
||||
cost = 1
|
||||
|
||||
[node name="Left" type="Control" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/BasicTiles/GridContainer" unique_id=496620027]
|
||||
custom_minimum_size = Vector2(110, 110)
|
||||
@ -298,39 +281,23 @@ layout_mode = 2
|
||||
|
||||
[node name="LeftTurn" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/BasicTiles/GridContainer/Left" unique_id=1788133401 instance=ExtResource("5_dxd6m")]
|
||||
position = Vector2(55, 55)
|
||||
cost = 2
|
||||
cost = 1
|
||||
|
||||
[node name="Home" type="VBoxContainer" parent="BlueprintsContainer/VBoxContainer/HBoxContainer" unique_id=85382159]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/Home" unique_id=70473481]
|
||||
layout_mode = 2
|
||||
text = "Move Home - $4"
|
||||
text = "Home - $2"
|
||||
label_settings = SubResource("LabelSettings_7r4kk")
|
||||
|
||||
[node name="BuildingSelector" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/Home" unique_id=133308872 instance=ExtResource("6_7r4kk")]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 6
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_w3n6g")
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_j4kb6")
|
||||
|
||||
[node name="Home" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/Home/BuildingSelector" unique_id=1701297833 instance=ExtResource("7_dxd6m")]
|
||||
cost = 4
|
||||
|
||||
[node name="HQ" type="VBoxContainer" parent="BlueprintsContainer/VBoxContainer/HBoxContainer" unique_id=1913362855]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/HQ" unique_id=1804332196]
|
||||
layout_mode = 2
|
||||
text = "Move HQ - $4"
|
||||
label_settings = SubResource("LabelSettings_7r4kk")
|
||||
|
||||
[node name="BuildingSelector" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/HQ" unique_id=1872170733 instance=ExtResource("6_7r4kk")]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 6
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_di23u")
|
||||
|
||||
[node name="HQ" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/HQ/BuildingSelector" unique_id=1188984099 instance=ExtResource("9_wxj2g")]
|
||||
cost = 4
|
||||
cost = 2
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="BlueprintsContainer/VBoxContainer" unique_id=2014532559]
|
||||
layout_mode = 2
|
||||
@ -392,8 +359,6 @@ unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme = SubResource("Theme_w3n6g")
|
||||
theme_override_constants/buttons_width = 32
|
||||
min_value = 1.0
|
||||
value = 1.0
|
||||
rounded = true
|
||||
alignment = 1
|
||||
prefix = "$"
|
||||
@ -415,8 +380,7 @@ text = "Set Cost"
|
||||
[connection signal="pressed" from="HBoxContainer/Controls/FastForward4" to="." method="_on_fast_forward_4_pressed"]
|
||||
[connection signal="pressed" from="HBoxContainer/Controls/FastForward10" to="." method="_on_fast_forward_10_pressed"]
|
||||
[connection signal="pressed" from="HBoxContainer/TechTree/RealEstateMarket" to="." method="_on_blueprints_pressed"]
|
||||
[connection signal="pressed" from="BlueprintsContainer/VBoxContainer/HBoxContainer/Actions/SellBuildingPermit" to="." method="_on_sell_building_permit_pressed"]
|
||||
[connection signal="pressed" from="BlueprintsContainer/VBoxContainer/HBoxContainer/Actions/CancelPlacement" to="." method="_on_cancel_placement_pressed"]
|
||||
[connection signal="pressed" from="BlueprintsContainer/VBoxContainer/HBoxContainer/CancelPlacement" to="." method="_on_cancel_placement_pressed"]
|
||||
[connection signal="pressed" from="BlueprintsContainer/VBoxContainer/HBoxContainer/Walls/StartWalls" to="." method="_on_walls_pressed"]
|
||||
[connection signal="pressed" from="BlueprintsContainer/VBoxContainer/HBoxContainer/Walls/StopWalls" to="." method="_on_walls_pressed"]
|
||||
[connection signal="tile_selected" from="BlueprintsContainer/VBoxContainer/HBoxContainer/BasicTiles/GridContainer/Up/UpTurn" to="." method="handle_tile_selected"]
|
||||
@ -424,6 +388,5 @@ text = "Set Cost"
|
||||
[connection signal="tile_selected" from="BlueprintsContainer/VBoxContainer/HBoxContainer/BasicTiles/GridContainer/Down/DownTurn" to="." method="handle_tile_selected"]
|
||||
[connection signal="tile_selected" from="BlueprintsContainer/VBoxContainer/HBoxContainer/BasicTiles/GridContainer/Left/LeftTurn" to="." method="handle_tile_selected"]
|
||||
[connection signal="select_building" from="BlueprintsContainer/VBoxContainer/HBoxContainer/Home/BuildingSelector" to="." method="handle_building_selected"]
|
||||
[connection signal="select_building" from="BlueprintsContainer/VBoxContainer/HBoxContainer/HQ/BuildingSelector" to="." method="handle_building_selected"]
|
||||
[connection signal="building_selected" from="Hand" to="." method="_on_hand_building_selected"]
|
||||
[connection signal="pressed" from="DraftCost/VBoxContainer/SetDraftCost" to="." method="_on_set_draft_cost_pressed"]
|
||||
|
||||
@ -6,4 +6,4 @@ class_name DraftBuilding extends VBoxContainer
|
||||
|
||||
func set_building(building: Building) -> void:
|
||||
cost_label.text = "$%d" % building.cost
|
||||
building_selector.call_deferred("add_child", building)
|
||||
building_selector.add_child(building)
|
||||
|
||||
@ -1,15 +0,0 @@
|
||||
class_name PlayerActionLight extends Panel
|
||||
|
||||
var style_box: StyleBoxFlat
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
style_box = get_theme_stylebox("panel")
|
||||
|
||||
|
||||
func reset() -> void:
|
||||
style_box.bg_color = Color(0, 0, 1, 1)
|
||||
|
||||
|
||||
func use() -> void:
|
||||
style_box.bg_color = Color(1, 0, 0, 1)
|
||||
@ -1 +0,0 @@
|
||||
uid://dv4e6iadts64e
|
||||
@ -1,23 +0,0 @@
|
||||
[gd_scene format=3 uid="uid://1ltfumpg4ds3"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dv4e6iadts64e" path="res://prefabs/ui/player_action_light.gd" id="1_wy3l5"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_nqh6b"]
|
||||
resource_local_to_scene = true
|
||||
bg_color = Color(0, 0, 1, 1)
|
||||
border_width_left = 2
|
||||
border_width_top = 2
|
||||
border_width_right = 2
|
||||
border_width_bottom = 2
|
||||
border_color = Color(0, 0, 0, 1)
|
||||
corner_radius_top_left = 50
|
||||
corner_radius_top_right = 50
|
||||
corner_radius_bottom_right = 50
|
||||
corner_radius_bottom_left = 50
|
||||
|
||||
[node name="PlayerActionLight" type="Panel" unique_id=603450829]
|
||||
custom_minimum_size = Vector2(16, 16)
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_nqh6b")
|
||||
script = ExtResource("1_wy3l5")
|
||||
@ -1,30 +1,15 @@
|
||||
class_name PlayerInfo extends HBoxContainer
|
||||
|
||||
const PLAYER_ACTION_LIGHT_SCENE = preload("uid://1ltfumpg4ds3")
|
||||
|
||||
@onready var permits_container: Container = %Permits
|
||||
@onready var name_label: Label = %Name
|
||||
@onready var money_label: Label = %Money
|
||||
@onready var votes_label: Label = %Votes
|
||||
|
||||
|
||||
func set_player(player: Player) -> void:
|
||||
player.changed.connect(_update_player_info)
|
||||
if player.id == Globals.game.this_player.id:
|
||||
name_label.text = "* %s" % player.name
|
||||
else:
|
||||
name_label.text = player.name
|
||||
name_label.label_settings.font_color = player.color
|
||||
_update_player_info(player)
|
||||
money_label.text = "$%s" % str(player.money)
|
||||
|
||||
|
||||
func _update_player_info(player: Player) -> void:
|
||||
money_label.text = "$%d" % player.money
|
||||
votes_label.text = "%d" % player.votes
|
||||
for child in permits_container.get_children():
|
||||
child.queue_free()
|
||||
for i in range(player.building_permits):
|
||||
var light: PlayerActionLight = PLAYER_ACTION_LIGHT_SCENE.instantiate()
|
||||
permits_container.add_child(light)
|
||||
if i < player.build_actions_taken:
|
||||
light.use()
|
||||
money_label.text = "$%s" % str(player.money)
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
[gd_scene format=3 uid="uid://8sd8fkx3hua0"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ccx3jyc31veok" path="res://prefabs/ui/player_info.gd" id="1_tautg"]
|
||||
[ext_resource type="FontFile" uid="uid://cv63xhs0xcoc1" path="res://assets/fonts/NotoColorEmoji.ttf" id="2_lpiko"]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_lpiko"]
|
||||
resource_local_to_scene = true
|
||||
@ -11,19 +10,8 @@ outline_color = Color(0, 0, 0, 1)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_tautg"]
|
||||
font_size = 24
|
||||
font_color = Color(0, 1, 0, 1)
|
||||
font_color = Color(0, 0, 0, 1)
|
||||
outline_size = 4
|
||||
outline_color = Color(0, 0, 0, 1)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_0g7uu"]
|
||||
font_size = 24
|
||||
font_color = Color(0, 0, 1, 1)
|
||||
outline_size = 4
|
||||
outline_color = Color(0, 0, 0, 1)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_foovh"]
|
||||
font = ExtResource("2_lpiko")
|
||||
font_size = 24
|
||||
|
||||
[node name="PlayerInfo" type="HBoxContainer" unique_id=1335388560]
|
||||
offset_right = 40.0
|
||||
@ -31,10 +19,6 @@ offset_bottom = 40.0
|
||||
theme_override_constants/separation = 16
|
||||
script = ExtResource("1_tautg")
|
||||
|
||||
[node name="Permits" type="HBoxContainer" parent="." unique_id=1767255572]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Name" type="Label" parent="." unique_id=402118000]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
@ -46,17 +30,3 @@ unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "$0"
|
||||
label_settings = SubResource("LabelSettings_tautg")
|
||||
|
||||
[node name="Votes" type="HBoxContainer" parent="." unique_id=902142402]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Votes" type="Label" parent="Votes" unique_id=1929524068]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "0"
|
||||
label_settings = SubResource("LabelSettings_0g7uu")
|
||||
|
||||
[node name="Icon" type="Label" parent="Votes" unique_id=1102179585]
|
||||
layout_mode = 2
|
||||
text = "🗳️"
|
||||
label_settings = SubResource("LabelSettings_foovh")
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
[gd_scene format=3 uid="uid://drhv16h2tgoju"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://s1kqdqdvvrxf" path="res://assets/package/boxes_SpriteSheet.png" id="1_a86ef"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_af8ve"]
|
||||
atlas = ExtResource("1_a86ef")
|
||||
region = Rect2(1, 0, 16, 18)
|
||||
|
||||
[node name="PackageIcon" type="TextureRect" unique_id=585475146]
|
||||
texture_filter = 1
|
||||
custom_minimum_size = Vector2(10, 10)
|
||||
texture = SubResource("AtlasTexture_af8ve")
|
||||
expand_mode = 3
|
||||
@ -1,6 +1,6 @@
|
||||
class_name BoardState
|
||||
|
||||
enum State { INITIAL_SETUP, DRAFT, PLAY, PLACING_SPAWNS, DESTROYING_BUILDINGS }
|
||||
enum State { INITIAL_SETUP, DRAFT, PLAY }
|
||||
|
||||
var day: int = 0
|
||||
var turn: int = 0
|
||||
@ -10,22 +10,14 @@ var players: Array[Player] = []
|
||||
var tiles: Array[Tile] = []
|
||||
var buildings: Array[Building] = []
|
||||
var players_passed: int = 0
|
||||
var real_estate_market: Array[Building] = []
|
||||
var spawn_placements: int = 0
|
||||
var buildings_to_destroy: int = 0
|
||||
var citizens_starting_money: int = 0
|
||||
|
||||
|
||||
func get_this_player_index() -> int:
|
||||
return get_player_index(Globals.game.this_player)
|
||||
return players.find_custom(func(p: Player) -> bool: return p.id == Globals.game.this_player.id)
|
||||
|
||||
|
||||
func get_current_player_index() -> int:
|
||||
return get_player_index(current_player)
|
||||
|
||||
|
||||
func get_player_index(player: Player) -> int:
|
||||
return players.find_custom(func(p: Player) -> bool: return p.id == player.id)
|
||||
return players.find_custom(func(p: Player) -> bool: return p.id == current_player.id)
|
||||
|
||||
|
||||
func serialize() -> Dictionary:
|
||||
@ -34,9 +26,6 @@ func serialize() -> Dictionary:
|
||||
result["turn"] = turn
|
||||
result["state"] = state
|
||||
result["players_passed"] = players_passed
|
||||
result["spawn_placements"] = spawn_placements
|
||||
result["buildings_to_destroy"] = buildings_to_destroy
|
||||
result["citizens_starting_money"] = citizens_starting_money
|
||||
result["current_player"] = current_player.serialize()
|
||||
result["players"] = []
|
||||
for p in players:
|
||||
@ -48,9 +37,6 @@ func serialize() -> Dictionary:
|
||||
result["buildings"] = []
|
||||
for b in buildings:
|
||||
result["buildings"].append(b.serialize())
|
||||
result["real_estate_market"] = []
|
||||
for db in real_estate_market:
|
||||
result["real_estate_market"].append(db.serialize())
|
||||
return result
|
||||
|
||||
|
||||
@ -60,9 +46,6 @@ static func deserialize(data: Dictionary) -> BoardState:
|
||||
result.turn = data["turn"]
|
||||
result.state = data["state"]
|
||||
result.players_passed = data["players_passed"]
|
||||
result.spawn_placements = data["spawn_placements"]
|
||||
result.buildings_to_destroy = data["buildings_to_destroy"]
|
||||
result.citizens_starting_money = data["citizens_starting_money"]
|
||||
result.current_player = Player.deserialize(data["current_player"])
|
||||
for p in data["players"]:
|
||||
result.players.append(Player.deserialize(p))
|
||||
@ -70,6 +53,4 @@ static func deserialize(data: Dictionary) -> BoardState:
|
||||
result.tiles.append(Tile.deserialize(t))
|
||||
for b in data["buildings"]:
|
||||
result.buildings.append(Building.deserialize(b))
|
||||
for db in data["real_estate_market"]:
|
||||
result.real_estate_market.append(Building.deserialize(db))
|
||||
return result
|
||||
|
||||
@ -6,18 +6,6 @@ var money: int = 10:
|
||||
set(value):
|
||||
money = value
|
||||
changed.emit(self)
|
||||
var votes: int = 0:
|
||||
set(value):
|
||||
votes = value
|
||||
changed.emit(self)
|
||||
var build_actions_taken: int = 0:
|
||||
set(value):
|
||||
build_actions_taken = value
|
||||
changed.emit(self)
|
||||
var building_permits: int = 2:
|
||||
set(value):
|
||||
building_permits = value
|
||||
changed.emit(self)
|
||||
var color: Color = Color(randf(), randf(), randf())
|
||||
|
||||
|
||||
@ -27,9 +15,6 @@ func serialize() -> Dictionary:
|
||||
result["name"] = name
|
||||
result["color"] = color
|
||||
result["money"] = money
|
||||
result["votes"] = votes
|
||||
result["building_permits"] = building_permits
|
||||
result["build_actions_taken"] = build_actions_taken
|
||||
return result
|
||||
|
||||
|
||||
@ -39,7 +24,4 @@ static func deserialize(data: Dictionary) -> Player:
|
||||
result.name = data["name"]
|
||||
result.color = data["color"]
|
||||
result.money = data["money"]
|
||||
result.votes = data["votes"]
|
||||
result.building_permits = data["building_permits"]
|
||||
result.build_actions_taken = data["build_actions_taken"]
|
||||
return result
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
class_name BoardGame extends Node
|
||||
|
||||
signal all_players_ready_for_day_start
|
||||
|
||||
const HOME_SCENE = preload("uid://bto4vblqk2inb")
|
||||
const HQ_SCENE = preload("uid://wdgig5aclnpx")
|
||||
#const DOWN_SPAWN_SCENE = preload("uid://d4ltd1geg7s2p")
|
||||
|
||||
const BANK_SCENE = preload("uid://c06fsqdixer1c")
|
||||
@ -14,10 +11,6 @@ const GUN_SHOP_SCENE = preload("uid://c1kyedmrep0tu")
|
||||
const HOSPITAL_SCENE = preload("uid://bytldu3y1jak3")
|
||||
const OFFICE_SCENE = preload("uid://mixrqf035krk")
|
||||
const SHOP_SCENE = preload("uid://dbn63mv0peqf")
|
||||
const CHURCH_SCENE = preload("uid://brn0nbkela0m4")
|
||||
const CITY_HALL_SCENE = preload("uid://dtnejoimqiu0o")
|
||||
const DEMOLITIONS_SCENE = preload("uid://dvmglvbersupv")
|
||||
const POST_OFFICE_SCENE = preload("uid://bpi8owv5lxyjy")
|
||||
|
||||
const BASE_DECK = [
|
||||
BANK_SCENE,
|
||||
@ -27,15 +20,9 @@ const BASE_DECK = [
|
||||
GUN_SHOP_SCENE,
|
||||
HOSPITAL_SCENE,
|
||||
OFFICE_SCENE,
|
||||
SHOP_SCENE,
|
||||
CHURCH_SCENE,
|
||||
CITY_HALL_SCENE,
|
||||
DEMOLITIONS_SCENE,
|
||||
POST_OFFICE_SCENE
|
||||
SHOP_SCENE
|
||||
]
|
||||
|
||||
const WINNING_MONEY_AMOUNT: int = 200
|
||||
|
||||
var citizen_count: int = 0:
|
||||
set(value):
|
||||
#print(value)
|
||||
@ -44,23 +31,20 @@ var citizen_count: int = 0:
|
||||
handle_citizens_finished()
|
||||
|
||||
var buildings_added_to_draft: int = 0
|
||||
var homes_placed: int = 0
|
||||
var spawn_placement_actions: int = 0
|
||||
var draft_index_to_be_deleted: int = -1
|
||||
var num_players_ready_for_day_start: int = 0
|
||||
var is_playing_day: bool = false
|
||||
|
||||
var current_board_state: BoardState:
|
||||
set(value):
|
||||
current_board_state = value
|
||||
#controls.check_controls_enabled()
|
||||
#controls.set_info()
|
||||
controls.check_controls_enabled()
|
||||
controls.set_info()
|
||||
|
||||
var pending_board_state: BoardState:
|
||||
set(value):
|
||||
pending_board_state = value
|
||||
#controls.check_controls_enabled()
|
||||
|
||||
var original_board_state: BoardState
|
||||
controls.check_controls_enabled()
|
||||
|
||||
var deck: Array[Building] = []
|
||||
|
||||
@ -81,129 +65,41 @@ func setup_building_deck() -> void:
|
||||
|
||||
|
||||
@rpc("any_peer", "call_local", "reliable")
|
||||
func advance_board_state(board_state: Dictionary) -> void:
|
||||
pending_board_state = null
|
||||
func set_board_state(board_state: Dictionary) -> void:
|
||||
current_board_state = BoardState.deserialize(board_state)
|
||||
board.reset()
|
||||
board.set_board_state(current_board_state)
|
||||
controls.set_board_state(current_board_state)
|
||||
if current_board_state.state == BoardState.State.INITIAL_SETUP:
|
||||
if current_board_state.turn >= 0:
|
||||
current_board_state.players.reverse()
|
||||
current_board_state.current_player = current_board_state.players[0]
|
||||
controls.set_info()
|
||||
start_day()
|
||||
elif Globals.game.this_player.id == current_board_state.current_player.id:
|
||||
if current_board_state.turn >= -current_board_state.players.size():
|
||||
board.set_active_building(HQ_SCENE.instantiate())
|
||||
else:
|
||||
if Globals.game.this_player.id == current_board_state.current_player.id:
|
||||
board.set_active_building(HOME_SCENE.instantiate())
|
||||
elif current_board_state.state == BoardState.State.PLACING_SPAWNS:
|
||||
elif current_board_state.state == BoardState.State.DRAFT:
|
||||
start_day()
|
||||
if current_board_state.players_passed == Globals.game.players.size():
|
||||
current_board_state.players_passed = 0
|
||||
end_day()
|
||||
controls.check_controls_enabled()
|
||||
controls.set_info()
|
||||
original_board_state = BoardState.deserialize(current_board_state.serialize())
|
||||
|
||||
|
||||
@rpc("any_peer", "call_local", "reliable")
|
||||
func update_board_state(board_state: Dictionary) -> void:
|
||||
current_board_state = BoardState.deserialize(board_state)
|
||||
board.reset()
|
||||
board.set_board_state(current_board_state)
|
||||
controls.set_board_state(current_board_state)
|
||||
controls.check_controls_enabled()
|
||||
controls.set_info()
|
||||
|
||||
|
||||
@rpc("any_peer", "call_local", "reliable")
|
||||
func add_building_to_draft(building_data: Dictionary) -> void:
|
||||
current_board_state.real_estate_market.append(Building.deserialize(building_data))
|
||||
func add_building_to_draft() -> void:
|
||||
buildings_added_to_draft += 1
|
||||
if buildings_added_to_draft >= Globals.game.players.size():
|
||||
buildings_added_to_draft = 0
|
||||
current_board_state.state = BoardState.State.PLAY
|
||||
controls.check_controls_enabled()
|
||||
controls.set_info()
|
||||
original_board_state = BoardState.deserialize(current_board_state.serialize())
|
||||
update_board_state.rpc(current_board_state.serialize())
|
||||
|
||||
|
||||
@rpc("any_peer", "call_local", "reliable")
|
||||
func ready_for_day_start() -> void:
|
||||
num_players_ready_for_day_start += 1
|
||||
if num_players_ready_for_day_start >= Globals.game.players.size():
|
||||
all_players_ready_for_day_start.emit()
|
||||
|
||||
|
||||
func select_tile(tile: Tile) -> void:
|
||||
board.set_active_tile(Tile.deserialize(tile.serialize()))
|
||||
board.set_active_tile(tile.duplicate())
|
||||
|
||||
|
||||
func select_building(building: Building) -> void:
|
||||
if building is Home:
|
||||
board.remove_home(current_board_state.current_player)
|
||||
if building is HQ:
|
||||
board.remove_hq(current_board_state.current_player)
|
||||
board.set_active_building(Building.deserialize(building.serialize()))
|
||||
draft_index_to_be_deleted = current_board_state.real_estate_market.find_custom(
|
||||
func(b: Building) -> bool:
|
||||
return (
|
||||
b.get_script() == building.get_script()
|
||||
and b.cost == building.cost
|
||||
and b.player == building.player
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
func cancel_placement() -> void:
|
||||
draft_index_to_be_deleted = -1
|
||||
if is_instance_valid(board.active_tile):
|
||||
board.active_tile.queue_free()
|
||||
board.active_tile = null
|
||||
if is_instance_valid(board.active_building):
|
||||
board.active_building.queue_free()
|
||||
board.active_building = null
|
||||
func select_building(building: Building, delete_index: int = -1) -> void:
|
||||
board.set_active_building(building.duplicate())
|
||||
draft_index_to_be_deleted = delete_index
|
||||
|
||||
|
||||
func start_day() -> void:
|
||||
if current_board_state.state == BoardState.State.DESTROYING_BUILDINGS:
|
||||
if current_board_state.buildings_to_destroy > 0:
|
||||
if current_board_state.current_player.id == Globals.game.this_player.id:
|
||||
board.is_destroying_building = true
|
||||
return
|
||||
current_board_state.state = BoardState.State.DRAFT
|
||||
|
||||
if current_board_state.state == BoardState.State.PLACING_SPAWNS:
|
||||
if current_board_state.spawn_placements > 0:
|
||||
if current_board_state.current_player.id == Globals.game.this_player.id:
|
||||
board.call_deferred(
|
||||
"set_active_building", load("uid://d4ltd1geg7s2p").instantiate()
|
||||
)
|
||||
return
|
||||
current_board_state.state = BoardState.State.DRAFT
|
||||
|
||||
if current_board_state.day > 0:
|
||||
current_board_state.players.sort_custom(
|
||||
func(p1: Player, p2: Player) -> bool: return p1.money < p2.money
|
||||
)
|
||||
current_board_state.current_player = current_board_state.players[0]
|
||||
|
||||
await all_players_ready_for_day_start
|
||||
|
||||
current_board_state.day += 1
|
||||
current_board_state.turn = 1
|
||||
current_board_state.state = BoardState.State.DRAFT
|
||||
for p in current_board_state.players:
|
||||
p.build_actions_taken = 0
|
||||
_tally_votes()
|
||||
reduce_draft_costs()
|
||||
|
||||
seed(Globals.game.sum_player_ids())
|
||||
deck.shuffle()
|
||||
#deck.push_front(POST_OFFICE_SCENE.instantiate())
|
||||
var turn_index := current_board_state.get_this_player_index()
|
||||
controls.give_hand(deck.slice(0 + (3 * turn_index), 3 + (3 * turn_index)))
|
||||
controls.set_info()
|
||||
@ -212,58 +108,33 @@ func start_day() -> void:
|
||||
func end_day() -> void:
|
||||
controls.end_day()
|
||||
get_tree().call_group("Pausable", "unpause")
|
||||
is_playing_day = true
|
||||
|
||||
|
||||
func update_player_votes(player: Player, votes: int) -> void:
|
||||
var idx = current_board_state.get_player_index(player)
|
||||
current_board_state.players[idx].votes = votes
|
||||
|
||||
|
||||
func update_player_money(player: Player, money: int) -> void:
|
||||
var idx = current_board_state.get_player_index(player)
|
||||
current_board_state.players[idx].money = money
|
||||
|
||||
|
||||
func reduce_draft_costs() -> void:
|
||||
for building in current_board_state.real_estate_market:
|
||||
building.cost = ceili(building.cost / 2.0)
|
||||
controls.set_board_state(current_board_state)
|
||||
|
||||
|
||||
func handle_board_state_changed() -> void:
|
||||
pending_board_state = BoardState.new()
|
||||
pending_board_state.day = current_board_state.day
|
||||
pending_board_state.spawn_placements = current_board_state.spawn_placements
|
||||
pending_board_state.buildings_to_destroy = current_board_state.buildings_to_destroy
|
||||
if (
|
||||
current_board_state.state != BoardState.State.DRAFT
|
||||
and current_board_state.state != BoardState.State.PLACING_SPAWNS
|
||||
):
|
||||
pending_board_state.turn = current_board_state.turn + 1
|
||||
if pending_board_state.turn == 0:
|
||||
pending_board_state.state = BoardState.State.DRAFT
|
||||
else:
|
||||
pending_board_state.state = current_board_state.state
|
||||
pending_board_state.players = current_board_state.players
|
||||
pending_board_state.players.push_back(pending_board_state.players.pop_front())
|
||||
if (
|
||||
pending_board_state.state == BoardState.State.INITIAL_SETUP
|
||||
and pending_board_state.turn == -pending_board_state.players.size()
|
||||
):
|
||||
pending_board_state.players.reverse()
|
||||
pending_board_state.current_player = current_board_state.players[0]
|
||||
pending_board_state.tiles = board.tiles.values()
|
||||
for building in board.buildings.values():
|
||||
if !pending_board_state.buildings.has(building):
|
||||
pending_board_state.buildings.append(building)
|
||||
pending_board_state.real_estate_market = current_board_state.real_estate_market
|
||||
controls.check_controls_enabled()
|
||||
controls.set_info()
|
||||
|
||||
|
||||
func handle_board_state_confirmed() -> void:
|
||||
current_board_state.players_passed = 0
|
||||
set_board_state.rpc(pending_board_state.serialize())
|
||||
pending_board_state = null
|
||||
if draft_index_to_be_deleted != -1:
|
||||
pending_board_state.real_estate_market.remove_at(draft_index_to_be_deleted)
|
||||
controls.remove_from_draft.rpc(draft_index_to_be_deleted)
|
||||
draft_index_to_be_deleted = -1
|
||||
advance_board_state.rpc(pending_board_state.serialize())
|
||||
|
||||
|
||||
func handle_pass() -> void:
|
||||
@ -271,53 +142,22 @@ func handle_pass() -> void:
|
||||
current_board_state.turn += 1
|
||||
current_board_state.players.push_back(current_board_state.players.pop_front())
|
||||
current_board_state.current_player = current_board_state.players[0]
|
||||
advance_board_state.rpc(current_board_state.serialize())
|
||||
set_board_state.rpc(current_board_state.serialize())
|
||||
|
||||
|
||||
func handle_citizens_finished() -> void:
|
||||
for child in board.board_state.get_children():
|
||||
if child.get_groups().has("PostTurnActions"):
|
||||
child.handle_post_turn_actions()
|
||||
is_playing_day = false
|
||||
controls.reset_turn()
|
||||
var winning_player_idx = current_board_state.players.find_custom(
|
||||
func(p: Player) -> bool: return p.money >= WINNING_MONEY_AMOUNT
|
||||
func(p: Player) -> bool: return p.money >= 100
|
||||
)
|
||||
if winning_player_idx != -1:
|
||||
game_over.set_winning_player(current_board_state.players[winning_player_idx])
|
||||
else:
|
||||
start_day()
|
||||
ready_for_day_start.rpc()
|
||||
|
||||
|
||||
func _tally_votes() -> void:
|
||||
var most_votes: int = (
|
||||
current_board_state.players.map(func(p: Player) -> int: return p.votes).max()
|
||||
)
|
||||
var players_with_most_votes: Array[Player] = current_board_state.players.filter(
|
||||
func(p: Player) -> bool: return p.votes == most_votes
|
||||
)
|
||||
if players_with_most_votes.size() == 1:
|
||||
players_with_most_votes[0].building_permits += 1
|
||||
for player in current_board_state.players:
|
||||
player.votes = 0
|
||||
|
||||
|
||||
func queue_spawn_placement(num_placements: int) -> void:
|
||||
current_board_state.spawn_placements += num_placements * current_board_state.players.size()
|
||||
current_board_state.state = BoardState.State.PLACING_SPAWNS
|
||||
|
||||
|
||||
func queue_building_destruction(num: int) -> void:
|
||||
current_board_state.buildings_to_destroy += num * current_board_state.players.size()
|
||||
current_board_state.state = BoardState.State.DESTROYING_BUILDINGS
|
||||
|
||||
|
||||
func sell_building_permit() -> void:
|
||||
if current_board_state.players[0].building_permits > 0:
|
||||
current_board_state.players[0].building_permits -= 1
|
||||
current_board_state.players[0].money += 20
|
||||
current_board_state.turn += 1
|
||||
current_board_state.players.push_back(current_board_state.players.pop_front())
|
||||
current_board_state.current_player = current_board_state.players[0]
|
||||
advance_board_state.rpc(current_board_state.serialize())
|
||||
func queue_spawn_placement(_num_placements: int) -> void:
|
||||
print("Handle queueing spawn placements")
|
||||
|
||||
@ -74,14 +74,11 @@ func create_initial_board_state() -> void:
|
||||
Globals.board_game.board.initialize()
|
||||
var board_state := BoardState.new()
|
||||
players.shuffle()
|
||||
board_state.turn = -(players.size() * 2)
|
||||
board_state.turn = -players.size()
|
||||
board_state.players = players
|
||||
board_state.current_player = players[0]
|
||||
board_state.tiles = Globals.board_game.board.tiles.values()
|
||||
for building in Globals.board_game.board.buildings.values():
|
||||
if !board_state.buildings.has(building):
|
||||
board_state.buildings.append(building)
|
||||
Globals.board_game.advance_board_state.rpc(board_state.serialize())
|
||||
Globals.board_game.set_board_state.rpc(board_state.serialize())
|
||||
Globals.board_game.setup_building_deck.rpc()
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user