It’s true that I’ve seen things in snippets of code that raise my hackles. I’m thinking specifically of the bit that checks if you’re right-clicking on a machine with a bucket of water, and removes any paint if you are.
Said code creates a new water bucket object on the heap every time you right-click on a machine, and compares the object to what you’re holding. While I don’t know the details of the API, there has to be a way to do that with a simple comparison against a constant. I.e. get the type ID, or call a method with the type ID as a parameter.