Unremovable armour
Posted: Thu Nov 10, 2022 11:57 pm
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?
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?