Skip to content

[Plugin] Implement plugin getters for track and vehicle subpositions#17821

Merged
Gymnasiast merged 3 commits into
OpenRCT2:developfrom
Basssiiie:plugin-tracksegment-subposition-length
Sep 7, 2022
Merged

[Plugin] Implement plugin getters for track and vehicle subpositions#17821
Gymnasiast merged 3 commits into
OpenRCT2:developfrom
Basssiiie:plugin-tracksegment-subposition-length

Conversation

@Basssiiie

@Basssiiie Basssiiie commented Aug 14, 2022

Copy link
Copy Markdown
Member

Hey all,

I've been experimenting with the track iterator implemented in #16975 and I've been trying to use it to calculate trackProgress-distance between two vehicles. For this I need to know how long track pieces can be, and while there is TrackSegment.length, this is just an arbitrary number for each track piece and not an exact upper bound for trackProgress.

Thus, hereby a PR that exposes this upper bound, the subposition coordinates, and a new property for Car to get which subposition it is currently using.

  • I wasn't sure about exposing vehicle_get_move_info_size() in the header file, but it seemed better than copy/pasting the contents. But if you have a better suggestion, I'd love to hear it.
  • The TrackSubposition properties angle and banking are called that way to be consistent with the properties already present in TrackSegment.
  • I also changed the type of CoordsXYZD.direction to be more compatible with all other uses of Direction. (This affects just the Typescript side, and thus is not a breaking change.)

Thank you for your time!

@Basssiiie Basssiiie force-pushed the plugin-tracksegment-subposition-length branch from 447be7c to dc0c931 Compare August 14, 2022 19:11
@frutiemax

Copy link
Copy Markdown
Contributor

Related to #16964

@Basssiiie

Copy link
Copy Markdown
Member Author

@frutiemax ah I hadn't seen that one. Would that PR have any effect on the external Javascript API? I see the different subposition numbers are still a thing, right? Or are there plans to deprecate the subposition type numbers any time in the future?

@frutiemax

Copy link
Copy Markdown
Contributor

I don't think #16964 has any impact on the javascript api tbh, I thought this PR would use the arrays with the subpositions but it isn't.

@Basssiiie

Copy link
Copy Markdown
Member Author

@frutiemax Would there be problems IF subpositions would be implemented in a similar fashion?

I'm trying to avoid issues where parts of the plugin API need to be deprecated again because of known future plans.

@frutiemax

Copy link
Copy Markdown
Contributor

I don't really know about that, maybe @Gymnasiast can answer this?

@Gymnasiast

Copy link
Copy Markdown
Member

No, I’m afraid I don’t know a great deal about that area.

@Basssiiie

Copy link
Copy Markdown
Member Author

I ended up implementing the subposition coordinates API myself as well. :)

@Basssiiie Basssiiie changed the title [Plugin] Implement plugin getters for subposition and subposition length [Plugin] Implement plugin getters for track and vehicle subpositions Aug 19, 2022
@Basssiiie Basssiiie force-pushed the plugin-tracksegment-subposition-length branch from 0ceabce to b9b646d Compare August 19, 2022 20:15
Comment thread src/openrct2/scripting/bindings/ride/ScTrackSegment.cpp
dukSubposition.Set("x", value.x);
dukSubposition.Set("y", value.y);
dukSubposition.Set("z", value.z);
dukSubposition.Set("direction", value.direction);

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 would prefer it expose it as yaw, pitch and roll as that is the names ideally the codebase should be using.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I can rename them but, as mentioned in the main post, it would add inconsistency with the already existing external plugin API use of 'angle', 'slope' and 'banking' here. Is that inconsistency preferred over the current one?

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.

those are for tracks though its a different incomparable property this is for vehicles.

@Basssiiie Basssiiie Aug 21, 2022

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

In the end they're the same slope/banking/pitching values. 😛 But alright, I'll rename them.

Edit: actually, the direction does actually use different values. The other two don't though.

@Basssiiie Basssiiie force-pushed the plugin-tracksegment-subposition-length branch from d6c9fe1 to fa37b94 Compare August 21, 2022 20:11
@Basssiiie Basssiiie force-pushed the plugin-tracksegment-subposition-length branch from ab2073c to 79c4cd0 Compare September 2, 2022 21:19
@Basssiiie Basssiiie force-pushed the plugin-tracksegment-subposition-length branch from 79c4cd0 to 885be63 Compare September 3, 2022 07:34
@Gymnasiast Gymnasiast merged commit 1956b71 into OpenRCT2:develop Sep 7, 2022
@tupaschoal tupaschoal added this to the v0.4.2 milestone Sep 7, 2022
Gymnasiast added a commit that referenced this pull request Oct 5, 2022
- Feature: [#6326] Ability to load .SV6 files from RCT Classic that have more than 9601 guests.
- Feature: [#6570, #10860, #17929] Fully support RollerCoaster Tycoon Classic as a RCT2 base install path.
- Feature: [#13634] Add ability to sell merchandise in random colours.
- Feature: [#16164] Add new track elements for Flying Coaster and Lay-Down Coaster and add paint code for more elements.
- Feature: [#16283] Added parkinfo command line tool to list objects in a save file.
- Feature: [#16662] Show a warning message when g2.dat is mismatched.
- Feature: [#17107] Ride operating settings can be set via text input.
- Feature: [#17638] Added Zero G rolls, medium loops and large corkscrews to the Hybrid and Single-Rail coasters.
- Feature: [#17821] [Plugin] Add API for track subpositions and vehicle subposition.
- Feature: [#17877] Add three real-life flying roller coaster colour schemes.
- Feature: [#17900] Add “Classic Wooden Coaster” with shallow banked turns.
- Feature: [#18057] Staff members now wait for passing or stalled vehicles before crossing railway tracks.
- Feature: [#18168] Add additional track pieces to the LIM Launched Coaster and the Looping Coaster.
- Feature: [objects#198] Add additional pirate roofs.
- Feature: [objects#205] Add additional glass roofs.
- Feature: [objects#209] Add the Steel Roller Coaster train and 2-across Inverted Train from RollerCoaster Tycoon 1.
- Feature: [#18050] Add asset pack manager and asset packs.
- Improved: [#15358] Park and scenario names can now contain up to 128 characters.
- Improved: [#15589] Numpad Enter can now be used to close text input.
- Improved: [#16819] Don’t prompt to “Save game as” when saving a loaded saved game (excepting autosaves).
- Improved: [#16840] Add support for rectangular heightmaps.
- Improved: [#17575] You can now search for Authors in Object Selection.
- Improved: [#17806] Added warning when using RCT1 objects without RCT1 linked.
- Improved: [#17868] [Plugin] You can now change active tab of a custom window programmatically.
- Improved: [#17909] Track elements that are not supported by any train are now hidden by default.
- Improved: [#17924] Improved performance when loading JSON object images from a .DAT file.
- Improved: [#17955] Modifying ratings via in-game console is now multiplayer-safe and also freezes the ratings.
- Improved: [#18177] [Plugin] Widget tooltips can now be read and changed.
- Change: [#9104] Calculate maze support costs.
- Change: [#17319] Giant screenshots are now cropped to the horizontal view-clipping selection.
- Change: [#17499] Update error text when using vehicle incompatible with TD6 and add error when using incompatible track elements.
- Change: [#17655] Lower default price for the Crooked House.
- Change: [#17745] Make maintenance cost of Mini-Golf more balanced.
- Change: [#17762] Use vertical tabs in the New Game dialog.
- Change: [#18113] Increased limit of Loan Interest in Scenario Editor to 255%.
- Fix: [#5141] Headless server is counted as a player.
- Fix: [#7466] Coaster track not drawn at tunnel exit.
- Fix: [#10535] Guests getting stuck at specific level crossings.
- Fix: [#14337] Guest blocking ride entrance after ride price changed to be unaffordable.
- Fix: [#15328] Wooden Roller Coaster incorrectly draws a railing on the first station piece (original bug).
- Fix: [#16392] Scenery on sloped surface is placed at wrong height.
- Fix: [#16476] The game sometimes crashes when demolishing a maze.
- Fix: [#17053] Crash when trying to open files under 4 bytes in length.
- Fix: [#17312] (Flying) Inline Twist appearing under the surface when placed on ground level.
- Fix: [#17339] Distorted visuals when changing scaling factor between integer numbers in OpenGL rendering mode.
- Fix: [#17394] Six-seater Hyper-Twister Trains focuses ride window camera on Car 2 rather than Car 1 (original bug).
- Fix: [#17430] Possible crash when toggling tile element visibility in multiplayer.
- Fix: [#17444] “Manta Ray” boats slowed down too much in “Ayers Rock” scenario (original bug).
- Fix: [#17503] Parks with staff with an ID of 0 have all staff windows focus on that staff.
- Fix: [#17508] Grid doesn’t disable after setting patrol area.
- Fix: [#17532] Object Selection window allows unselecting all station types.
- Fix: [#17533] Missing audio when specifying ‘--rct2-data-path’.
- Fix: [#17535] Multiplayer desync when placing rides with scenery.
- Fix: [#17541] Station style not correctly saved to TD6.
- Fix: [#17542] Stalls will autorotate towards paths outside the park.
- Fix: [#17544, #17754] Visual glitches in Invention List window.
- Fix: [#17553] Crash when moving invention list items to empty list.
- Fix: [#17571] All researched tracked rides show up as new vehicles in .park scenarios.
- Fix: [#17600] Notifications are not properly cleared when loading a park.
- Fix: [#17605] Crash when opening parks which have had objects removed externally.
- Fix: [#17639, 17735] When building upside down, the special elements list contains many items twice (original bug).
- Fix: [#17664] Unable to save after an extended period of time due to inactive ride music data leaking.
- Fix: [#17703] (undefined string) when building on invalid height.
- Fix: [#17776] “Other Parks” tab uses separate lists for SC4/SC6 and .park scenarios.
- Fix: [#17784] Colour preset RNG is biased (original bug).
- Fix: [#17788] Guests could leave queue if another guest rejoins it from the entrance building.
- Fix: [#17834] Finance window becomes blank after 4096 years.
- Fix: [#17816] Option to pause game when Steam Overlay is active is not greyed out when using the OpenGL renderer.
- Fix: [#17897] Guest can get stuck on tiles with construction rights outside the park.
- Fix: [#17904] Trees are removed at no cost to make way for ride entrance/exits.
- Fix: [#17905] The chain button in the map window is enabled for rectangular maps when (re)opened.
- Fix: [#17931] The in-game command ‘count_objects’ crashes the game.
- Fix: [#17865] With difficult guest generation, tested but unopened rides still contribute to the guest cap.
- Fix: [#17866] [Plugin] Wrong Soft Guest Cap at start of new game.
- Fix: [#17889] Peeps don’t stop at level railway crossings if approached from downhill.
- Fix: [#17980] Queue lines of track designs mess up existing queue lines if dragged through them.
- Fix: [#17959] Areas marked for dirty drawing are too large.
- Fix: [#17963] Some marketing campaigns can’t be started after Finances window tab has been on Research.
- Fix: [#17964] Sprites don’t show up on two sides of the view-clip selection.
- Fix: [#17966] Reversed steel trains do not properly import from S4.
- Fix: [#17973] Bins and lamps overlay parts of the land (original bug).
- Fix: [#18008] Steeplechase S-bends has multiple gaps visible in the tracks (original bug).
- Fix: [#18009] Visual glitch with litter at edge of sloped path.
- Fix: [#18025] Fix land ownership in Six Holland, Six Flags Magic Mountain, North America - Grand Canyon and Asia - Great Wall of China Tourism Enhancement scenarios.
- Fix: [#18026] Park rating drops to 0 with more than 32k guests, total ride excitement or intensity.
- Fix: [#18032] All non-interactive widgets (labels, groupboxes) produce sound when clicked.
- Fix: [#18035] Favourited servers don’t get their online status updated.
- Fix: [#18051] Visual glitch with Mine Ride’s large unbanked turn (original bug).
- Fix: [#18059] [Plugin] Width and height of custom window not changeable via script.
- Fix: [#18063] Guests can stop for all kinds of actions at railway crossing.
- Fix: [#18087] Bank balance is clamped to a 32-bit integer every transaction.
@Basssiiie Basssiiie deleted the plugin-tracksegment-subposition-length branch August 2, 2024 19:29
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.

6 participants