feat(api-gdext): ✨ Add Rust bindings for yield registration (food/energy) and expose GDScript functions to manage city yields
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
c6d22a99a0
commit
5d57679df1
1 changed files with 14 additions and 0 deletions
|
|
@ -818,6 +818,20 @@ impl GdCity {
|
|||
self.inner.has_building(&building.to_string())
|
||||
}
|
||||
|
||||
/// Register a building's flat yield bonuses. GDScript passes the
|
||||
/// five per-turn bonuses parsed from the building JSON's `effects` array.
|
||||
/// The city applies these in `get_yields` for each owned building.
|
||||
#[func]
|
||||
fn register_building_yields(
|
||||
&mut self, building: GString,
|
||||
food: f64, production: f64, gold: f64, culture: f64, science: f64,
|
||||
) {
|
||||
self.inner.register_building_yields(
|
||||
building.to_string(),
|
||||
mc_city::CityYields { food, production, gold, culture, science },
|
||||
);
|
||||
}
|
||||
|
||||
/// Load items from a JSON array `[ { id, production: { building, secondary_building?,
|
||||
/// production_cost, materials?, requires_tech? }, ... }, ... ]`. The DataLoader passes
|
||||
/// the merged item list from `public/resources/items/*.json`. Items without a
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue