From 7a7001c96afdbe0e5d574337bec476f230692477 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Wed, 25 Nov 2026 15:41:21 +0400 Subject: feat(ai): construct clan factories, storage and laboratories Allow ORDER_ROBOT_BUILD to use the first BuildDat scheme for factories, storage and laboratories, with the existing technology and onboard-ore gates. Register completed factories for production and reset their free-build quota when a prepared slot is reused. Exclude reserved models from initial BAS cuts using the mission object count, preserving placed neutral buildings. Validation: fmt, workspace check and tests; ignored licensed stock-start test builds a factory in mission 29 and queues a transport there. Original Behavior.dll price calls confirm 670/770/560 ore for storage/factory/laboratory. Stock simulation also builds a laboratory; a validation-enabled window reaches the first factory. The new buildings were outside the player's window view; visual construction parity is not established. G7 still needs mine query 40, research transition 8, builder resupply and live BAS updates. --- apps/fparkan-game/src/main.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'apps/fparkan-game/src') diff --git a/apps/fparkan-game/src/main.rs b/apps/fparkan-game/src/main.rs index 96dfd756..72ee3c74 100644 --- a/apps/fparkan-game/src/main.rs +++ b/apps/fparkan-game/src/main.rs @@ -280,6 +280,7 @@ fn run(args: &[String]) -> Result { mission_assets, terrain, roots, + loaded.object_count, camera, args.static_animation_frame, args.static_material_phase, @@ -7632,16 +7633,6 @@ fn mission_basement_footprints( ) -> Result, String> { let mut footprints = Vec::new(); for (object_index, mission_root) in roots.iter().enumerate() { - // shortcut: newly built structures lack a live BAS cut until terrain can - // rebuild the affected cells when a building enters the world. - if mission_root.raw_after_resource == u32::MAX - && matches!( - mission_root.unit_dat_header_flags, - Some(0x8000_0004 | 0x8010_0000 | 0x8020_0000) - ) - { - continue; - } let Some(mode) = mission_root.basement_placement_mode() else { continue; }; @@ -8200,6 +8191,7 @@ fn static_preview_mesh_and_materials( assets: &MissionAssets, terrain: &TerrainWorld, roots: &[MissionObjectDraft], + placed_root_count: usize, legacy_camera: Option, static_animation_frame: Option, static_material_phase: Option, @@ -8245,7 +8237,9 @@ fn static_preview_mesh_and_materials( .filter(|face| face.flags.0 & 8 != 0 && face.flags.0 & 0x20000 == 0) .count(); eprintln!("render_coverage terrain_face8_pipeline_unverified={unverified_special_faces} (non-reflective source faces across LODs; native special-pass mapping pending)"); - let footprint_sources = mission_basement_footprints(assets, roots)?; + // shortcut: live construction needs terrain-cell rebuilding before it can cut BAS. + let footprint_sources = + mission_basement_footprints(assets, &roots[..placed_root_count.min(roots.len())])?; let foundation = if footprint_sources.is_empty() { None } else { @@ -14092,6 +14086,7 @@ mod tests { assets, terrain, roots, + loaded.object_count, None, None, None, @@ -15192,6 +15187,7 @@ mod tests { assets, terrain, roots, + loaded.object_count, None, None, None, @@ -15245,6 +15241,7 @@ mod tests { &MissionAssets::default(), &terrain, &[], + 0, None, None, None, -- cgit v1.2.3