Need to prevent Augment Stacking with YEP Attachable Augments

I'm using Yanfly's Attachable Augments & I couldn't help but notice that he didn't include a way to prevent stacking of the same augment or multiple augments that boost a parameter. This can lead to some super broken setups like stacking EVA+ augment until the character is untouchable or even stacking Physical or Magical Damage Rate augments like -10% to -50% until they become invincible.

Is there anybody that could add a feature to prevent stacking of either the same exact augment or augments that boost the same parameter?
Hi,

Add this in a new plugin placed just below attach augment and tell me if it works.
This script do not disable to attach an augment that is already attach but it remove an augment that is already attach from the augment list.
To test it, take a weapon and two copy of the same augment.
Attach the first augment.
try to attach the second.

JavaScript:
Window_AugmentItemList.prototype.makeItemList = function() {
    this._data = $gameParty.allItems().filter(function(item) {
        return this.includes(item);
    }, this);
    if (this._item && this._item.augmentSlotItems[this._slotId] !== 'none') {
        this._data.unshift(null);
    }

    if (this._data.length === 0) return;
    alreadyAttached = this._item.augmentSlotItems;


    for (i=0; i< this._data.length; i++){
        if (this._data[i]) var keyWord = "item "+this._data[i].id
        for (j=0; j<alreadyAttached.length; j++){
            if (alreadyAttached[j] === keyWord) this._data.splice(i,1);
        };
    };
};

EDIT : forgot to mention that this script will work only if your augment are Items. It will do a mess if you use weapon and armor as augment. If it works for you with Items, I will update the script and share it in a next answer to this post. I just want to be sure it works for you before working on it.

Original thread: https://forums.rpgmakerweb.com/threads/need-to-prevent-augment-stacking-with-yep-attachable-augments.121236/