diff --git a/code/datums/components/material/material_container.dm b/code/datums/components/material/material_container.dm index b69ae91825e..69f67d46df3 100644 --- a/code/datums/components/material/material_container.dm +++ b/code/datums/components/material/material_container.dm @@ -275,10 +275,9 @@ var/inserted = 0 //All messages to be displayed to chat var/list/chat_msgs = list() - //differs from held_item when using TK var/active_held = user.get_active_held_item() - + //storage items to retrive items from var/static/list/storage_items if(isnull(storage_items)) storage_items = list( @@ -288,7 +287,7 @@ ) //1st iteration consumes all items that do not have contents inside - //2nd iteration consumes items who do have contents inside(but they were consumed in the 1st iteration si its empty now) + //2nd iteration consumes items who do have contents inside(but they were consumed in the 1st iteration so its empty now) for(var/i in 1 to 2) //no point inserting more items if(inserted == MATERIAL_INSERT_ITEM_NO_SPACE) @@ -311,15 +310,11 @@ //can't allow abstract, hologram items if((target_item.item_flags & ABSTRACT) || (target_item.flags_1 & HOLOGRAM_1)) continue - //untouchable, move it out the way, code copied from recycler - if(target_item.resistance_flags & INDESTRUCTIBLE) - target_item.forceMove(get_turf(parent)) - continue //user defined conditions if(SEND_SIGNAL(src, COMSIG_MATCONTAINER_PRE_USER_INSERT, target_item, user) & MATCONTAINER_BLOCK_INSERT) continue - //item is either not allowed for redemption, not in the allowed types - if((target_item.item_flags & NO_MAT_REDEMPTION) || (allowed_item_typecache && !is_type_in_typecache(target_item, allowed_item_typecache))) + //item is either indestructible, not allowed for redemption or not in the allowed types + if((target_item.resistance_flags & INDESTRUCTIBLE) || (target_item.item_flags & NO_MAT_REDEMPTION) || (allowed_item_typecache && !is_type_in_typecache(target_item, allowed_item_typecache))) if(!(mat_container_flags & MATCONTAINER_SILENT) && i == 1) //count only child items the 1st time around var/list/status_data = chat_msgs["[MATERIAL_INSERT_ITEM_FAILURE]"] || list() var/list/item_data = status_data[target_item.name] || list() @@ -327,6 +322,10 @@ status_data[target_item.name] = item_data chat_msgs["[MATERIAL_INSERT_ITEM_FAILURE]"] = status_data + if(target_item.resistance_flags & INDESTRUCTIBLE) + if(i == 1 && target_item != active_held) //move it out of any storage medium its in so it doesn't get consumed with its parent, but only if that storage medium is not our hand + target_item.forceMove(get_turf(context)) + continue //storage items usually come here but we make the exception only on the 1st iteration //this is so players can insert items from their bags into machines for convinience if(!is_type_in_list(target_item, storage_items))