mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-03 14:27:03 +02:00
Instakill player when automating infiltration
This commit is contained in:
@@ -2,6 +2,7 @@ import React, { useEffect } from 'react';
|
||||
|
||||
interface IProps {
|
||||
onKeyDown: (event: React.KeyboardEvent<HTMLElement>) => void;
|
||||
onFailure: (options?: { automated: boolean }) => void;
|
||||
}
|
||||
|
||||
export function KeyHandler(props: IProps): React.ReactElement {
|
||||
@@ -9,7 +10,12 @@ export function KeyHandler(props: IProps): React.ReactElement {
|
||||
useEffect(() => elem.focus());
|
||||
|
||||
function onKeyDown(event: React.KeyboardEvent<HTMLElement>): void {
|
||||
if(!event.isTrusted) return;
|
||||
console.log("isTrusted?", event.isTrusted)
|
||||
if(!event.isTrusted) {
|
||||
console.log("untrusted event!")
|
||||
props.onFailure({ automated: true });
|
||||
return;
|
||||
}
|
||||
props.onKeyDown(event);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user