generated from krampus/template-godot4
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 15c9fd812e | |||
| 688ffcbf47 | |||
| 6921a1ff63 | |||
| bb36f42635 | |||
| 627c2b38e6 | |||
| 545bf25f07 | |||
| 8d2903a964 |
BIN
assets/bomb/bomb.png
(Stored with Git LFS)
Normal file
BIN
assets/bomb/bomb.png
(Stored with Git LFS)
Normal file
Binary file not shown.
40
assets/bomb/bomb.png.import
Normal file
40
assets/bomb/bomb.png.import
Normal file
@ -0,0 +1,40 @@
|
||||
[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)
Normal file
BIN
assets/bomb/coin.png
(Stored with Git LFS)
Normal file
Binary file not shown.
40
assets/bomb/coin.png.import
Normal file
40
assets/bomb/coin.png.import
Normal file
@ -0,0 +1,40 @@
|
||||
[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
|
||||
BIN
assets/fonts/NotoColorEmoji.ttf
Normal file
BIN
assets/fonts/NotoColorEmoji.ttf
Normal file
Binary file not shown.
36
assets/fonts/NotoColorEmoji.ttf.import
Normal file
36
assets/fonts/NotoColorEmoji.ttf.import
Normal file
@ -0,0 +1,36 @@
|
||||
[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)
Normal file
BIN
assets/package/boxes_SpriteSheet.png
(Stored with Git LFS)
Normal file
Binary file not shown.
40
assets/package/boxes_SpriteSheet.png.import
Normal file
40
assets/package/boxes_SpriteSheet.png.import
Normal file
@ -0,0 +1,40 @@
|
||||
[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
|
||||
@ -15,9 +15,11 @@ 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
|
||||
@ -39,12 +41,19 @@ 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)
|
||||
|
||||
@ -63,11 +72,14 @@ func set_active_building(building: Building) -> void:
|
||||
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].queue_free()
|
||||
tiles[current_map_coord].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
|
||||
@ -84,14 +96,17 @@ func place_active_tile() -> void:
|
||||
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:
|
||||
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].queue_free()
|
||||
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
|
||||
@ -111,42 +126,54 @@ 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
|
||||
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_building.modulate = Color(1, 1, 1, 1)
|
||||
for coord in active_building.get_tile_coords():
|
||||
buildings[coord] = active_building
|
||||
tiles[coord].queue_free()
|
||||
tiles[coord].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(coord, building)
|
||||
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(coord, building)
|
||||
remove_building(building)
|
||||
|
||||
|
||||
func remove_building(coord: Vector2i, building: Building) -> void:
|
||||
buildings.erase(coord)
|
||||
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()
|
||||
var ground: Ground = GROUND.instantiate()
|
||||
board_state.add_child(ground)
|
||||
ground.position = tile_map.map_to_local(coord)
|
||||
ground.coords = coord
|
||||
tiles[coord] = ground
|
||||
|
||||
|
||||
func _handle_building_rotation(event: InputEvent) -> void:
|
||||
@ -197,6 +224,8 @@ func reset() -> void:
|
||||
|
||||
|
||||
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
|
||||
@ -207,6 +236,8 @@ 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:
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
class_name Citizen extends CharacterBody2D
|
||||
|
||||
enum Status { NONE, DRUNK, ARMED, CAFFEINATED }
|
||||
enum Status { NONE, DRUNK, ARMED, CAFFEINATED, PACKAGED }
|
||||
|
||||
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):
|
||||
@ -29,6 +30,7 @@ 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] = []
|
||||
|
||||
@ -61,6 +63,8 @@ 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:
|
||||
@ -186,6 +190,8 @@ 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):
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
[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)
|
||||
@ -189,3 +190,10 @@ offset_top = -205.0
|
||||
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")
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
[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)
|
||||
@ -135,5 +136,12 @@ 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"]
|
||||
|
||||
@ -15,6 +15,22 @@ 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:
|
||||
@ -45,6 +61,14 @@ 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
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
[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)
|
||||
@ -182,6 +183,13 @@ 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"]
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
[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)
|
||||
@ -243,6 +244,12 @@ 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"]
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
[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)
|
||||
@ -265,3 +266,10 @@ 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")
|
||||
|
||||
@ -94,6 +94,7 @@ func handle_post_turn_actions() -> void:
|
||||
if buildings_to_destroy > 0:
|
||||
money = money % required_money
|
||||
required_money *= 2
|
||||
Globals.board_game.queue_building_destruction(buildings_to_destroy)
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
[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)
|
||||
@ -21,7 +22,7 @@ region = Rect2(16, 16, 16, 16)
|
||||
atlas = ExtResource("2_gnrqc")
|
||||
region = Rect2(0, 16, 16, 16)
|
||||
|
||||
[node name="Demolitions" type="Node2D" unique_id=746270571]
|
||||
[node name="Demolitions" type="Node2D" unique_id=746270571 groups=["PostTurnActions"]]
|
||||
process_mode = 3
|
||||
script = ExtResource("1_veblj")
|
||||
|
||||
@ -204,6 +205,13 @@ 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"]
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
[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
|
||||
@ -84,4 +85,10 @@ 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,6 +2,7 @@
|
||||
|
||||
[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)
|
||||
@ -232,6 +233,13 @@ 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"]
|
||||
|
||||
@ -104,5 +104,9 @@ 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,6 +2,7 @@
|
||||
|
||||
[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)
|
||||
@ -231,6 +232,13 @@ 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"]
|
||||
|
||||
@ -104,5 +104,9 @@ 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"]
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
[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)
|
||||
@ -161,6 +162,13 @@ 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"]
|
||||
|
||||
31
prefabs/tiles/buildings/post_office.gd
Normal file
31
prefabs/tiles/buildings/post_office.gd
Normal file
@ -0,0 +1,31 @@
|
||||
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
prefabs/tiles/buildings/post_office.gd.uid
Normal file
1
prefabs/tiles/buildings/post_office.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://bgde73oxvye5t
|
||||
119
prefabs/tiles/buildings/post_office.tscn
Normal file
119
prefabs/tiles/buildings/post_office.tscn
Normal file
@ -0,0 +1,119 @@
|
||||
[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"]
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
[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)
|
||||
@ -170,6 +171,13 @@ 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,6 +1,7 @@
|
||||
[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
|
||||
@ -144,6 +145,12 @@ 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"]
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
[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
|
||||
@ -91,3 +92,9 @@ 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")
|
||||
|
||||
@ -90,7 +90,7 @@ func check_controls_enabled() -> void:
|
||||
submit_button.disabled = true
|
||||
|
||||
# TODO: Fix undo
|
||||
undo_button.disabled = true
|
||||
# undo_button.disabled = true
|
||||
|
||||
|
||||
func set_board_state(board_state: BoardState) -> void:
|
||||
@ -263,3 +263,8 @@ func _on_set_draft_cost_pressed():
|
||||
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()
|
||||
|
||||
@ -204,7 +204,18 @@ layout_mode = 2
|
||||
theme_override_constants/separation = 50
|
||||
alignment = 1
|
||||
|
||||
[node name="CancelPlacement" type="Button" parent="BlueprintsContainer/VBoxContainer/HBoxContainer" unique_id=1945532062]
|
||||
[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]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 4
|
||||
@ -404,7 +415,8 @@ 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/CancelPlacement" to="." method="_on_cancel_placement_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/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"]
|
||||
|
||||
@ -20,7 +20,7 @@ func set_player(player: Player) -> void:
|
||||
|
||||
func _update_player_info(player: Player) -> void:
|
||||
money_label.text = "$%d" % player.money
|
||||
votes_label.text = "%d 🗳️" % player.votes
|
||||
votes_label.text = "%d" % player.votes
|
||||
for child in permits_container.get_children():
|
||||
child.queue_free()
|
||||
for i in range(player.building_permits):
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
[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
|
||||
@ -20,6 +21,10 @@ 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
|
||||
offset_bottom = 40.0
|
||||
@ -42,8 +47,16 @@ layout_mode = 2
|
||||
text = "$0"
|
||||
label_settings = SubResource("LabelSettings_tautg")
|
||||
|
||||
[node name="Votes" type="Label" parent="." unique_id=1929524068]
|
||||
[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")
|
||||
|
||||
13
prefabs/ui/status_icons/package_icon.tscn
Normal file
13
prefabs/ui/status_icons/package_icon.tscn
Normal file
@ -0,0 +1,13 @@
|
||||
[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
|
||||
@ -12,6 +12,7 @@ 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
|
||||
|
||||
|
||||
@ -34,6 +35,7 @@ func serialize() -> Dictionary:
|
||||
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"] = []
|
||||
@ -59,6 +61,7 @@ static func deserialize(data: Dictionary) -> BoardState:
|
||||
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"]:
|
||||
|
||||
@ -16,6 +16,8 @@ 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,9 +29,13 @@ const BASE_DECK = [
|
||||
OFFICE_SCENE,
|
||||
SHOP_SCENE,
|
||||
CHURCH_SCENE,
|
||||
CITY_HALL_SCENE
|
||||
CITY_HALL_SCENE,
|
||||
DEMOLITIONS_SCENE,
|
||||
POST_OFFICE_SCENE
|
||||
]
|
||||
|
||||
const WINNING_MONEY_AMOUNT: int = 200
|
||||
|
||||
var citizen_count: int = 0:
|
||||
set(value):
|
||||
#print(value)
|
||||
@ -99,6 +105,7 @@ func advance_board_state(board_state: Dictionary) -> void:
|
||||
end_day()
|
||||
controls.check_controls_enabled()
|
||||
controls.set_info()
|
||||
original_board_state = BoardState.deserialize(current_board_state.serialize())
|
||||
|
||||
|
||||
@rpc("any_peer", "call_local", "reliable")
|
||||
@ -152,6 +159,7 @@ func select_building(building: Building) -> void:
|
||||
|
||||
|
||||
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
|
||||
@ -161,13 +169,12 @@ func cancel_placement() -> void:
|
||||
|
||||
|
||||
func start_day() -> void:
|
||||
if current_board_state.day > 0 and current_board_state.state != BoardState.State.PLACING_SPAWNS:
|
||||
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
|
||||
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:
|
||||
@ -177,16 +184,26 @@ func start_day() -> void:
|
||||
)
|
||||
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()
|
||||
_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()
|
||||
@ -218,6 +235,7 @@ 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
|
||||
@ -256,11 +274,6 @@ func handle_pass() -> void:
|
||||
advance_board_state.rpc(current_board_state.serialize())
|
||||
|
||||
|
||||
func reset_turn() -> void:
|
||||
pending_board_state = null
|
||||
update_board_state.rpc(original_board_state.serialize())
|
||||
|
||||
|
||||
func handle_citizens_finished() -> void:
|
||||
for child in board.board_state.get_children():
|
||||
if child.get_groups().has("PostTurnActions"):
|
||||
@ -268,7 +281,7 @@ func handle_citizens_finished() -> void:
|
||||
is_playing_day = false
|
||||
controls.reset_turn()
|
||||
var winning_player_idx = current_board_state.players.find_custom(
|
||||
func(p: Player) -> bool: return p.money >= 100
|
||||
func(p: Player) -> bool: return p.money >= WINNING_MONEY_AMOUNT
|
||||
)
|
||||
if winning_player_idx != -1:
|
||||
game_over.set_winning_player(current_board_state.players[winning_player_idx])
|
||||
@ -277,7 +290,7 @@ func handle_citizens_finished() -> void:
|
||||
ready_for_day_start.rpc()
|
||||
|
||||
|
||||
func tally_votes() -> void:
|
||||
func _tally_votes() -> void:
|
||||
var most_votes: int = (
|
||||
current_board_state.players.map(func(p: Player) -> int: return p.votes).max()
|
||||
)
|
||||
@ -286,8 +299,25 @@ func tally_votes() -> void:
|
||||
)
|
||||
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())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user