Okay! Ran this and it all seems perfect apart from one thing... It doesn't repair broken struts, you could make it so if it's broke you get the hammer from the crate, fix the broken strut, drop hammer then collects loot.
I have re-started the script with a hammer already in my invent, just to test if this works. Will post result