Skip to content

add all game actions and their documentation to plugin API#18826

Merged
duncanspumpkin merged 1 commit into
OpenRCT2:developfrom
Sadret:actions
Dec 16, 2022
Merged

add all game actions and their documentation to plugin API#18826
duncanspumpkin merged 1 commit into
OpenRCT2:developfrom
Sadret:actions

Conversation

@Sadret

@Sadret Sadret commented Dec 12, 2022

Copy link
Copy Markdown
Contributor

Additions:

  • Expose all missing actions to the API.
  • Add action arguments to the documentation for all actions.
  • Add queryAction and executeAction overloads to the documentation for all actions.

Fixes:

  • SetSceneryColour now is correctly linked to smallscenerysetcolour instead of largescenerysetcolour.

Changes:

  • Rename landsmoothaction to landsmooth to comply with naming conventions.
  • Rename placepeepspawn to peepspawnplace to comply with naming conventions.
  • Rename placeparkentrance to parkentranceplace to comply with naming conventions.
  • Rename ridesetvehicles to ridesetvehicle to comply with naming conventions.
  • Rename setcheataction to setcheat to comply with naming conventions.
    [Note: this breaks backwards compatibility for ridesetvehicle and setcheat. I looked through the plugin database and could not find a single plugin that uses them.]

Misc:

  • API version bumped.
  • Every single action was hand-tested by me.

@Sadret Sadret force-pushed the actions branch 2 times, most recently from 037654c to f222758 Compare December 12, 2022 20:48
@duncanspumpkin

duncanspumpkin commented Dec 12, 2022

Copy link
Copy Markdown
Contributor

Have all of the comments from #18037, #12933, #12894, #13648 been applied?

Comment thread distribution/openrct2.d.ts
<< DS_TAG(_constructFlags);
}

void FootpathPlaceFromTrackAction::AcceptParameters(GameActionParameterVisitor& visitor)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This action should not be usable from plugins its an internal action only for tracks.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is that a good reason? I can already see a use case for Scenery Manager and other plugins, e.g. to place exact queue layouts, which is not possible (or rather unneccessarily difficult) with the regular action.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if you feel it has a use. But does it make sense for it to be found under the FootpathPlaceFromTrackAction name.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I tried to keep the names as close to the originals while making the sure that the naming conventions are consistent. But you are right, from the viewpoint of the API, the difference is not that you place it wrt some track, but that you specify the edges instead of having them inferred. The name should capture this, do you have a suggestion?
Maybe FootpathPlaceWithLayout or FootpathLayoutPlace.

@duncanspumpkin duncanspumpkin Dec 13, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your call on the names I don't have any preference. Probably need to have a note in the .ts file saying its renamed just incase anyone wants to look at the cpp. (After this is merged might as well just rename the action in cpp to whatever you chose)

Comment thread src/openrct2/actions/LandSetHeightAction.cpp
@Sadret

Sadret commented Dec 12, 2022

Copy link
Copy Markdown
Contributor Author

Have all of the comments from #18037, #12933, #12894, #13648 been applied?

No, but some of them are debatable to say the least. I.e. (in contrast also to what I said) enums should not be part of the .d.ts file.

I'll go through the other PRs and collect their comments.

{
}

void LoadOrQuitAction::AcceptParameters(GameActionParameterVisitor& visitor)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not sure this should be exposed in the scripting api.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Why not?
You mentioned potential crashes (in another PR) but I tested this action a lot and it did not seem to have any problems.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It resets the plugin when called (unless they are persistant plugins). Would plugin authors need this sort of thing?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure, for a "Hardcore" mode that immediately quits the game without saving when you drop below 500 park rating.

Tbh I don't really see the point in arguing if a feature may be needed or not, unless there is a good reason against that feature. And as I said in other discussions before, I do not think that "it enables the potential for bad user experience" is a good reason, because there are already enough API features that do this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

But I think this action would be among those where I would care least about if they don't make the cut.

