Fix up menu more and updated icons. TODO need to see why when I select some structures they don't change in the builder.

pull/18/head
Wade 2025-05-08 15:04:32 +07:00
parent 1fb3576f88
commit d189092989
22 changed files with 47 additions and 64 deletions

@ -112,7 +112,8 @@ func _populate_menu():
popup.add_icon_item(_lock_icon, item_text)
popup.set_item_disabled(popup.item_count - 1, true)
else:
popup.add_item(item_text, i)
var icon = load(structure.icon) if ResourceLoader.exists(structure.icon) else null
popup.add_icon_item(icon, item_text)
# Handle the menu item selection
func _on_item_selected(id: int):

@ -166,7 +166,7 @@ func _create_filter_buttons():
# Get unique structure types
var structure_types = {}
for structure in builder.get_structures():
if structure.type == Structure.StructureType.TERRAIN:
if structure.type == Structure.StructureType.LANDSCAPE:
structure_types["Ground"] = true
else:
structure_types["Buildings"] = true
@ -216,14 +216,14 @@ func _create_option_buttons():
if current_filter != "All":
match current_filter:
"Ground":
if structure.type != Structure.StructureType.TERRAIN:
if structure.type != Structure.StructureType.LANDSCAPE:
continue
"Buildings":
if structure.type == Structure.StructureType.TERRAIN:
if structure.type == Structure.StructureType.LANDSCAPE:
continue
# Add to appropriate list
if structure.type == Structure.StructureType.TERRAIN:
if structure.type == Structure.StructureType.LANDSCAPE:
ground_structures.append(structure)
else:
building_structures.append(structure)

