fix: do send hotbar input
This commit is contained in:
parent
d3ad91779a
commit
667573ce63
|
@ -87,22 +87,7 @@ const Play = () => {
|
|||
const inputHandle = setInterval(() => {
|
||||
const actionStream = selfEntity.drainInput();
|
||||
if (actionStream.length > 0) {
|
||||
const sending = actionStream.filter(({action}) => {
|
||||
if (action.match(/^HotbarSlot(\d)/)) {
|
||||
return false;
|
||||
}
|
||||
switch (action) {
|
||||
case 'HotbarSlotNext':
|
||||
case 'HotbarSlotPrevious':
|
||||
return false;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
if (sending.length > 0) {
|
||||
socket.send(['Input', sending]);
|
||||
}
|
||||
socket.send(['Input', actionStream]);
|
||||
}
|
||||
}, 1000 / 60);
|
||||
ref.current.focus();
|
||||
|
|
|
@ -47,19 +47,19 @@ export default (latus) => class Wielder extends decorate(Trait) {
|
|||
const hotbarMatch = action.match(/^HotbarSlot(\d)/);
|
||||
if (hotbarMatch && value) {
|
||||
this.entity.activeSlotIndex = (parseInt(hotbarMatch[1], 10) + 10) % 10;
|
||||
return false;
|
||||
return undefined;
|
||||
}
|
||||
switch (action) {
|
||||
case 'HotbarSlotNext':
|
||||
if (value) {
|
||||
this.entity.activeSlotIndex = (this.entity.activeSlotIndex + 1) % 10;
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case 'HotbarSlotPrevious':
|
||||
if (value) {
|
||||
this.entity.activeSlotIndex = (this.entity.activeSlotIndex + 9) % 10;
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case 'UseItem':
|
||||
if ('client' !== process.env.SIDE) {
|
||||
this.#itemUseRequest = value;
|
||||
|
|
Loading…
Reference in New Issue
Block a user