luvies / TaledensInvManagerUpdated

The code base for my unofficial update of Taleden's Inventory Manager
25 stars 28 forks source link

Modded Fixed Guns Can't Be Sorted #11

Open CovertJaguar opened 6 years ago

CovertJaguar commented 6 years ago

A lot of modded fixed gun blocks are under the hood SmallMissileLaunchers. Because of this, TIM assumes they have no conveyor ports and ignores them. This logic could use some improvement as its not currently possible to use TIM to manage ammo for these weapons.

https://github.com/Gorea235/TaledensInvManagerUpdated/blob/master/src/Script.cs#L1546

if ((block is IMySmallMissileLauncher & !(block is IMySmallMissileLauncherReload | block.BlockDefinition.SubtypeName == "LargeMissileLauncher")) | block is IMyLargeInteriorTurret)
{
         // can't sort with no conveyor port
        invenLocked.Add(block.GetInventory(0));
}

https://github.com/Gorea235/TaledensInvManagerUpdated/blob/master/src/Script.cs#L2048

else if (!block.HasInventory | (block is IMySmallMissileLauncher & !(block is IMySmallMissileLauncherReload | block.BlockDefinition.SubtypeName == "LargeMissileLauncher")) | block is IMyLargeInteriorTurret)
{
    name.Append(String.Join(":", fields).ToLower() + " ");
    debugText.Add("Cannot sort items to " + block.CustomName + ": no conveyor-connected inventory");
}
swhutchings commented 6 years ago

I was about to submit this too. I haven't tested it thoroughly yet and intend to do so when I have some time, but I'm pretty sure they can just be removed without any adverse effects (but keep the check to see if the block doesn't have an inventory). When the script attempts to move something into them it seems to gracefully fail in the same manner as if the same thing was attempted with the GUI. To maintain the behaviour for vanilla blocks you could just compare the SubtypeName as is done for the LargeMissileLauncher.

luvies commented 6 years ago

I can look at a short-term bodge to fix this, but I will keep it in mind when working on #10. I'll likely not hard-code unsortable blocks in that update, meaning that this should become a non-issue.

mikeloeven commented 6 years ago

Have you tried using the FORCE flag?