Unremovable armour

Place to get help with not working mods / modding interface.
PFQNiet
Filter Inserter
Filter Inserter
Posts: 289
Joined: Sat Sep 05, 2020 7:48 pm
Contact:

Unremovable armour

Post 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
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3724
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Unremovable armour

Post 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.
Post Reply

Return to “Modding help”