mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2026-03-21 23:39:43 +00:00
Hey, it lasted almost a year! Computer input is somewhat stateful, as we need to track things like which key(s) are currently held, and what the last mouse button/position was. This code is currently duplicated in several places (specifically TerminalWidget, ServerInputState and the standalone emulator). In order to implement lectern pocket computer mouse interactions, we'd have to duplicate this logic once again. Instead, we move this code into a common class. - Replace the InputHandler interface with a simpler ComputerInput one (this no longer has computer actions, like reboot or terminate). This interface never made much sense (aside from hiding implementation details), as code only ever consumed a single implementation of it. On the client, this requires a new "ClientComputerActions" class. This feels a bit clunky to me, but it's simple and it works. - Replace ComputerEvents with a EventComputerInput class (terrible name, I know!), which queues events on a computer. - Move common input state tracking and validation into a single UserComputerInput class, which wraps an existing ComputerInput. This is used by both the terminal widget, and the server-side input state.