fix(g20): UserInputService.InputBegan фейерится на mouseButton1
Раньше при ЛКМ фейерился только playerMouse.Button1Down.Fire(),
а UserInputService.InputBegan/InputEnded — нет. Lua-скрипт игры 20
ловил клик через InputBegan + UserInputType.MouseButton1 → нет
события → урон не наносился.
Фикс: при mouseButton1Down/Up фейерим InputBegan/InputEnded с
InputObject {UserInputType=Enum.UserInputType.MouseButton1} —
ссылка на тот же объект, что Lua использует в сравнении.
This commit is contained in:
parent
4644a332e4
commit
8c32e80f9f
@ -2308,9 +2308,28 @@ export function registerRobloxShim(lua, opts) {
|
||||
playerMouse.Hit.p = playerMouse.Hit.Position;
|
||||
}
|
||||
try { playerMouse.Button1Down.Fire(); } catch (_) {}
|
||||
// Также фейерим UserInputService.InputBegan с UserInputType.MouseButton1
|
||||
try {
|
||||
const uitEnum = global.get('Enum')?.UserInputType || {};
|
||||
const inputObj = {
|
||||
UserInputType: uitEnum.MouseButton1
|
||||
|| { Name: 'MouseButton1', Value: 'MouseButton1' },
|
||||
KeyCode: { Name: 'Unknown', Value: 'Unknown' },
|
||||
};
|
||||
uis.InputBegan.Fire(inputObj, false);
|
||||
} catch (_) {}
|
||||
}
|
||||
if (p.type === 'mouseButton1Up') {
|
||||
try { playerMouse.Button1Up.Fire(); } catch (_) {}
|
||||
try {
|
||||
const uitEnum = global.get('Enum')?.UserInputType || {};
|
||||
const inputObj = {
|
||||
UserInputType: uitEnum.MouseButton1
|
||||
|| { Name: 'MouseButton1', Value: 'MouseButton1' },
|
||||
KeyCode: { Name: 'Unknown', Value: 'Unknown' },
|
||||
};
|
||||
uis.InputEnded.Fire(inputObj, false);
|
||||
} catch (_) {}
|
||||
}
|
||||
if (p.type === 'keyDown' || p.type === 'keydown') {
|
||||
const k = String(p.key || '').toLowerCase();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user