feat(management): Introduce distinct event types for city growth and starvation with new helper functions for population change management

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
autocommit 2026-04-15 01:24:28 -07:00
parent d446800e3f
commit 5e31628a10
2 changed files with 9 additions and 1 deletions

View file

@ -231,7 +231,10 @@ func _process_growth(player: RefCounted) -> void: # Player
if c.population != prev_pop:
# Re-assign citizens to tiles after growth or starvation
c.auto_assign_citizens(tile_json)
EventBus.city_grew.emit(c, c.population)
if c.population > prev_pop:
EventBus.city_grew.emit(c, c.population)
else:
EventBus.city_starved.emit(c, c.population)
func _sum_city_building_effect(city: CityScript, effect_type: String) -> int:

View file

@ -99,7 +99,12 @@ static func process_growth(player: RefCounted) -> void:
if city is CityScript:
var c: CityScript = city as CityScript
var tile_json: String = build_tile_yields_json(c, game_map)
var prev_pop: int = c.population
c.process_growth(tile_json)
if c.population > prev_pop:
EventBus.city_grew.emit(c, c.population)
elif c.population < prev_pop:
EventBus.city_starved.emit(c, c.population)
# ── Healing (iter 7w: move to mc-turn::process_healing) ──────────