Comment thread src/openrct2/actions/NetworkModifyGroupAction.cpp
void PeepPickupAction::AcceptParameters(GameActionParameterVisitor& visitor)
{
visitor.Visit("type", _type);
visitor.Visit("entityId", _spriteId);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There is a bit of inconsistentcy across the various staff/guest/peep actions for this field. They should all use the same name for this (id seems to be the most common)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, this should be different here.
I tried to be consistent where possible, i.e. without changing existent implementations, which made it difficult some times.

Comment thread src/openrct2/actions/PeepPickupAction.cpp
Comment thread src/openrct2/actions/PlaceParkEntranceAction.cpp Outdated
@Sadret Sadret force-pushed the actions branch 2 times, most recently from 1f4c34d to 7f9b310 Compare December 12, 2022 22:14
visitor.Visit(_loc);
visitor.Visit("setting", _setting);
visitor.Visit("value1", _value1);
visitor.Visit("value2", _value2);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This doesn't expose pasteElement (which is good its much too low level how that works) but what happens if someone uses the TileModifyType::AnyPaste setting?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In my tests it inserts an "empty" TileElement, that is a surface element (type 0) at height 0, surfaceStyle 0, edgeStyle 0, slope 0, ...
Now, I do not know enough about cpp to be sure about how stable that is, but I think it results from the default attribute values after calling the default constructor TileModifyAction() = default; (TileModifyAction.h:53).

Comment thread src/openrct2/actions/WaterSetHeightAction.cpp
Comment thread distribution/openrct2.d.ts Outdated
}

interface LoadOrQuitArgs extends GameActionArgs {
mode: number; // 0: open save prompt, 1: close save prompt, 2: quit without save prompt

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Internally we never use 2. Its not even in the enum. Its a bit dangerous it will do different things to different users. I suggest not mentioning it here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Makes sense.

In that case, referencing the discussion above, I would be even more okay with this action getting removed from the API. Still, if there is no major reason against it, I would keep the action.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if you think it has use to you as a plugin author keep it.

<< DS_TAG(_constructFlags);
}

void FootpathPlaceFromTrackAction::AcceptParameters(GameActionParameterVisitor& visitor)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if you feel it has a use. But does it make sense for it to be found under the FootpathPlaceFromTrackAction name.

Comment thread src/openrct2/actions/LandSetHeightAction.cpp
{
}

void LoadOrQuitAction::AcceptParameters(GameActionParameterVisitor& visitor)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It resets the plugin when called (unless they are persistant plugins). Would plugin authors need this sort of thing?

@Gymnasiast

Copy link
Copy Markdown
Member

Since we’re going to release v0.4.3 soon, and because this PR combines too many things in the first place, could you create a separate PR just for the fix(es)?

@Sadret

Sadret commented Dec 13, 2022

Copy link
Copy Markdown
Contributor Author

Since we’re going to release v0.4.3 soon, and because this PR combines too many things in the first place, could you create a separate PR just for the fix(es)?

Is that necessary? The only fix is kind of irrelevant, because the corresponding actions were not implemented yet.

@Gymnasiast

Copy link
Copy Markdown
Member

I see. It might still be worth it to get your work in a state we can merge - right now I think it changes too many things at once, and some things are very opinionated.

@Sadret

Sadret commented Dec 13, 2022

Copy link
Copy Markdown
Contributor Author

After the first round of feedback, I will split this PR into two: One that has everything that still needs to be discussed and one with the rest, which should be ready to be merged.

@duncanspumpkin

Copy link
Copy Markdown
Contributor

After the first round of feedback, I will split this PR into two: One that has everything that still needs to be discussed and one with the rest, which should be ready to be merged.

I don't think you need to do that anymore. It is basically there the only area to change is remove the documentation on the loadsave action for 2 and look into a new name for the footpath track action.

@Sadret

Sadret commented Dec 13, 2022

Copy link
Copy Markdown
Contributor Author

I finished implementing the last comments and fixed the clang errors.

I think this is ready to go.

@Gymnasiast Gymnasiast modified the milestone: After v0.4.3 Dec 13, 2022
@Sadret Sadret force-pushed the actions branch 2 times, most recently from 9caf8d9 to 8577f24 Compare December 15, 2022 22:08
@Sadret

Sadret commented Dec 15, 2022

Copy link
Copy Markdown
Contributor Author

Moved changelog entry to 4.4 section.

@duncanspumpkin duncanspumpkin added plug-in Related to the plugin system of OpenRCT2. plugin api version Plugin API version needs updating - double check before merging! labels Dec 16, 2022
@duncanspumpkin duncanspumpkin added this to the v0.4.4 milestone Dec 16, 2022
@Sadret

Sadret commented Dec 16, 2022

Copy link
Copy Markdown
Contributor Author

bumped API version

@duncanspumpkin duncanspumpkin enabled auto-merge (squash) December 16, 2022 21:16
@duncanspumpkin duncanspumpkin merged commit bd6e572 into OpenRCT2:develop Dec 16, 2022
@Sadret Sadret deleted the actions branch December 16, 2022 21:38
CorySanin added a commit to CorySanin/openrct2-ffa-plugin-suite that referenced this pull request Dec 22, 2022
janisozaur added a commit that referenced this pull request Mar 28, 2023
- Feature: [#11269] Add properties for speed and length of vehicle animations.
- Feature: [#15849] Objectives can now be set for up to 50000 guests.
- Feature: [#18537] Add shift/control modifiers to window close buttons, closing all but the given window or all windows of the same type, respectively.
- Feature: [#18732] [Plugin] API to get the guests thoughts.
- Feature: [#18744] Cheat to allow using a regular path as a queue path.
- Feature: [#19023] Add Canadian French translation.
- Feature: [#19341] Add “All Scenery” tab to scenery window.
- Feature: [#19378] Add command to combine CSG1i.DAT and CSG1.DAT.
- Feature: [objects#226] Port RCT1 Corkscrew Coaster train.
- Feature: [objects#229] Port RCT1 go karts with helmets.
- Feature: [OpenMusic#20, OpenMusic#21] Added Blizzard and Extraterresterial ride music styles.
- Improved: [#11473] Hot reload for plug-ins now works on macOS.
- Improved: [#12466] RCT1 parks now use RCT1’s interest calculation algorithm.
- Improved: [#14635] Scenery window now shows up to 255 scenery groups.
- Improved: [#17288] Reorganise the order of shortcut keys in the Shortcut Keys window.
- Improved: [#18706] Ability to view the list of contributors in-game.
- Improved: [#18749] Ability to have 4 active awards for more than one month in a row.
- Improved: [#18826] [Plugin] Added all actions and their documentation to plugin API.
- Improved: [#18945] Languages can now fall back to other languages than English.
- Improved: [#18970] Trying to load a non-park save will now display a context error.
- Improved: [#18975] Add lift sprites for steep hills on the wooden roller coaster.
- Improved: [#19044] Added special thanks to RMC and Wiegand to the About page.
- Improved: [#19131] Track missing objects when selecting scenery groups in console.
- Improved: [#19253] Queue junctions drawn properly when using regular paths as queue. Note: Requires using tile inspector to indicate railings can be used at T or X junctions.
- Improved: [#19067] New Ride window now allows filtering similarly to Object Selection.
- Improved: [#19272] Scenery window now allows filtering similarly to Object Selection.
- Improved: [#19447] The control key now enables word jumping in text input fields.
- Improved: [#19463] Added ‘W’ and ‘Y’ with circumflex to sprite font (for Welsh).
- Improved: [#19549] Enable large address awareness for 32 bit Windows builds allowing to use 4 GiB of virtual memory.
- Improved: [#19668] Decreased the minimum map size from 13 to 3.
- Improved: [#19683] The delays for ride ratings to appear has been reduced drastically.
- Improved: [#19697] “Show guest purchases” will now work in multiplayer.
- Change: [#19018] Renamed actions to fit the naming scheme.
- Change: [#19091] [Plugin] Add game action information to callback arguments of custom actions.
- Change: [#19233] Reduce lift speed minimum and maximum values for “Classic Wooden Coaster”.
- Removed: [#19520] Support for Windows Vista systems.
- Fix: [#474] Mini golf window shows more players than there actually are (original bug).
- Fix: [#592] Window scrollbar not able to navigate to the end of large lists.
- Fix: [#7210] Land tile smoothing occurs with edge tiles (original bug).
- Fix: [#17996] Finances window not cleared when starting some .park scenarios.
- Fix: [#18260] Crash opening parks that have multiple tiles referencing the same banner entry.
- Fix: [#18467] “Selected only” Object Selection filter is active in Track Designs Manager, and cannot be toggled.
- Fix: [#18904] OpenRCT2 audio object accidentally exported in saves.
- Fix: [#18905] Ride Construction window theme is not applied correctly.
- Fix: [#18911] Mini Golf station does not draw correctly from all angles.
- Fix: [#18971] New Game does not prompt for save before quitting.
- Fix: [#18986] [Plugin] Sending remote scripts larger than 63KiB crashing all clients.
- Fix: [#18994] Title music doesn’t start after enabling master volume.
- Fix: [#19025] Park loan behaves inconsistently with non-round and out-of-bounds values.
- Fix: [#19026] Park loan is clamped to a 32-bit integer.
- Fix: [#19068] Guests may not join queues correctly.
- Fix: [#19091] [Plugin] Remote plugins in multiplayer servers do not unload properly.
- Fix: [#19112] Clearing the last character in the Object Selection filter does not properly reset it.
- Fix: [#19112] Text boxes not updated with empty strings in Track List, Server List, and Start Server windows.
- Fix: [#19114] [Plugin] ‘GameActionResult’ does not comply to API specification.
- Fix: [#19136] SV6 saves with experimental RCT1 paths not imported correctly.
- Fix: [#19243] .park scenarios don’t complete properly.
- Fix: [#19250] MusicObjects do not free their preview images.
- Fix: [#19292] Overflow in ‘totalRideValue’.
- Fix: [#19339] Incorrect import of crashed particles from SV4.
- Fix: [#19379] “No platforms” station style shows platforms on the Junior Roller Coaster.
- Fix: [#19380] Startup crash when no sequences are installed and random sequences are enabled.
- Fix: [#19391] String corruption caused by an improper buffer handling in ‘GfxWrapString’.
- Fix: [#19434, #19509] Object types added by OpenRCT2 do not get removed when executing ‘remove_unused_objects’.
- Fix: [#19475] Cannot increase loan when more than £1000 in debt.
- Fix: [#19493] SV4 saves not importing the correct vehicle colours.
- Fix: [#19517] Crash when peeps try to exit or enter hacked rides that have no waypoints specified.
- Fix: [#19524] Staff counter shows incorrect values if there are more than 32767 staff members.
- Fix: [#19574] Handle exits in null locations.
- Fix: [#19641, #19643] Missing water tile in Infernal Views’ and Six Flags Holland’s river.
qwzhaox pushed a commit to qwzhaox/OpenRCT2 that referenced this pull request Apr 10, 2023
- Feature: [OpenRCT2#11269] Add properties for speed and length of vehicle animations.
- Feature: [OpenRCT2#15849] Objectives can now be set for up to 50000 guests.
- Feature: [OpenRCT2#18537] Add shift/control modifiers to window close buttons, closing all but the given window or all windows of the same type, respectively.
- Feature: [OpenRCT2#18732] [Plugin] API to get the guests thoughts.
- Feature: [OpenRCT2#18744] Cheat to allow using a regular path as a queue path.
- Feature: [OpenRCT2#19023] Add Canadian French translation.
- Feature: [OpenRCT2#19341] Add “All Scenery” tab to scenery window.
- Feature: [OpenRCT2#19378] Add command to combine CSG1i.DAT and CSG1.DAT.
- Feature: [objects#226] Port RCT1 Corkscrew Coaster train.
- Feature: [objects#229] Port RCT1 go karts with helmets.
- Feature: [OpenMusic#20, OpenMusic#21] Added Blizzard and Extraterresterial ride music styles.
- Improved: [OpenRCT2#11473] Hot reload for plug-ins now works on macOS.
- Improved: [OpenRCT2#12466] RCT1 parks now use RCT1’s interest calculation algorithm.
- Improved: [OpenRCT2#14635] Scenery window now shows up to 255 scenery groups.
- Improved: [OpenRCT2#17288] Reorganise the order of shortcut keys in the Shortcut Keys window.
- Improved: [OpenRCT2#18706] Ability to view the list of contributors in-game.
- Improved: [OpenRCT2#18749] Ability to have 4 active awards for more than one month in a row.
- Improved: [OpenRCT2#18826] [Plugin] Added all actions and their documentation to plugin API.
- Improved: [OpenRCT2#18945] Languages can now fall back to other languages than English.
- Improved: [OpenRCT2#18970] Trying to load a non-park save will now display a context error.
- Improved: [OpenRCT2#18975] Add lift sprites for steep hills on the wooden roller coaster.
- Improved: [OpenRCT2#19044] Added special thanks to RMC and Wiegand to the About page.
- Improved: [OpenRCT2#19131] Track missing objects when selecting scenery groups in console.
- Improved: [OpenRCT2#19253] Queue junctions drawn properly when using regular paths as queue. Note: Requires using tile inspector to indicate railings can be used at T or X junctions.
- Improved: [OpenRCT2#19067] New Ride window now allows filtering similarly to Object Selection.
- Improved: [OpenRCT2#19272] Scenery window now allows filtering similarly to Object Selection.
- Improved: [OpenRCT2#19447] The control key now enables word jumping in text input fields.
- Improved: [OpenRCT2#19463] Added ‘W’ and ‘Y’ with circumflex to sprite font (for Welsh).
- Improved: [OpenRCT2#19549] Enable large address awareness for 32 bit Windows builds allowing to use 4 GiB of virtual memory.
- Improved: [OpenRCT2#19668] Decreased the minimum map size from 13 to 3.
- Improved: [OpenRCT2#19683] The delays for ride ratings to appear has been reduced drastically.
- Improved: [OpenRCT2#19697] “Show guest purchases” will now work in multiplayer.
- Change: [OpenRCT2#19018] Renamed actions to fit the naming scheme.
- Change: [OpenRCT2#19091] [Plugin] Add game action information to callback arguments of custom actions.
- Change: [OpenRCT2#19233] Reduce lift speed minimum and maximum values for “Classic Wooden Coaster”.
- Removed: [OpenRCT2#19520] Support for Windows Vista systems.
- Fix: [OpenRCT2#474] Mini golf window shows more players than there actually are (original bug).
- Fix: [OpenRCT2#592] Window scrollbar not able to navigate to the end of large lists.
- Fix: [OpenRCT2#7210] Land tile smoothing occurs with edge tiles (original bug).
- Fix: [OpenRCT2#17996] Finances window not cleared when starting some .park scenarios.
- Fix: [OpenRCT2#18260] Crash opening parks that have multiple tiles referencing the same banner entry.
- Fix: [OpenRCT2#18467] “Selected only” Object Selection filter is active in Track Designs Manager, and cannot be toggled.
- Fix: [OpenRCT2#18904] OpenRCT2 audio object accidentally exported in saves.
- Fix: [OpenRCT2#18905] Ride Construction window theme is not applied correctly.
- Fix: [OpenRCT2#18911] Mini Golf station does not draw correctly from all angles.
- Fix: [OpenRCT2#18971] New Game does not prompt for save before quitting.
- Fix: [OpenRCT2#18986] [Plugin] Sending remote scripts larger than 63KiB crashing all clients.
- Fix: [OpenRCT2#18994] Title music doesn’t start after enabling master volume.
- Fix: [OpenRCT2#19025] Park loan behaves inconsistently with non-round and out-of-bounds values.
- Fix: [OpenRCT2#19026] Park loan is clamped to a 32-bit integer.
- Fix: [OpenRCT2#19068] Guests may not join queues correctly.
- Fix: [OpenRCT2#19091] [Plugin] Remote plugins in multiplayer servers do not unload properly.
- Fix: [OpenRCT2#19112] Clearing the last character in the Object Selection filter does not properly reset it.
- Fix: [OpenRCT2#19112] Text boxes not updated with empty strings in Track List, Server List, and Start Server windows.
- Fix: [OpenRCT2#19114] [Plugin] ‘GameActionResult’ does not comply to API specification.
- Fix: [OpenRCT2#19136] SV6 saves with experimental RCT1 paths not imported correctly.
- Fix: [OpenRCT2#19243] .park scenarios don’t complete properly.
- Fix: [OpenRCT2#19250] MusicObjects do not free their preview images.
- Fix: [OpenRCT2#19292] Overflow in ‘totalRideValue’.
- Fix: [OpenRCT2#19339] Incorrect import of crashed particles from SV4.
- Fix: [OpenRCT2#19379] “No platforms” station style shows platforms on the Junior Roller Coaster.
- Fix: [OpenRCT2#19380] Startup crash when no sequences are installed and random sequences are enabled.
- Fix: [OpenRCT2#19391] String corruption caused by an improper buffer handling in ‘GfxWrapString’.
- Fix: [OpenRCT2#19434, OpenRCT2#19509] Object types added by OpenRCT2 do not get removed when executing ‘remove_unused_objects’.
- Fix: [OpenRCT2#19475] Cannot increase loan when more than £1000 in debt.
- Fix: [OpenRCT2#19493] SV4 saves not importing the correct vehicle colours.
- Fix: [OpenRCT2#19517] Crash when peeps try to exit or enter hacked rides that have no waypoints specified.
- Fix: [OpenRCT2#19524] Staff counter shows incorrect values if there are more than 32767 staff members.
- Fix: [OpenRCT2#19574] Handle exits in null locations.
- Fix: [OpenRCT2#19641, OpenRCT2#19643] Missing water tile in Infernal Views’ and Six Flags Holland’s river.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plug-in Related to the plugin system of OpenRCT2. plugin api version Plugin API version needs updating - double check before merging!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants