fix: trading and usage when inventory open

This commit is contained in:
cha0s 2024-10-02 14:29:44 -05:00
parent 85e252e423
commit 3bbaf83140

View File

@ -272,7 +272,12 @@ function Ui({disconnected}) {
const item = entity.Inventory.item(i); const item = entity.Inventory.item(i);
newHotbarSlots.push( newHotbarSlots.push(
item item
? {icon: item.icon, qty: item.qty} ? {
icon: item.icon,
label: item.label,
price: item.price,
qty: item.qty,
}
: undefined, : undefined,
); );
} }
@ -580,6 +585,8 @@ function Ui({disconnected}) {
type: 'Action', type: 'Action',
payload: {type: 'acceptTrade', value: {gaining, losing}}, payload: {type: 'acceptTrade', value: {gaining, losing}},
}); });
setGaining([]);
setLosing([]);
}, [client, gaining, losing]); }, [client, gaining, losing]);
useEffect(() => { useEffect(() => {
if (!pixiRef.current) { if (!pixiRef.current) {
@ -623,7 +630,7 @@ function Ui({disconnected}) {
where, where,
); );
} }
else { else if (!isInventoryOpen) {
client.send({ client.send({
type: 'Action', type: 'Action',
payload: {type: 'use', value: [1, where]}, payload: {type: 'use', value: [1, where]},