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
merged 1 commit into from Sep 25, 2021

Conversation

ldpl
Copy link
Contributor

@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.

Description

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):
testobjects.zip

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 Compare September 21, 2021 17:44
Copy link
Member

@LordAro LordAro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@LordAro LordAro added the backport requested This PR should be backport to current release (RC / stable) label Sep 25, 2021
@TrueBrain TrueBrain merged commit 39662aa into OpenTTD:master Sep 25, 2021
@glx22 glx22 removed the backport requested This PR should be backport to current release (RC / stable) label Sep 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants