refactor(world-map): ♻️ Rename display_name to name_display for consistency in WorldMap and Unit classes
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
af174c308a
commit
fee70d5b0b
2 changed files with 12 additions and 5 deletions
|
|
@ -438,8 +438,8 @@ func _check_village_discovery(axial: Vector2i) -> void:
|
|||
|
||||
func _show_unit_panel(unit: RefCounted) -> void:
|
||||
var display_name: String = ThemeVocabulary.lookup(unit.type_id)
|
||||
if unit.name != "" and unit.name != unit.type_id:
|
||||
display_name = unit.name
|
||||
if unit.display_name != "" and unit.display_name != unit.type_id:
|
||||
display_name = unit.display_name
|
||||
var stats: String = (
|
||||
"HP: %d/%d ATK: %d DEF: %d" % [unit.hp, unit.max_hp, unit.attack, unit.defense]
|
||||
)
|
||||
|
|
|
|||
|
|
@ -102,9 +102,16 @@ func _populate_from_data() -> void:
|
|||
unit_type = data.get("combat_type", "")
|
||||
if display_name.is_empty():
|
||||
display_name = data.get("name", unit_id.capitalize())
|
||||
var keywords: Array = data.get("keywords", [])
|
||||
can_found_city = "found_city" in keywords or unit_type == "settler"
|
||||
can_build_improvements = "build" in keywords or unit_type == "worker"
|
||||
var is_founder: bool = (
|
||||
unit_id.contains("founder") or unit_id.contains("settler")
|
||||
)
|
||||
can_found_city = data.get("can_found_city", is_founder)
|
||||
var is_builder: bool = (
|
||||
unit_id.contains("worker") or unit_id.contains("engineer")
|
||||
)
|
||||
can_build_improvements = data.get(
|
||||
"can_build_improvements", is_builder
|
||||
)
|
||||
|
||||
|
||||
# ── Per-turn refresh (called by turn_processor.gd) ────────────────────
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue