/*
Direct cut & paste from the chest in XP1 that destroys itself after you've
taken one item out of it.
*/

void main()
{
    if(GetInventoryDisturbType() == INVENTORY_DISTURB_TYPE_REMOVED)
    {
        effect eVis = EffectVisualEffect(VFX_FNF_SMOKE_PUFF);
        ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, OBJECT_SELF);
        object oItem = GetFirstItemInInventory();
        while (oItem != OBJECT_INVALID)
        {
            DestroyObject(oItem);
            oItem = GetNextItemInInventory();
        }
        SetPlotFlag(OBJECT_SELF, FALSE);
        DelayCommand(0.1, DestroyObject(OBJECT_SELF));
    }
    /*if(GetInventoryDisturbType() == INVENTORY_DISTURB_TYPE_ADDED)
    {
        object oDisturb = GetInventoryDisturbItem();
        DestroyObject(oDisturb);
    } */

}
