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

Scripts and pause mode #5283

Open
DorpsGek opened this issue Aug 30, 2012 · 2 comments
Open

Scripts and pause mode #5283

DorpsGek opened this issue Aug 30, 2012 · 2 comments
Labels
bug Something isn't working component: AI/Game script (squirrel) This issue is related to Squirrel (Scripting language) flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) good first issue Good for newcomers

Comments

@DorpsGek
Copy link
Member

frosch opened the ticket and wrote:

Multiple problems:

  1. In singleplayer the build-in-pause setting is only checked in DoCommandP, thus scripts (well. GS) circumvent any pause setting and can execute anything.

  2. In singleplayer the GS can ask a question in pause mode, but the player cannot answer the question in the most restrictive build-on-pause setting. Closing the window causes "not allowed in pause" error.

  3. In multiplayer the server command loop drops all commands in pause mode, which are not allowed. It does this without sending any error to the clients. This causes scripts to deadlock when they execute a command, since they are suspended until the command reports a result back.

3.1) GS can deadlock themself by pausing the game and then executing a command which is not allowed in pause mode. Even a human is not allowed to unpause the game then.
3.2) AIs are also deadlocked if they happen to execute a command in the same tick as the pause command is triggered. (The AI still runs when the game is not paused; but the command will be dropped and never report back)

To solve this:
a) Also perform the pause mode check for scripts in singleplayer, to make SP and MP behave consistent.
b) Make the server report an error if commands are dropped in pause mode, so scripts can continue.
c) Maybe GS should be allowed to execute all commands (also GSCompanyMode) regardless of pause setting.

Reported version: trunk
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/5283
@DorpsGek DorpsGek added flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) bug labels Apr 7, 2018
@andythenorth andythenorth added component: AI/Game script (squirrel) This issue is related to Squirrel (Scripting language) Goal/Game script and removed Script component: AI/Game script (squirrel) This issue is related to Squirrel (Scripting language) labels Apr 13, 2018
@TrueBrain TrueBrain added good first issue Good for newcomers bug Something isn't working and removed bug from FlySpray labels Apr 14, 2018
@frosch123 frosch123 added component: AI/Game script (squirrel) This issue is related to Squirrel (Scripting language) and removed Goal/Game script labels Apr 14, 2018
@andythenorth andythenorth added the stale Stale issues label Jan 5, 2019
@andythenorth andythenorth removed the stale Stale issues label Jan 13, 2019
@serprinss
Copy link

serprinss commented Mar 18, 2020

can someone provide a gs showcasing this issue?

@TrueBrain TrueBrain removed the pinned label Jan 3, 2021
@ghost

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working component: AI/Game script (squirrel) This issue is related to Squirrel (Scripting language) flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

5 participants