Avorion
评价数不足
Better Salvaging AI
   
奖励
收藏
已收藏
取消收藏
文件大小
发表于
更新日期
520.579 KB
8 月 28 日 下午 6:54
8 月 28 日 下午 6:58
2 项改动说明 ( 查看 )

订阅以下载
Better Salvaging AI

描述
BetterSalvagingAI is a mod for Avorion that enhances the salvage AI for ships, making it smarter about which wrecks to salvage and ensuring that valuable loot (like system modules and turrets) isn't left behind in the sector. The vanilla salvage AI often ignores small wrecks and doesn't collect floating loot items after salvaging is complete, leading to missed opportunities for resources and upgrades. This mod attempts to fix that by introducing dynamic resource thresholds for wrecks based on your current stockpile and automatically deploying cargo fighters to collect remaining loot when no more wrecks are viable.

Overall, you should notice much better wreck selection - AI should no longer be spending 10+ minutes at a wreck salvaging all the tiny pieces of one with minimal resources. This will ensure your time is well spent in those scrap yards as your ship/fighters maximize their salvage potential.

Key features:

Dynamic Wreck Skipping: Wrecks are skipped if their resource yield doesn't meet a threshold that scales with your existing stock of that material. For example:

If you have less than 100,000 of a material, wrecks with at least 10 of it are salvaged.
Between 100,000 and 1,000,000, the threshold is 500.
Over 1,000,000, the threshold is 1,000.
This prevents wasting time on low-yield wrecks when you're flush with resources but ensures you salvage everything when starting in a new region with higher-tier ores.


Automatic Loot Collection: Once all viable wrecks are salvaged, the AI deploys cargo fighters (if available) to collect any remaining modules, turrets, or other loot items in the sector using the built-in CollectLoot order.

Improved Status Reporting: The ship's AI status updates to "Collecting Loot" while fighters are out gathering items. Only when all loot is collected and fighters have returned does it switch to "Salvaging - No Wreckages Left."

Fighter Recall: Automatically recalls cargo fighters to the hangar once collection is complete.

Debugging Mode: Includes a toggleable debug mode (set debugging = true in the script) that outputs detailed chat messages about wreck evaluation, loot detection, and fighter activity for easy troubleshooting.

This mod is designed to make salvaging more efficient and less frustrating, especially in sectors with mixed wrecks and loot from battles. It's server-side only, so it works in multiplayer without requiring clients to install it.

Changes from Vanilla
The mod overrides two key functions in the base game's data/scripts/entity/ai/salvage.lua:

findObject:

Vanilla: Selects the nearest wreck with resources >= 10, prioritizing higher resources and closer distance, skipping docked or high-tier materials.

Mod: Adds dynamic thresholds per material based on player's stockpile, so low-yield wrecks are skipped intelligently. If no valid wrecks, checks for loot and deploys cargo fighters to collect it if present. Includes debugging for each step.


getAllHarvestedStatus:

Vanilla: Returns "Salvaging - No Wreckages Left" when no wrecks remain.

Mod: Checks for wrecks, loot, and active cargo fighters. Reports "Collecting Loot" if loot exists or fighters are collecting. Recalls fighters and resets state when done, then returns "Salvaging - No Wreckages Left." Includes sector-wide checks for wrecks and loot to ensure accuracy.

No other functions are modified or added, minimizing conflicts with other mods. The mod is fully compatible with Avorion 2.5.9 and should work with earlier versions, but testing is recommended.


Installation

Download the mod from Steam Workshop.
Subscribe to the mod in Steam, or manually place the folder in your Avorion mods directory (%AppData%\Avorion\mods on Windows).
The mod overrides data/scripts/entity/ai/salvage.lua, so enable it in your game's mod list.
For servers: Install on the server; clients don't need it.

Made with the assistance of xAI
Thumbnail image created by OpenAI