Page 1 of 1

Unremovable armour

Posted: Thu Nov 10, 2022 11:57 pm
by PFQNiet
As part of my mod I want to create a piece of armour that cannot be removed - this is to allow having an equipment grid that you can place your actual equipment into.

To that end, I can give the player this armour item when they spawn/respawn, and replace it with its equipped items in their corpse on death.

What events do I need to listen to in order to reliably "undo" the player removing this armour?

I can detect removal via on_player_armor_inventory_changed, but where could the armour have gone? Is it sufficient just to check the cursor_stack and main inventory of the player that removed the armour? I'm thinking it may not be, as an admin could remove another player's armour.

I suppose I could just delete any armour that isn't in the armour inventory, and separately track which items were added to it, but that sounds error-prone and besides it would lead to things like batteries not keeping their charge.

Help? :D

Re: Unremovable armour

Posted: Fri Nov 11, 2022 1:26 am
by DaveMcW
Armor has a unique item_number you can use to identify it. You still need to search all the possible places for it to hide.