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: [Script] Game script control of industry production level. #11141
Conversation
Works for me in initial (limited) test. News message would be useful, but a separate call to GSNews.Create() does work. However, we do lack an appropriate GSNews::NewsType. NT_GENERAL and NT_ECONOMY aren't the right ones. Lines 21 to 39 in 9c262b0
|
8d1b9e6
to
0f331eb
Compare
0f331eb
to
d6ecccc
Compare
Now with a custom news message option. |
News message works, thanks :) If |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, the docstring should explain more explicitly what argument a GS author should pass if no news message is desired.
So something like
If |
I verified that doesn't happen, |
d6ecccc
to
bbf9b2f
Compare
Motivation / Problem
Game scripts can override industry production in a limited way. They can prohibit production increases and/or decreases and prevent closure. But they can't actually change production, just hold it in place.
This half-way control isn't very useful if a GS wants to implement custom industry production rules.
Description
This PR adds GS API methods to get and set the production multiplier of an industry. NewGRFs are notified by a new flag in var 47 (GameScript control status). Setting the production multiplier does not prohibit industry closure, GS can use the existing control flag for this.
A script can optionally let OTTD generate a production change news message if needed.
Limitations
I'm not sure about the actual GS API. Maybe it would be better to use a magic prod_level value to restore the default production behaviour instead of the need to clear the control flag.
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.