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: allow gamescripts to build neutral objects #9568

merged 1 commit into from Sep 25, 2021


Copy link

@ldpl ldpl commented Sep 21, 2021

Motivation / Problem

There are a lot of newgrfs with objects on bananas but, apparently, gamescripts have no way to use them. So this PR aims to pave the way by providing some simple methods to list the objects and build them. This can be useful for adding features during map generattion as well adding some neat details during the game like some landmarks to growing cities, or fences to mark claimed zones.


Adds GSObjectTypeList to list availablle objects. GSObjectType with IsValidObjectType, GetName and GetViews methods to get same basic info about them. And, finally, GSObjectType.BuildObject to make them useful. It's mostly similar to existing GSIndustryType/GSIndustryTypeList.

Also adds AI counterparts for those methods, because why not.

Simple GS for testing (needs an object newgrf):

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR touches english.txt or translations? Check the guidelines
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, gs_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')
@ldpl ldpl force-pushed the gs-objects branch 2 times, most recently from 8230486 to b9560bb Sep 21, 2021
Copy link

@LordAro LordAro left a comment



@TrueBrain TrueBrain merged commit 39662aa into OpenTTD:master Sep 25, 2021
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants