Hmm, this is actually kind of ahead in my to-do list, so I haven’t mucked with layering equipped items yet. BUT I think, if you aren’t too shy about writing a bit of code, it should be possible. DIsclaimer: everything that follows this paragraph is the result of personal research. It may be off, it may be outright wrong, Radiant or other modders feel free to correct me.
All items that are currently equippable on a hearthling, items that exist somewhat separately of the hearthling himself (i.e. weapons, armor) are addressed by their “equipment slot”. For example, armor goes into the torso equipment slot, shields go to offhand, weapons go to mainhand, etc. So in theory, making a new type of equippable item is as easy as defining a new slot, and using that.
In practice, I think making a completely new equipment slot would be challenging. To seed your mod, I’d start out by making the potion a hand-held item like a shield, used in place of a shield. It sounds like you already know how to do that. The harder part will definitely be doing all the conditional things – drinking health potions when low on health, strength potions when fighting highly armored enemy, toughness potions when fighting high-hitting enemies… You will need to study the Combat Component closely.
A personal aside: it is better to start and falter than never start at all, especially with modding SH. I’ve written one “mod” in 2015 or 14 or something stupid, it was literally a craftable armor with a buff. After that, I got a big head, and decided to sink my teeth into something far more challenging – I wanted to make a new Engineer turret that you’d manually set a target for, that the Engineer would make special ammo for, run up to it, load it and rotate it towards the target when you gave the order; he’d fire it, and the projectile would travel in an arc towards the target and strike it.
I got as far as having a UI for targeting the cannon, and making an engineer run up to it and it rotate towards the firing spot when I gave the order. Which was pretty impressive IMHO in its own way, I celebrated pretty hard when I got that to work. But once I got to the code which dealt with firing the projectile and drawing a pretty gravity’s rainbow… let’s just say I never took university level math, and I’m really feeling the pain. The mod was never finished. I was greatly discouraged from modding SH, as I started to appreciate the huge array of skills required to do so efficiently.
However, after a while of updates and me getting back in the game and getting annoyed with the difficulty of constructing a megaproject, I had this relatively simple idea for a miner. I coded it up in 2 days and released it. I would never have been able to do so if I didn’t “waste” all that time writing that cannon mod. The cannon mod was freaking difficult, in fact impossible for my skill level, but even though I didn’t hit it, aiming at the moon landed me on a mountaintop. It taught me how to use components, how to create and communicate custom events between the client and the server, what the client and the server even are in the context of SH, the depth of their separation, etc etc. And it still took me 2 days to code just the basics, AND bothering a bunch of people to help me with what I thought would be a simple job. I’m sure that if I didn’t make the cannon mod and started with the Miner, I’d abandon it just like I did with the cannon, but learn that much less about the game.
tl;dr it’s tough but go for it.