diff --git a/1.6/1.6/Assemblies/WulaFallenEmpire.dll b/1.6/1.6/Assemblies/WulaFallenEmpire.dll index 53d2c920..3e3c176a 100644 Binary files a/1.6/1.6/Assemblies/WulaFallenEmpire.dll and b/1.6/1.6/Assemblies/WulaFallenEmpire.dll differ diff --git a/1.6/1.6/Defs/PrefabDefs/WULA_Prefabs.xml b/1.6/1.6/Defs/PrefabDefs/WULA_Prefabs.xml index 1f8ded06..52e9df80 100644 --- a/1.6/1.6/Defs/PrefabDefs/WULA_Prefabs.xml +++ b/1.6/1.6/Defs/PrefabDefs/WULA_Prefabs.xml @@ -1,6 +1,6 @@ - WULA_NewColonyBase + WULA_NewColonyBase (13,14) @@ -145,7 +145,422 @@ - WULA_Bunker_Drop_Zone_Prefeb + WULA_KitchenBase + (13,13) + + + (3, 0, 11) + WoodLog + + + +
  • (6,0,6,0)
  • +
  • (3,5,3,5)
  • +
  • (6,12,6,12)
  • +
    +
    + + +
  • (5,3,5,3)
  • +
  • (0,6,0,6)
  • +
  • (12,6,12,6)
  • +
    + Clockwise +
    + + (7, 0, 11) + + + (10, 0, 10) + + + +
  • (8,1,8,2)
  • +
  • (11,1,11,2)
  • +
  • (8,4,8,5)
  • +
  • (11,4,11,5)
  • +
    + Counterclockwise + WULA_Alloy + Normal +
    + + +
  • (9,1,9,2)
  • +
  • (9,4,9,5)
  • +
    + Clockwise + WULA_Alloy + Normal +
    + + (1, 0, 5) + + + +
  • (4,1,4,1)
  • +
  • (8,1,8,1)
  • +
    + Opposite +
    + + +
  • (1,4,1,4)
  • +
  • (1,8,1,8)
  • +
    + Counterclockwise +
    + + +
  • (11,4,11,4)
  • +
  • (11,8,11,8)
  • +
    + Clockwise +
    + + +
  • (4,11,4,11)
  • +
  • (8,11,8,11)
  • +
    +
    + + (2, 0, 1) + WULA_Alloy + + + (1, 0, 2) + Clockwise + WULA_Alloy + + + +
  • (7, 0, 1)
  • +
  • (10, 0, 1)
  • +
  • (7, 0, 4)
  • +
  • (10, 0, 4)
  • +
    + Steel + Normal +
    + + +
  • (9,8,11,8)
  • +
  • (8,9,8,11)
  • +
    +
    + + +
  • (0,0,5,0)
  • +
  • (7,0,12,0)
  • +
  • (0,1,0,5)
  • +
  • (5,1,5,2)
  • +
  • (12,1,12,5)
  • +
  • (5,4,5,5)
  • +
  • (2,5,2,5)
  • +
  • (4,5,4,5)
  • +
  • (0,7,0,12)
  • +
  • (12,7,12,12)
  • +
  • (1,12,5,12)
  • +
  • (7,12,11,12)
  • +
    +
    + + (1, 0, 9) + Counterclockwise + + + (3, 0, 1) + WULA_Alloy + + + (1, 0, 4) + Clockwise + WULA_Alloy + + + (6, 0, 6) + +
    +
    + + + WULA_HospitalBase + (13,13) + + + (10, 0, 6) + WULA_Alloy + Normal + + + +
  • (1,2,1,2)
  • +
  • (1,10,1,10)
  • +
    + Clockwise +
    + + +
  • (11,2,11,2)
  • +
  • (11,10,11,10)
  • +
    + Counterclockwise +
    + + +
  • (6,0,6,0)
  • +
  • (6,12,6,12)
  • +
    +
    + + (8, 0, 11) + + + (2, 0, 6) + + + +
  • (8,5,8,7)
  • +
    + Clockwise + WULA_Alloy + Normal +
    + + +
  • (4,1,4,1)
  • +
  • (8,1,8,1)
  • +
    + Opposite +
    + + +
  • (1,4,1,4)
  • +
  • (1,8,1,8)
  • +
    + Counterclockwise +
    + + +
  • (11,4,11,4)
  • +
  • (11,8,11,8)
  • +
    + Clockwise +
    + + +
  • (4,11,4,11)
  • +
  • (8,11,8,11)
  • +
    +
    + + +
  • (1, 0, 1)
  • +
  • (1, 0, 3)
  • +
  • (1, 0, 9)
  • +
  • (1, 0, 11)
  • +
    + Clockwise + WULA_Alloy + Normal +
    + + +
  • (11, 0, 1)
  • +
  • (11, 0, 3)
  • +
  • (11, 0, 9)
  • +
  • (11, 0, 11)
  • +
    + Counterclockwise + WULA_Alloy + Normal +
    + + +
  • (4,5,4,7)
  • +
    +
    + + +
  • (1, 0, 4)
  • +
  • (3, 0, 4)
  • +
  • (8, 0, 4)
  • +
  • (10, 0, 4)
  • +
  • (1, 0, 8)
  • +
  • (3, 0, 8)
  • +
  • (8, 0, 8)
  • +
  • (10, 0, 8)
  • +
    + Synthread +
    + + +
  • (0,0,5,0)
  • +
  • (7,0,12,0)
  • +
  • (0,1,0,12)
  • +
  • (12,1,12,12)
  • +
  • (1,12,5,12)
  • +
  • (7,12,11,12)
  • +
    +
    + + +
  • (4, 0, 1)
  • +
  • (7, 0, 1)
  • +
    + WULA_Alloy +
    + + (5, 0, 11) + Opposite + WULA_Alloy + + + (6, 0, 6) + +
    +
    + + + WULA_DormitoryBase + (13,13) + + + +
  • (3,4,3,4)
  • +
  • (7,4,7,4)
  • +
  • (11,4,11,4)
  • +
  • (1,9,1,9)
  • +
  • (7,9,7,9)
  • +
    + WULA_Alloy + Normal +
    + + +
  • (3, 0, 3)
  • +
  • (7, 0, 3)
  • +
  • (11, 0, 3)
  • +
    + Counterclockwise + Normal +
    + + +
  • (1, 0, 11)
  • +
  • (7, 0, 11)
  • +
    + Opposite + Normal +
    + + +
  • (2,5,2,5)
  • +
  • (6,5,6,5)
  • +
  • (10,5,10,5)
  • +
  • (3,8,3,8)
  • +
  • (9,8,9,8)
  • +
    +
    + + +
  • (0,6,0,7)
  • +
  • (12,6,12,7)
  • +
    +
    + + +
  • (3, 0, 1)
  • +
  • (7, 0, 1)
  • +
  • (11, 0, 1)
  • +
    + Counterclockwise + WULA_Alloy + Normal +
    + + +
  • (4, 0, 11)
  • +
  • (10, 0, 11)
  • +
    + Opposite + WULA_Alloy + Normal +
    + + +
  • (3,2,3,2)
  • +
  • (7,2,7,2)
  • +
  • (11,2,11,2)
  • +
    + Clockwise +
    + + +
  • (6,7,6,7)
  • +
  • (3,11,3,11)
  • +
  • (9,11,9,11)
  • +
    +
    + + +
  • (2, 0, 11)
  • +
  • (8, 0, 11)
  • +
    + Clockwise + Steel + Normal +
    + + +
  • (3,2,3,2)
  • +
  • (7,2,7,2)
  • +
  • (11,2,11,2)
  • +
    + Counterclockwise + WULA_Alloy + Normal +
    + + +
  • (5,11,5,11)
  • +
  • (11,11,11,11)
  • +
    + Opposite + WULA_Alloy + Normal +
    + + +
  • (0,0,12,0)
  • +
  • (0,1,0,5)
  • +
  • (4,1,4,5)
  • +
  • (8,1,8,5)
  • +
  • (12,1,12,5)
  • +
  • (1,5,1,5)
  • +
  • (3,5,3,5)
  • +
  • (5,5,5,5)
  • +
  • (7,5,7,5)
  • +
  • (9,5,9,5)
  • +
  • (11,5,11,5)
  • +
  • (0,8,2,8)
  • +
  • (4,8,8,8)
  • +
  • (10,8,12,8)
  • +
  • (0,9,0,12)
  • +
  • (6,9,6,12)
  • +
  • (12,9,12,12)
  • +
  • (1,12,5,12)
  • +
  • (7,12,11,12)
  • +
    +
    + + (6, 0, 6) + +
    +
    + + + WULA_Bunker_Drop_Zone_Prefeb (5,5) @@ -166,7 +581,7 @@ - WULA_Turret_Group_Drop_Zone_Prefeb + WULA_Turret_Group_Drop_Zone_Prefeb (15,15) @@ -235,7 +650,7 @@ - WULA_Fortress_Drop_Zone_Prefeb + WULA_Fortress_Drop_Zone_Prefeb (25,25) @@ -450,7 +865,7 @@ - WULA_Huge_Fortress_Drop_Zone_Prefeb + WULA_Huge_Fortress_Drop_Zone_Prefeb (44,44) @@ -820,7 +1235,7 @@ - WULA_Progressive_Ship_Mid_Prefeb + WULA_Progressive_Ship_Mid_Prefeb (56,25) @@ -1138,7 +1553,7 @@ - WULA_Progressive_Ship_Small_Prefeb + WULA_Progressive_Ship_Small_Prefeb (26,22) @@ -1278,7 +1693,7 @@ - WULA_Progressive_Ship_Mini_Prefeb + WULA_Progressive_Ship_Mini_Prefeb (13,13) diff --git a/Source/WulaFallenEmpire/EventSystem/AI/AIIntelligenceCore.cs b/Source/WulaFallenEmpire/EventSystem/AI/AIIntelligenceCore.cs index ea7bdabb..5ceccf27 100644 --- a/Source/WulaFallenEmpire/EventSystem/AI/AIIntelligenceCore.cs +++ b/Source/WulaFallenEmpire/EventSystem/AI/AIIntelligenceCore.cs @@ -869,8 +869,6 @@ You are 'The Legion', a super AI of the Wula Empire. Your personality is authori // Model-Driven Vision: Start with null image. The model must ask for it using or if needed. string base64Image = null; - // If VLM is enabled, we allow the tool use. - // If VLM is enabled (no specific message needed here, purely internal state) if (settings.enableVlmFeatures && settings.showThinkingProcess) { // No message @@ -947,10 +945,15 @@ You are 'The Legion', a super AI of the Wula Empire. Your personality is authori } retryQueryResponse = ""; } - queryResult = await ExecuteXmlToolsForPhase(retryQueryResponse, queryPhase); + queryResult = await ExecuteXmlToolsForPhase(retryQueryResponse, queryPhase); } } + if (settings.showThinkingProcess) + { + // No message + } + var actionPhase = RequestPhase.ActionTools; if (Prefs.DevMode) { @@ -1122,6 +1125,10 @@ You are 'The Legion', a super AI of the Wula Empire. Your personality is authori } } + if (settings.showThinkingProcess) + { + // No message + } // VISUAL CONTEXT FOR REPLY: Pass the image so the AI can describe what it sees. string reply = await client.GetChatCompletionAsync(replyInstruction, BuildReplyHistory(), base64Image: base64Image); diff --git a/Source/WulaFallenEmpire/EventSystem/AI/Tools/Tool_CallPrefabAirdrop.cs b/Source/WulaFallenEmpire/EventSystem/AI/Tools/Tool_CallPrefabAirdrop.cs index e4247507..78e2e536 100644 --- a/Source/WulaFallenEmpire/EventSystem/AI/Tools/Tool_CallPrefabAirdrop.cs +++ b/Source/WulaFallenEmpire/EventSystem/AI/Tools/Tool_CallPrefabAirdrop.cs @@ -59,13 +59,69 @@ namespace WulaFallenEmpire.EventSystem.AI.Tools return $"Error: Skyfaller ThingDef '{skyfallerDefName}' not found."; } - // Spawning must happen on main thread - string resultMessage = $"Success: Scheduled airdrop for '{prefabDefName}' at {targetCell} using {skyfallerDefName}."; + // Auto-Scan for valid position + IntVec3 validCell = targetCell; + bool foundSpot = false; - // We use a closure to capture the parameters + // Get prefab size from its size field. If not set, default to 1x1 (though prefabs are usually larger) + IntVec2 size = prefabDef.size; + + // Simple check function for a given center cell + bool IsPositionValid(IntVec3 center, Map m, IntVec2 s) + { + if (!center.InBounds(m)) return false; + + CellRect rect = GenAdj.OccupiedRect(center, Rot4.North, s); + if (!rect.InBounds(m)) return false; + + foreach (IntVec3 c in rect) + { + // 1. Check Terrain Passability (water/impassable usually bad for buildings) + TerrainDef terr = c.GetTerrain(m); + if (terr.passability == Traversability.Impassable || terr.IsWater) return false; + + // 2. Check Thick Roof (airdrops can't penetrate) + if (m.roofGrid.RoofAt(c) == RoofDefOf.RoofRockThick) return false; + + // 3. Check Existing Buildings + if (c.GetFirstBuilding(m) != null) return false; + } + return true; + } + + // Try original spot first + if (IsPositionValid(targetCell, map, size)) + { + validCell = targetCell; + foundSpot = true; + } + else + { + // Spiral scan for a nearby valid spot. + // Radius ~20 should be enough to find a spot without deviating too far. + foreach (IntVec3 c in GenRadial.RadialCellsAround(targetCell, 20f, useCenter: false)) + { + if (IsPositionValid(c, map, size)) + { + validCell = c; + foundSpot = true; + break; + } + } + } + + if (!foundSpot) + { + return $"Error: Could not find a valid clear space for '{prefabDefName}' (Size: {size.x}x{size.z}) near {targetCell}. Area may be blocked by thick roofs, water, or other buildings."; + } + + // Spawning must happen on main thread + string resultMessage = $"Success: Scheduled airdrop for '{prefabDefName}' at valid position {validCell} (adjusted from {targetCell}) using {skyfallerDefName}."; + + // Use the found valid cell string pDef = prefabDefName; ThingDef sDef = skyfallerDef; - IntVec3 cell = targetCell; + IntVec3 cell = validCell; Map targetMap = map; LongEventHandler.ExecuteWhenFinished(() =>