Jump to content

[MOD][FIX] AI-Ship salvages now all wreckages


JohnnySinclair

Recommended Posts

Hi there!

 

I've modified the ai-script-file "salvage.lua".

Now your captained salvage ship should break down all wreckages.

 

Server-Version: 0.11.0.7854

Usage: replace your orginal salvage.lua with the attached one

Path should be: ..\Steam\steamapps\common\Avorion\data\scripts\entity\ai

 

If you use a Dedi-Server, you have to replace the script-file there.

 

Reason for this MOD:

Sometimes (about 5-10%) generated wreckages do not have the property "material" e.g. Iron. You can check that by yourself by selecting wreckages that are not salvaged by your ai-ship / autotargeting salvage-laser. In this case the salvage script will not pick up this wreckages.

The original script is using "getEntitiesByComponent(ComponentType.MineableMaterial)" to find wreckages. This kind of wreckages are not listed there.

I've modified this line into "getEntitiesByType(EntityType.Wreckage)". Also I've commented out the part wich is checking if the wrackages have MinableResources.

 

[edit]

Because of the idea of Splutty I've edited the script again. Your Salvageship goes to "sleep" after all wreckages are salvaged. You'll be informed about this.

If a new wreckage appears your Salvageship goes back to work by itself. You'll be informed again.

Download in this post

[/edit]

 

o/

Johnny

 

PS: Does anyone know where the auto-turret scripts are in? ;)

 

salvage.lua.zip = this version just stops after work is done

salvage_restless.lua.zip = this version will search again and again for wreckages until you order something else

restore.ip = the origonal version of this file

salvage.lua.zip

restore.zip

Link to comment
Share on other sites

Another good adjustment of the script is removing these lines of code:

        ShipAI(ship.index):setPassive()
        ship:invokeFunction("craftorders.lua", "setAIAction")
        terminate()

 

Those will cause the ship to stop salvaging when there's nothing left, normally.

 

But you have to manually set them to salvage again. Removing these lines will keep them searching for salvage, so when any new salvage appears, they'll go right for it.

Link to comment
Share on other sites

In this case you would send the script in a endless loop with no breaks.

That should be a massive performance impact, shouldn't it?

 

Nevermind, I've made that changes and now I'm testing it.

 

Done, here it goes:

 

Hehe. I'll address the part you crossed out regardless. The check for salvageable materials happens every 'tick'. And yes, this is not ideal. The mods I run myself have variable ticks generally, depending on what's going on.

 

But in this case, it happens every second, so it's not that huge of an impact if there's nothing to actually find to salvage.

Link to comment
Share on other sites

  • 4 weeks later...

This is great, it annoyed me quite a lot that salvage lasers don't actually salvage stuff that's right in front of them.

Definitely going to try this!

 

This mod is great and clever, thank you for posting it! :)

But I'm pretty sure it doesn't solve your salvage laser problem, as it didn't solve mine either. Shame :(

 

Any luck finding the auto-turret AI script to do the same modification? :)

Link to comment
Share on other sites

  • 3 weeks later...

Thanks for the change in the salvage AI.

 

I did use your work to modify the Mining AI.  So far it work perfectly. And with the Regenerative Asteroid Fields,

it's a good way to have someone reset a whole mining area without having the others from your server forced to

come back to order their ships around.

 

 

 

 

 

Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...
  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...