Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a delay to the pause feature #6643

Merged
merged 18 commits into from
Feb 7, 2025
Merged

Add a delay to the pause feature #6643

merged 18 commits into from
Feb 7, 2025

Conversation

Garanas
Copy link
Member

@Garanas Garanas commented Feb 4, 2025

Description of the proposed changes

Related to:

Introduces a small delay before user A can resume the session after a pause initiated by user B. At all times, user B can resume immediately. A chat message is posted when a user pauses the session, attempts to resume the session and when the session is resumed.

image

Testing done on the proposed changes

Launched the game directly into the match maker lobby with the LaunchScripts made by @lL1l1 .

Checklist

  • Changes are annotated, including comments where useful
  • Changes are documented in the changelog for the next game version

@Garanas Garanas marked this pull request as ready for review February 4, 2025 13:18
@Garanas Garanas added the area: ui Anything to do with the User Interface of the Game label Feb 4, 2025
@Garanas
Copy link
Member Author

Garanas commented Feb 4, 2025

Adjusted the chat message to include the number of seconds until the user can resume the game:

image

Copy link
Contributor

@lL1l1 lL1l1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get the following error when unpausing:

WARNING: Error running '/lua/ui/game/gamemain.lua:ReceiveChat': ...\lua\ui\game\gamemain.lua(747): access to nonexistent global variable "SendResumedBy"
         stack traceback:
         	[C]: in function `error'
         	...\lua\system\config.lua(58): in function <...\lua\system\config.lua:57>
         	...\lua\ui\game\gamemain.lua(747): in function `func'
         	...\lua\ui\game\gamemain.lua(1082): in function <...\lua\ui\game\gamemain.lua:1066>

The debug logging should be removed too.

The rest of the general functionality of the unpause delay works in my testing.

lua/ui/game/gamemain.lua Outdated Show resolved Hide resolved
lua/ui/game/gamemain.lua Outdated Show resolved Hide resolved
lua/ui/game/pause.lua Outdated Show resolved Hide resolved
lua/ui/game/pause.lua Show resolved Hide resolved
lua/ui/game/pause.lua Outdated Show resolved Hide resolved
lua/ui/game/pause.lua Outdated Show resolved Hide resolved
lua/ui/game/pause.lua Outdated Show resolved Hide resolved
lua/ui/game/pause.lua Outdated Show resolved Hide resolved
Comment on lines +65 to +73
local oldSessionRequestPause = _G.SessionRequestPause
_G.SessionRequestPause = function()
-- makes no sense to request a pause on top of a pause
if SessionIsPaused() then
return
end

oldSessionRequestPause()
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think this hook is necessary. Shouldn't the nonsensical case be handled by the engine already?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think this hook is necessary. Shouldn't the nonsensical case be handled by the engine already?

I'll check this evening.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I am not mistaken then the message would be sent and it would override the person who initiated the pause.

lua/ui/game/tabs.lua Outdated Show resolved Hide resolved
@4z0t
Copy link
Member

4z0t commented Feb 5, 2025

Had to add that before, but I'll say then now: change these messages (pause/unpause/want to continue) to notification messages. Meaning that message is not typed by a player, but rather provided by a system.

@Garanas
Copy link
Member Author

Garanas commented Feb 5, 2025

Is there an existing system for this? If not, then it's out of scope of this particular pull request in my opinion.

@4z0t
Copy link
Member

4z0t commented Feb 5, 2025

There is one that is used for notifications, such as HQ upgrades and ACU enhancements.

@Garanas
Copy link
Member Author

Garanas commented Feb 5, 2025

There is one that is used for notifications, such as HQ upgrades and ACU enhancements.

That is Notify, which originates from the sim if I am not mistaken.

@Garanas
Copy link
Member Author

Garanas commented Feb 7, 2025

@lL1l1 I think I processed your feedback.

@BlackYps BlackYps merged commit a34ffb7 into develop Feb 7, 2025
5 checks passed
@BlackYps BlackYps deleted the feature/pause-delay branch February 7, 2025 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ui Anything to do with the User Interface of the Game
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants