Skip to content

Disabling inputs when sleeping#737

Open
acth2 wants to merge 5 commits intosmartcmd:mainfrom
acth2:sleep-fix
Open

Disabling inputs when sleeping#737
acth2 wants to merge 5 commits intosmartcmd:mainfrom
acth2:sleep-fix

Conversation

@acth2
Copy link
Contributor

@acth2 acth2 commented Mar 6, 2026

Description

When the player sleep, he cannot control the camera anymore

Changes

avoiding being able to move camera while being asleep

Previous Behavior

Nothing was happening so the player was able to move his head and change the sky time. F5 view was also glitched

Root Cause

Moving the camera cause the sky to act strange (time passing faster). This is caused because there is no logic preventing that.

New Behavior

Now when the player go to sleep he cannot move the camera anymore
https://github.com/user-attachments/assets/53e68642-b8b6-4786-bf3b-e6345b209280

Fix Implementation

i added SetActiveMouse(bool active) and IsActiveMouse() into KeyboardMouseInput.h/cpp. And utilize them

in startSleepInBed i added:
g_KBMInput.SetActiveMouse(false);

in stopSleepInBed i added:
g_KBMInput.SetActiveMouse(true);

as well as for good measures stop pressing left and right click (a bug where i would autoclick when i leave bed is avoided)

g_KBMInput.OnMouseButtonUp(KeyboardMouseInput::MOUSE_LEFT);
g_KBMInput.OnMouseButtonUp(KeyboardMouseInput::MOUSE_RIGHT);

AI Use Disclosure

nop

Related Issues

@codeHusky
Copy link
Collaborator

This seems like a hack, realistically we should just disable inputs when the player is sleeping

@codeHusky codeHusky marked this pull request as draft March 6, 2026 19:55
@acth2 acth2 changed the title Starting a blank screen GUI when sleeping to avoid bugs Disabling inputs when sleeping Mar 7, 2026
@acth2 acth2 marked this pull request as ready for review March 7, 2026 00:28
@codeHusky
Copy link
Collaborator

This is close, but I feel like disabling the mouse affecting head rotation rather than completely disabling the mouse when sleeping would be safer

@codeHusky codeHusky marked this pull request as draft March 7, 2026 00:48
@acth2 acth2 marked this pull request as ready for review March 7, 2026 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Moving mouse while sleeping causing the time to change

2 participants