@ -39,6 +39,10 @@ enum SizeCategory {
@export_subgroup("Visual")
@export var selector_scale:float = 1.0 # Scale factor for the selector when this structure is selected
@export var thumbnail: String = "Thumbnail" # Display for player
@export var icon: String = "" # Small version of thumbnail. I know thumbnail should be small... But I messed up already so here we are xD.
@export_subgroup("Game Progression")
@export var unlocked:bool = false # Whether this structure is available to the player
@ -48,7 +52,3 @@ enum SizeCategory {
@export_subgroup("Game Progression")
@export var description: String = "Description" # Whether this structure is available to the player
@export_subgroup("Game Progression")
@export var thumbnail: String = "Thumbnail" # Whether this structure is available to the player

Binary file not shown.

Before

Width:  |  Height:  |  Size: 244 KiB

@ -1,34 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://3wvmf0xvpx53"
path="res://.godot/imported/power-plant.png-ab18836cf433027f79b47cfc0a22f79a.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/updated/power-plant.png"
dest_files=["res://.godot/imported/power-plant.png-ab18836cf433027f79b47cfc0a22f79a.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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.

Before

Width:  |  Height:  |  Size: 267 KiB

After

Width:  |  Height:  |  Size: 120 KiB

@ -14,7 +14,8 @@ population_count = 0
kW_usage = 0.0
kW_production = 0.0
selector_scale = 2.8
thumbnail = "res://sprites/updated/garage.png"
icon = "res://sprites/updated/icon/garage_icon.png"
unlocked = false
spawn_builder = true
description = "Garage"
thumbnail = "res://sprites/updated/garage.png"

@ -14,7 +14,8 @@ population_count = 1
kW_usage = 1.0
kW_production = 0.0
selector_scale = 2.8
thumbnail = "res://sprites/updated/building-small-a.png"
icon = "res://sprites/updated/icon/building-small-a_icon.png"
unlocked = false
spawn_builder = false
spawn_builder = true
description = "A small residential building that can house 1 person. Perfect for getting your city started!"
thumbnail = "res://sprites/updated/building-small-a.png"

@ -7,14 +7,15 @@
script = ExtResource("2_a2t3e")
title = "Medium Residential"
type = 1
price = 60
price = 100
size_category = 1
model = ExtResource("1_klt7o")
population_count = 10
kW_usage = 1.0
kW_production = 0.0
selector_scale = 2.8
thumbnail = "res://sprites/updated/building-small-b.png"
icon = "res://sprites/updated/icon/building-small-b_icon.png"
unlocked = false
spawn_builder = false
description = "A slightly larger residential building that can house 1 person. A good upgrade from the basic house!"
thumbnail = "res://sprites/updated/building-small-b.png"

@ -7,14 +7,15 @@
script = ExtResource("2_rkiq0")
title = "Large Residential"
type = 1
price = 70
price = 200
size_category = 2
model = ExtResource("1_6yyww")
population_count = 20
kW_usage = 1.0
kW_production = 0.0
selector_scale = 2.8
thumbnail = "res://sprites/updated/building-small-c.png"
icon = "res://sprites/updated/icon/building-small-c_icon.png"
unlocked = false
spawn_builder = true
description = "A spacious multi-story apartment complex that comfortably houses 5 citizens, providing efficient population growth for your expanding city."
thumbnail = "res://sprites/updated/building-small-c.png"

@ -7,14 +7,15 @@
script = ExtResource("2_b2sah")
title = "Tall Trees"
type = 5
price = 25
price = 50
size_category = 0
model = ExtResource("1_nbdd1")
population_count = 0
kW_usage = 0.0
kW_production = 0.0
selector_scale = 2.8
thumbnail = "res://sprites/updated/grass-trees-tall.png"
icon = "res://sprites/updated/icon/grass-trees-tall_icon.png"
unlocked = false
spawn_builder = false
description = "A lush area featuring small trees that provides shade, clean air, and a pleasant atmosphere for nearby residents."
thumbnail = "res://sprites/updated/grass-trees-tall.png"

@ -14,7 +14,8 @@ population_count = 0
kW_usage = 0.0
kW_production = 0.0
selector_scale = 2.8
thumbnail = "res://sprites/updated/grass-trees.png"
icon = "res://sprites/updated/icon/grass-trees_icon.png"
unlocked = false
spawn_builder = false
description = "Some cool trees and grass!"
thumbnail = "res://sprites/updated/grass-trees.png"

@ -14,7 +14,8 @@ population_count = 0
kW_usage = 0.0
kW_production = 0.0
selector_scale = 2.8
thumbnail = "res://sprites/updated/grass.png"
icon = "res://sprites/updated/icon/grass_icon.png"
unlocked = false
spawn_builder = false
description = "Some lush green grass!"
thumbnail = "res://sprites/residential/grass.png"

@ -14,7 +14,8 @@ population_count = 0
kW_usage = 0.0
kW_production = 0.0
selector_scale = 2.8
thumbnail = "res://sprites/updated/fountain.png"
icon = "res://sprites/updated/icon/fountain_icon.png"
unlocked = false
spawn_builder = false
description = "A beautiful centerpiece that adds charm to your city while providing citizens with a place to relax and socialize."
thumbnail = "res://sprites/updated/fountain.png"

@ -14,7 +14,8 @@ population_count = 0
kW_usage = 0.0
kW_production = 0.0
selector_scale = 2.8
thumbnail = "res://sprites/updated/icon/pavement_icon.png"
icon = "res://sprites/updated/icon/pavement_icon.png"
unlocked = false
spawn_builder = false
description = "A pedestrian-friendly surface that creates walkable areas and enhances the appearance of your city spaces."
thumbnail = "res://sprites/updated/pavement.png"

@ -14,7 +14,8 @@ population_count = 0
kW_usage = 0.0
kW_production = 40.0
selector_scale = 2.8
thumbnail = "res://sprites/updated/power_plant.png"
icon = "res://sprites/updated/icon/power_plant_icon.png"
unlocked = false
spawn_builder = false
description = "A power-generating facility that produces electricity to keep your city's buildings operational and citizens happy. Produces 40 kW of energy."
thumbnail = "res://sprites/updated/power-plant.png"

@ -14,7 +14,8 @@ population_count = 0
kW_usage = 0.0
kW_production = 0.0
selector_scale = 2.8
thumbnail = "res://sprites/roads/road-corner.png"
icon = "res://sprites/roads/icon/road-corner_icon.png"
unlocked = false
spawn_builder = false
description = "A gently curved road section that helps create more natural and flowing city layouts."
thumbnail = "res://sprites/roads/road-corner.png"

@ -14,7 +14,8 @@ population_count = 0
kW_usage = 0.0
kW_production = 0.0
selector_scale = 2.8
thumbnail = "res://sprites/roads/intersection.png"
icon = "res://sprites/roads/icon/intersection_icon.png"
unlocked = false
spawn_builder = false
description = "A crucial junction where roads meet, allowing traffic to flow in multiple directions throughout your city."
thumbnail = "res://sprites/updated/road-intersection.png"

@ -14,7 +14,8 @@ population_count = 0
kW_usage = 0.0
kW_production = 0.0
selector_scale = 2.8
thumbnail = "res://sprites/updated/road-split.png"
icon = "res://sprites/updated/icon/road-split_icon.png"
unlocked = false
spawn_builder = false
description = "Road Split"
thumbnail = "res://sprites/updated/road-split.png"

@ -14,7 +14,8 @@ population_count = 0
kW_usage = 0.0
kW_production = 0.0
selector_scale = 2.8
thumbnail = "res://sprites/updated/icon/road-straight-light_icon.png"
icon = "res://sprites/updated/icon/road-straight-light_icon.png"
unlocked = false
spawn_builder = false
description = "An illuminated road segment that provides safety and visibility for your citizens at night."
thumbnail = "res://sprites/updated/road-straight-light.png"

@ -14,7 +14,8 @@ population_count = 0
kW_usage = 0.0
kW_production = 0.0
selector_scale = 2.8
unlocked = false
thumbnail = "res://sprites/updated/road-straight.png"
icon = "res://sprites/updated/icon/road-straight_icon.png"
unlocked = true
spawn_builder = false
description = "A basic road for connecting parts of your city."
thumbnail = "res://sprites/updated/road-straight.png"

@ -14,7 +14,8 @@ population_count = 0
kW_usage = 1.0
kW_production = 0.0
selector_scale = 2.8
thumbnail = "res://sprites/updated/store.png"
icon = "res://sprites/updated/icon/store_icon.png"
unlocked = false
spawn_builder = true
description = "A commercial building where citizens can purchase goods, providing essential services while generating income for your city."
thumbnail = "res://sprites/updated/store.png"