feat(management): ✨ Implement Rust-based turn processing and GDScript-Rust API extensions for optimized turn-based logic execution
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
0230833324
commit
e2e0e1445d
2 changed files with 12 additions and 4 deletions
|
|
@ -276,7 +276,7 @@ func _apply_building_bonuses(city: CityScript, building_id: String) -> void:
|
|||
func _process_city_healing(player: RefCounted) -> void:
|
||||
for city_ref: Variant in player.cities:
|
||||
if city_ref is CityScript:
|
||||
(city_ref as CityScript).heal_per_turn()
|
||||
(city_ref as CityScript).heal_per_turn(GameState.turn_number)
|
||||
|
||||
|
||||
func _process_healing(player: RefCounted) -> void: # Player
|
||||
|
|
|
|||
|
|
@ -1251,10 +1251,18 @@ impl GdCity {
|
|||
self.inner.heal(amount.max(0) as u32);
|
||||
}
|
||||
|
||||
/// Heal the city by the standard per-turn amount (20 HP). Skips destroyed cities.
|
||||
/// Heal the city by the standard per-turn amount (20 HP). Skips destroyed
|
||||
/// cities and cities recently attacked (see mc_city::City::heal_per_turn).
|
||||
#[func]
|
||||
fn heal_per_turn(&mut self) {
|
||||
self.inner.heal_per_turn();
|
||||
fn heal_per_turn(&mut self, current_turn: i64) {
|
||||
self.inner.heal_per_turn(current_turn.max(0) as u32);
|
||||
}
|
||||
|
||||
/// Mark the city as having taken combat damage on `turn`. Call when a
|
||||
/// combat result assigns non-zero city damage.
|
||||
#[func]
|
||||
fn mark_attacked(&mut self, turn: i64) {
|
||||
self.inner.mark_attacked(turn.max(0) as u32);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue