generated from krampus/template-godot4
fixes voting, desync, and various bugs
Some checks failed
linting & formatting / build (push) Failing after 19s
Some checks failed
linting & formatting / build (push) Failing after 19s
This commit is contained in:
parent
bf30002763
commit
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
|
||||
@ -67,7 +67,7 @@ func set_active_building(building: Building) -> void:
|
||||
|
||||
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 +84,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
|
||||
@ -117,7 +120,7 @@ func place_active_building() -> void:
|
||||
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
|
||||
@ -197,6 +200,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
|
||||
|
||||
@ -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"]
|
||||
|
||||
@ -4,6 +4,8 @@ class_name Building extends Node2D
|
||||
@export var player: Player:
|
||||
set = _set_player
|
||||
|
||||
@onready var bomb_sprite: Sprite2D = %BombSprite
|
||||
|
||||
var is_placing: bool = false:
|
||||
set(value):
|
||||
is_placing = value
|
||||
@ -45,6 +47,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)
|
||||
@ -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"]
|
||||
|
||||
@ -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"]
|
||||
|
||||
@ -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_destroyed: 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_destroyed"] = buildings_destroyed
|
||||
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_destroyed = data["buildings_destroyed"]
|
||||
result.citizens_starting_money = data["citizens_starting_money"]
|
||||
result.current_player = Player.deserialize(data["current_player"])
|
||||
for p in data["players"]:
|
||||
|
||||
@ -16,6 +16,7 @@ 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 BASE_DECK = [
|
||||
BANK_SCENE,
|
||||
@ -99,6 +100,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 +154,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,7 +164,11 @@ func cancel_placement() -> void:
|
||||
|
||||
|
||||
func start_day() -> void:
|
||||
if current_board_state.day > 0 and current_board_state.state != BoardState.State.PLACING_SPAWNS:
|
||||
if (
|
||||
current_board_state.day > 0
|
||||
and current_board_state.state != BoardState.State.PLACING_SPAWNS
|
||||
and current_board_state.state != BoardState.State.DESTROYING_BUILDINGS
|
||||
):
|
||||
current_board_state.players.sort_custom(
|
||||
func(p1: Player, p2: Player) -> bool: return p1.money > p2.money
|
||||
)
|
||||
@ -169,6 +176,11 @@ func start_day() -> void:
|
||||
|
||||
await all_players_ready_for_day_start
|
||||
|
||||
if current_board_state.state == BoardState.State.DESTROYING_BUILDINGS:
|
||||
if current_board_state.buildings_destroyed > 0:
|
||||
if current_board_state.current_player.id == Globals.game.this_player.id:
|
||||
print("here")
|
||||
|
||||
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:
|
||||
@ -182,11 +194,12 @@ func start_day() -> void:
|
||||
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(DEMOLITIONS_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 +231,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_destroyed = current_board_state.buildings_destroyed
|
||||
if (
|
||||
current_board_state.state != BoardState.State.DRAFT
|
||||
and current_board_state.state != BoardState.State.PLACING_SPAWNS
|
||||
@ -256,7 +270,7 @@ func handle_pass() -> void:
|
||||
advance_board_state.rpc(current_board_state.serialize())
|
||||
|
||||
|
||||
func reset_turn() -> void:
|
||||
func _reset_turn() -> void:
|
||||
pending_board_state = null
|
||||
update_board_state.rpc(original_board_state.serialize())
|
||||
|
||||
@ -266,7 +280,7 @@ func handle_citizens_finished() -> void:
|
||||
if child.get_groups().has("PostTurnActions"):
|
||||
child.handle_post_turn_actions()
|
||||
is_playing_day = false
|
||||
controls.reset_turn()
|
||||
controls._reset_turn()
|
||||
var winning_player_idx = current_board_state.players.find_custom(
|
||||
func(p: Player) -> bool: return p.money >= 100
|
||||
)
|
||||
@ -277,7 +291,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 +300,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_placements: int) -> void:
|
||||
current_board_state.spawn_placements += num_placements * current_board_state.players.size()
|
||||
current_board_state.state = BoardState.State.PLACING_SPAWNS
|
||||
|
||||
|
||||
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