Merge branch 'craft2' into 'master'

BUG: Fix `InventoryWear()` ignoring explicitly passed colors in favor of `Craft.Color`

See merge request 
This commit is contained in:
BondageProjects 2025-03-30 23:52:40 +00:00
commit 5f2d3d6a53

View file

@ -715,6 +715,8 @@ function InventoryCraft(Source, Target, GroupName, Craft, Refresh, PreConfigureI
Target, Item, Craft.TypeRecord,
{ push: false, refresh: false, C_Source: Source, properties: Craft.ItemProperty },
);
} else {
Object.assign(Item.Property, Craft.ItemProperty ?? {});
}
// Applies a lock to the item
@ -820,10 +822,16 @@ function InventoryWear(C, AssetName, AssetGroup, ItemColor, Difficulty, MemberNu
if (A.ExpressionTrigger != null) {
InventoryExpressionTriggerApply(C, A.ExpressionTrigger);
}
if (Craft) {
// Restore the item color if it has been explicitly passed; keep using the `Craft.Color`-assigned color otherwise
const C_Source = Character.find(c => c.MemberNumber === MemberNumber) ?? null;
InventoryCraft(C_Source, C, /** @type {AssetGroupItemName} */(AssetGroup), Craft, false);
if (ItemColor != null) {
item.Color = color;
}
}
if (Refresh) {
CharacterRefresh(C, true);
}