Author Topic: AI Mining ships arent mining  (Read 453 times)

Worthiestnobody

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    1
    • View Profile
on: September 10, 2019, 06:21:07 AM
so this is beta branch so this is probably something i discovered or everyone has but ive sent a ship of mine to go mine minerals and after i order it after a few seconds of pressing the button it dissappears, i dont know if the ship continues to mine afterwards or if something stopped it but i thought id let people know, if anyone asks it has a full compliment of crew including a captain a mining system upgrade perm installed and mining lasers.



randompsualumni

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    1
    • View Profile
on: September 20, 2019, 05:32:43 PM
I too have this issue.  It also occurs with salvaging ships and carriers.  Seems to occur after having completed one full mine or salvage target.  A work around is with  Raw turrets to set a Mine/Refine loop.   Not sure if this operation fix required a specific mod as I do have mods which create new orders.

I have tested this issue without mods and can confirm it is not due to mods.



Rinart73

  • Sr. Member
  • ****
  • Status:
    Offline
    Posts:
    371
  • Discord: Rinart73#7304
    • View Profile
on: September 21, 2019, 12:54:00 PM
I found the source of the problem.

For players: https://steamcommunity.com/sharedfiles/filedetails/?id=1868721180

For developers:
"data\scripts\entity\ai\mine.lua"
Replace "AIMine.canContinueMining()" function with this one:
Code: [Select]
function AIMine.canContinueMining() -- overridden
    -- prevent terminating script before it even started
    if not miningMaterial then return true end

    return valid(minedLoot) or valid(minedAsteroid) or not noAsteroidsLeft
end

Both orderchain.lua and mine.lua perform checks every second. There is a moment where a ship finished mining an asteroid and collected all loot, but didn't find the next asteroid yet. So the function returns "false" there and the orderchain stops the script.
 "canContinueMining" should return false only if there are no asteroids left.

The same thing for salvaging:
Code: [Select]
function AISalvage.canContinueSalvaging() -- overridden
    -- prevent terminating script before it even started
    if not salvagingMaterial then return true end

    return valid(minedLoot) or valid(minedWreckage) or not noWreckagesLeft
end
« Last Edit: September 21, 2019, 01:28:09 PM by Rinart73 »



FuryoftheStars

  • Full Member
  • ***
  • Status:
    Offline
    Posts:
    173
    • View Profile
on: September 24, 2019, 04:26:47 PM
I've noticed an issue like this, but only when issuing the order from the map screen (if I directly target and communicate with the ship and give the order via this method, it seems to work/stick).  Although I thought in my case it extended to all orders via the map screen, but I may be mistaken.  May be a different issue, anyway, not sure.



Zaflis

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    18
    • View Profile
on: October 15, 2019, 02:10:52 PM
Wish i could use your fix, but i still want ingame achievements to work. I can confirm miner stop mining when issued order from map. I then ordered it when in was in same sector and left alone for hour+, it filled its whole cargo hold then.

I suppose we can swap sectors from across galaxy now anyway when going in tiny ship. That way we can come in and make the manual order, and go back and continue what you were doing. It just means waiting 2 sector loading screens for a simple mine-command.