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
GS method to control engine availability for a specific company #7791
Conversation
Could you also make it so Game Scripts can remove engines from the purchase menu of a company? This should allow for things like "researching teck X obsoletes engine Y", events like "This engine is only available for purchase in December", and more. |
+1 to @James103 idea, there should be plenty of space in |
Idea with a different scope, but related: actual tech tree in newgrf, that GS could query. Could be done as:
If there's any interest, I can copy this to a new issue. I've been experimenting with rendering tech trees in different formats: |
@James103, @nielsmh I refrained from doing remove method since I was concerned it may have some undesirable side-effects and I don't rly like an idea of anything becoming obsolete anyway. But I checked and it seems it should be ok as existing mechanics already uses that mask for making vehicles obsolete so I guess I'll try adding the method. @andythenorth IMO GameScripts shouldn't work with unknown newgrfs and for known ones it's better to have tech tree on a website like you do rather than hidden behind some api so it's easier for gs developer to read. Some GUI for GS to show tech tree would be nice (like any other GS GUI) but it's unclear to me how should it look/work. Tbh I'm mostly thinking of making linear tech progressions atm, and have no ideas for any meaningful "tree" thing as there is always the best engine in OpenTTD. |
What happens reliability-wise when a vehicle is introduced long before its planned introduction date? |
@nielsmh AFAICT reliability calculations don't rely on company_avail mask at all, so it should be just using it's initial reliability (same as it works with preview). |
So if you get a vehicle 10 years before its regular introduction, it'd be stuck at 50% or so max reliability for the first 9 years? I guess that makes sense. |
@nielsmh Yep. Though I have no idea why would anyone want to use this method with breakdowns enabled (or, well, enable them at all :p). |
How would you handle a Game Script removing an engine from the purchase menu of a company despite having "vehicles never expire" set to true? Would the engine still be removed from the purchase menu? |
The general concept of GS is that it overrides all other rules. If the GS says you can't build a certain vehicle model, then you can't build it, regardless of the general expiry rules. (It could be the GS has a concept of being in good/bad standing with a vehicle manufacturer, so depending on player actions you will be permitted/refused to purchase certain models.) |
Another way that this feature can be helpful for is if you wanted to use the in-game date as some sort of timer (like how OpenRCT2 does it). A Game Script that enables all engines for all companies at the start of the game would be helpful in this situation. |
Added a method to retire vehicles. |
It's been over 11 days since the checks have triggered and passed. Why haven't the "OpenTTD CI (Windows Win32)" check passed yet on GitHub's side even though it passed on Azure's side? I feel like that because of this error in OpenTTD CI system, this PR may not be able to be merged unless committed to again, or maybe even at all. |
Is it possible to have a Game Script repeatedly enable and disable an engine for some company? (enable, disable, re-enable, ...)? If so or if you can make it so, then that would allow for engines available only under certain conditions not tied to the date, such as "Only purchasable in December", or "Must have 500+ performance rating", or "Must have 100+ road vehicles", or "Must maintain consistent 100t oil/month supply", or other such conditions as defined and implemented by the game script? |
@James103 Sure, if you check techtroll GS I attached all it does is constantly enabling and disabling engines. |
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.
Missing script changelog entry as well
3d86f34
to
40fec79
Compare
40fec79
to
f7d9b68
Compare
…any (OpenTTD#7791) * Feature: GS method to allow company to use an engine before its introduction date * Feature: GS method to retire an engine early for a specific company
Just a simple method that uses existing Engine::company_avail mask and allows GS to do tech trees and such.
GS for testing: techstump.zip