add additional fields to builder selection menu

pull/18/head
Wade 2025-05-07 15:22:51 +07:00
parent 119e0af3fa
commit a72688fa1c
11 changed files with 30 additions and 15 deletions

@ -80,22 +80,36 @@ func _populate_menu():
#popup.add_item(category_name, -1)
#popup.set_item_disabled(popup.item_count - 1, true)
# Add the structure item with price in the name
# Create the item text with structure info
var item_text = structure.title
# Create info section for price, population, and energy
var info_parts = []
# Add price if available
if structure.price > 0:
item_text += " ($" + str(structure.price) + ")"
info_parts.append("$" + str(structure.price))
# Add population count
if structure.population_count > 0:
info_parts.append("+" + str(structure.population_count) + " pop")
# Add energy usage and production
if structure.kW_usage > 0:
info_parts.append("-" + str(structure.kW_usage) + " kW")
if structure.kW_production > 0:
info_parts.append("+" + str(structure.kW_production) + " kW")
# Add the info parts to the item text
if info_parts.size() > 0:
item_text += " (" + " | ".join(info_parts) + ")"
# Add lock/unlock icon if we're showing all structures
if not structure.unlocked:
if _lock_icon:
popup.add_icon_item(_lock_icon, item_text)
popup.set_item_disabled(popup.item_count - 1, true)
else:
popup.add_item(item_text, i)
# Handle the menu item selection
func _on_item_selected(id: int):

@ -14,7 +14,7 @@ population_count = 0
kW_usage = 0.0
kW_production = 0.0
selector_scale = 2.8
unlocked = false
unlocked = true
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,7 @@ population_count = 0
kW_usage = 0.0
kW_production = 0.0
selector_scale = 2.8
unlocked = false
unlocked = true
spawn_builder = false
description = "Some cool trees and grass!"
thumbnail = "res://sprites/updated/grass-trees.png"

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

@ -14,7 +14,7 @@ population_count = 0
kW_usage = 0.0
kW_production = 0.0
selector_scale = 2.8
unlocked = false
unlocked = true
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,7 @@ population_count = 0
kW_usage = 0.0
kW_production = 0.0
selector_scale = 2.8
unlocked = false
unlocked = true
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,7 @@ population_count = 0
kW_usage = 0.0
kW_production = 0.0
selector_scale = 2.8
unlocked = false
unlocked = true
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"

@ -4,6 +4,7 @@
[ext_resource type="Script" uid="uid://uxn26t1x4ehr" path="res://scripts/structure.gd" id="2_3eq5k"]
[resource]
resource_local_to_scene = true
script = ExtResource("2_3eq5k")
title = "Intersection"
type = 0

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

@ -14,7 +14,7 @@ population_count = 0
kW_usage = 0.0
kW_production = 0.0
selector_scale = 2.8
unlocked = false
unlocked = true
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,7 @@ population_count = 0
kW_usage = 1.0
kW_production = 0.0
selector_scale = 2.8
unlocked = false
unlocked = true
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"