fix(@projects/@magic-civilization): 🐛 adjust science yield calculation
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
9c10a90075
commit
fdcf67801c
1 changed files with 8 additions and 1 deletions
|
|
@ -512,6 +512,11 @@ static func _refresh_learned_player_snapshot(gd_state: RefCounted) -> void:
|
|||
# matching the `cy["food"]`/`cy["production"]` semantics.
|
||||
var game_map: RefCounted = GameState.get_game_map()
|
||||
var city_dicts: Array[Dictionary] = []
|
||||
# p1-29k Inc-2.5b — accumulate real per-turn science from the SAME
|
||||
# `cy["science"]` the autoplay economy uses (`_calculate_science_income`
|
||||
# = sum of city `get_yields()["science"]`; `PlayerScript.science_per_turn`
|
||||
# is 0 in the live world — science is computed per-turn, not cached).
|
||||
var science_total: int = 0
|
||||
for c: RefCounted in p.cities:
|
||||
if c == null:
|
||||
continue
|
||||
|
|
@ -527,6 +532,7 @@ static func _refresh_learned_player_snapshot(gd_state: RefCounted) -> void:
|
|||
if not cy.is_empty():
|
||||
food_yield = int(round(float(cy.get("food", 2))))
|
||||
prod_yield = int(round(float(cy.get("production", 2))))
|
||||
science_total += int(round(float(cy.get("science", 0))))
|
||||
city_dicts.append({
|
||||
"col": c_off.x,
|
||||
"row": c_off.y,
|
||||
|
|
@ -551,9 +557,10 @@ static func _refresh_learned_player_snapshot(gd_state: RefCounted) -> void:
|
|||
# divergence after yields + tech. GDScript `science_per_turn` maps to
|
||||
# the Rust `science_yield` obs input.
|
||||
if gd_state.has_method("set_player_economy_from_dict"):
|
||||
var base_sci: int = int(p.get("science_per_turn")) if p.get("science_per_turn") != null else 0
|
||||
gd_state.set_player_economy_from_dict(pi, {
|
||||
"gold": int(p.get("gold")) if p.get("gold") != null else 0,
|
||||
"science_yield": int(p.get("science_per_turn")) if p.get("science_per_turn") != null else 0,
|
||||
"science_yield": base_sci + science_total,
|
||||
"culture_total": int(p.get("culture_total")) if p.get("culture_total") != null else 0,
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue