This sheet worker... // Update a WEAPON'S attack throw, whenever the weapons base attribute is changed.
on('change:repeating_weapons remove:repeating_weapons', function (eventInfo) {
getAttrs(['repeating_weapons_weapon_attr', 'attack_throw', 'strength_mod', 'dexterity_mod'], function(values) {
const theAttributeModifier = Number(values[values.repeating_weapons_weapon_attr]);
const theArmorThrow = Number(values.attack_throw) + theAttributeModifier;
setAttrs({ repeating_weapons_weapon_throw : theArmorThrow }); // <-- This line keeps "adding" a new, blank item when a remove event happens.
});
}); ...works fine, except when a repeating_weapons item is removed. When that happens, the item appears to be deleted, but a new, empty item is added at the same time, making it impossible to remove all the items. If I comment the setAttrs statement, the issue goes away. I assume that setting the attribute on an item ID that's been removed recreates the item?