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

GSEventGoalQuestionAnswer not triggered by spectators #5063

Closed
DorpsGek opened this issue Feb 14, 2012 · 3 comments
Closed

GSEventGoalQuestionAnswer not triggered by spectators #5063

DorpsGek opened this issue Feb 14, 2012 · 3 comments
Labels
component: AI/Game script (squirrel) This issue is related to Squirrel (Scripting language) flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

xOR opened the ticket and wrote:

A dialog created with GSGoal.Question() is shown to all players, including spectators. However, only if a player who is in a company clicks a button the GSEventGoalQuestionAnswer event is triggered. A spectator clicking a dialog button doesn't trigger it.

Expected behavior: the event should be fired for spectators too and GetCompany() should simply return COMPANY_INVALID in this case.

Reported version: 1.2.0-beta4
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/5063
@DorpsGek
Copy link
Member Author

TrueBrain wrote:

The dialog of GSGoal.Question() should not be shown to spectators. If it does, that is the bug. (remember, GSGoal.Question works per company, not per client!)

Will validate the code, as I am pretty sure I wrote the line to prevent it from showing up at the spectators ..


This comment was imported from FlySpray: https://bugs.openttd.org/task/5063#comment10894

@DorpsGek
Copy link
Member Author

TrueBrain closed the ticket.

Reason for closing: Fixed

Fixed in r23950. GSGoal.Question() never shows for spectators now. (so it doesnt really fix your bug, but it does fix the problem :D)


This comment was imported from FlySpray: https://bugs.openttd.org/task/5063

@DorpsGek
Copy link
Member Author

xOR wrote:

I know it's meant to be used for goals and therefore such dialogs "normally" would have a company context. But many of good features (not only in OpenTTD) arose from people who were using things differently from what they were intended to be used, until the thing has outgrown itself to a cool new feature.

Of course it doesn't make sense to waste coding time on allowing anything and everything to make things possible that probably nobody would ever use anyway. But doing the opposite and even putting effort into limiting possibilities and creativity of people? That's a bad idea if you ask me.
For example I thought about doing some kind of votes regarding goals, that I would also allow spectators to participate in (Why not give them a voice too? Often it's people that plan to join the game very soon, they just want to observe the map a few minutes before they do).
But meh, there dies my idea... :-(

Also I don't think that GSGoal.Question working per company is a valid argument to limit it this way - there are other functions that work per company but accept COMPANY_INVALID to address all players regardless of the company they are in, e.g. GSNews.Create(). It isn't a problem for the return events either, script authors need some more advanced logics for this event anyway: they need to cope with multiple replies for the same company as well as the fact that replies may not be received at all. So just document it and script authors know they also have to handle cases where they get company_invalid, so they got a reply from a spectator. Script authors who don't want to consider spectators can still just ignore events for COMPANY_INVALID.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5063#comment10895

@DorpsGek DorpsGek added flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) Goal/Game script labels Apr 7, 2018
@frosch123 frosch123 added the component: AI/Game script (squirrel) This issue is related to Squirrel (Scripting language) label Apr 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: AI/Game script (squirrel) This issue is related to Squirrel (Scripting language) flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)
Projects
None yet
Development

No branches or pull requests

2 participants