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 research plugin API #19930

Merged
merged 9 commits into from Apr 21, 2023
Merged

Add research plugin API #19930

merged 9 commits into from Apr 21, 2023

Conversation

IntelOrca
Copy link
Contributor

@IntelOrca IntelOrca commented Apr 14, 2023

New APIs:

interface Park {
    ...
    readonly research: Research;
}

interface Research {
    inventedItems: ResearchItem[];
    uninventedItems: ResearchItem[];
    funding: ResearchFundingLevel;
    priorities: ResearchCategory[];
    stage: ResearchFundingStage;
    progress: number;
    readonly lastResearchedItem: ResearchItem | null;
    readonly expectedItem: ResearchItem | null;
    readonly expectedMonth: number | null;
    readonly expectedDay: number | null;

    isObjectResearched(type: ObjectType, index: number): boolean;
}

type ResearchItem = RideResearchItem | SceneryResearchItem;

interface RideResearchItem {
    readonly type: "ride";
    readonly category?: ResearchCategory;
    readonly rideType: number;
    readonly object: number;
}

interface SceneryResearchItem {
    readonly category?: ResearchCategory.SceneryGroup;
    readonly type: "scenery";
    readonly object: number;
}

type ResearchItemType = "scenery" | "ride";

type ResearchCategory =
    "transport" |
    "gentle" |
    "rollercoaster" |
    "thrill" |
    "water" |
    "shop" |
    "scenery";

enum ResearchFundingLevel {
    None,
    Minimum,
    Normal,
    Maximum
}

type ResearchFundingStage =
    "initial_research" |
    "designing" |
    "completing_design" |
    "unknown" |
    "finished_all";

Copy link

@StephanSpengler StephanSpengler left a comment

Choose a reason for hiding this comment

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

Did not test ingame.

distribution/openrct2.d.ts Show resolved Hide resolved
distribution/openrct2.d.ts Outdated Show resolved Hide resolved
distribution/openrct2.d.ts Outdated Show resolved Hide resolved
distribution/openrct2.d.ts Outdated Show resolved Hide resolved
src/openrct2/scripting/bindings/world/ScResearch.hpp Outdated Show resolved Hide resolved
src/openrct2/scripting/bindings/world/ScResearch.hpp Outdated Show resolved Hide resolved
src/openrct2/scripting/bindings/world/ScResearch.hpp Outdated Show resolved Hide resolved
src/openrct2/scripting/bindings/world/ScResearch.hpp Outdated Show resolved Hide resolved
src/openrct2/scripting/bindings/world/ScResearch.hpp Outdated Show resolved Hide resolved
@rolfhermancoen
Copy link

The thing I am kind of missing is the current project that is being researched, this could be null/undefined or the ride/scenery. Would make it easier to work with for plugin developers. Other than that, this looks promising :)

@IntelOrca
Copy link
Contributor Author

All comments resolved, categories are now strings everywhere.

Copy link
Member

@Basssiiie Basssiiie left a comment

Choose a reason for hiding this comment

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

LGTM 😄

@duncanspumpkin duncanspumpkin added this to the v0.4.5 milestone Apr 21, 2023
@Lastorder-DC
Copy link
Contributor

Lastorder-DC commented Apr 21, 2023

Is there any way to manually mark item for research, except changing uninventedItems and inventedItems? or at least way to post message about research item?

Looks like rawValue of research item is not provided. and supplying neither ResearchItem.object or ResearchItem.rideType not woks for park.postMessage's subject.

because I'm developing some kind of "Gacha" plugin for OpenRCT, which randomly picks any research item and mark as complete, above is needed.

@IntelOrca
Copy link
Contributor Author

IntelOrca commented Apr 21, 2023

@Lastorder-DC not yet, that can be done as a follow up API. It needs to do a bunch of internal state change, handle the case where it is already in the process of being researched, and allow you to provide a ride type and ride object pair.

The post message API will need improving to allow what you want (if the finish research API doesn't post it). I also would like to add a custom subject handler to messages.

@IntelOrca IntelOrca merged commit 713bb09 into OpenRCT2:develop Apr 21, 2023
21 checks passed
janisozaur added a commit that referenced this pull request May 8, 2023
- Feature: [#18713] Block brakes have speed control and brakes slower than adjacent block brakes copy block brake speed when block brake open.
- Feature: [#19276] Add Powered Lifthill to Giga Coaster.
- Feature: [#19305] Add new Reversed Trains ride setting to run trains backwards, granting a bonus to ride ratings.
- Feature: [#19305] [Plugin] Add “Car.isReversed” to allow individual ride vehicles to run backwards.
- Feature: [#19446] Add new color options to color dropdown.
- Feature: [#19547] Add large sloped turns to hybrid coaster and single rail coaster.
- Feature: [#19930] Add plugin APIs for research.
- Feature: [OpenMusic#25] Added Prehistoric ride music style.
- Feature: [OpenMusic#26] Fairground Organ style 2 with new recordings from Herman's 35er Voigt (Previously known as Bressingham Voigt).
- Feature: [OpenMusic#28] Add Ragtime style 2 ride music.
- Improved: [#17739] Raise water and land height limits to 254 units/182m/600ft.
- Improved: [#18490] Reduce guests walking through trains on level crossing next to station.
- Improved: [#18996] When marketing campaigns are disabled, disable the Marketing tab in the Finances window.
- Improved: [#19764] Miscellaneous scenery tab now grouped next to the all-scenery tab.
- Improved: [#19830] “Highlight path issues” will now hide wall elements.
- Improved: [#19905] Add prompt before resetting shortcut keys.
- Improved: [#19952] Add colour preset to Spiral Slide using the new colour options.
- Improved: [#19953] Add keyboard shortcut to Keyboard Shortcuts window.
- Improved: [#20055] Performance improvement for the software renderer.
- Change: [OpenSFX#17] Update Hybrid RC lifthill loop.
- Fix: [#12598] Number of holes is not set correctly when saving track designs.
- Fix: [#13130] Android always defaulting to UK locale for language, currency and temperature.
- Fix: [#13397] Ride simulation causes strange station behaviour and makes the ride unusable in some cases.
- Fix: [#16791] Rotodrop top piece replicates when walls are placed around it and clearance checks are disabled (original bug).
- Fix: [#18583] Land dropdown is incorrect if there are surface entry index holes.
- Fix: [#18895] Responding mechanic blocked at level crossing.
- Fix: [#19231] Crash due to null pointer to previously deleted banner in tile copy/paste functionality.
- Fix: [#19296] Crash due to a race condition for parallel object loading.
- Fix: [#19733] Favorite ride of X guests integer overflow.
- Fix: [#19756] Crash with title sequences containing no commands.
- Fix: [#19767] No message when path is not connected to ride exit and is therefore unreachable for mechanics.
- Fix: [#19800] Crash when displaying station stats with more than 62 stations.
- Fix: [#19801] The in-game load/save window cannot be resized anymore.
- Fix: [#19854] Looping Coaster trains clipping through steep quarter turns down.
- Fix: [#19858] Issue drawing simulate flag icon on alternate colour palettes.
- Fix: [#19901] Random shop colours never assigning last colour.
- Fix: [#19911] Guests stuck at certain railway crossings.
- Fix: [#19924] Destructible cheat does not allow partial ride modification.
- Fix: [#19950] Mine train block brake supports drawn incorrectly.
- Fix: [#19955] Mine Train Roller Coaster has incorrect supports on the sloped left small turn (original bug).
- Fix: [#19987] [Plugin] ‘SetCheatAction’ has wrong ID in plugin API.
- Fix: [#20016] The group box for small scenery details in the Tile Inspector window has unused empty space.
- Fix: [#20018] Shops not calculating up-keep cost.
- Fix: [#20033] Asset packs cannot reference game data.
- Fix: [#20104] [Plugin] Some network APIs use player index and group index.
- Fix: [#20099] Some scrollbar is glitched or have incorrect size when open window for the first time
- Fix: [#20134] Grass length being updated for tiles in the void, causing unneccesary drawing operations.
foodisgoodyesiam added a commit to foodisgoodyesiam/OpenRCT2-sven that referenced this pull request May 9, 2023
Release v0.4.5

- Feature: [OpenRCT2#18713] Block brakes have speed control and brakes slower than adjacent block brakes copy block brake speed when block brake open.
- Feature: [OpenRCT2#19276] Add Powered Lifthill to Giga Coaster.
- Feature: [OpenRCT2#19305] Add new Reversed Trains ride setting to run trains backwards, granting a bonus to ride ratings.
- Feature: [OpenRCT2#19305] [Plugin] Add “Car.isReversed” to allow individual ride vehicles to run backwards.
- Feature: [OpenRCT2#19446] Add new color options to color dropdown.
- Feature: [OpenRCT2#19547] Add large sloped turns to hybrid coaster and single rail coaster.
- Feature: [OpenRCT2#19930] Add plugin APIs for research.
- Feature: [OpenMusic#25] Added Prehistoric ride music style.
- Feature: [OpenMusic#26] Fairground Organ style 2 with new recordings from Herman's 35er Voigt (Previously known as Bressingham Voigt).
- Feature: [OpenMusic#28] Add Ragtime style 2 ride music.
- Improved: [OpenRCT2#17739] Raise water and land height limits to 254 units/182m/600ft.
- Improved: [OpenRCT2#18490] Reduce guests walking through trains on level crossing next to station.
- Improved: [OpenRCT2#18996] When marketing campaigns are disabled, disable the Marketing tab in the Finances window.
- Improved: [OpenRCT2#19764] Miscellaneous scenery tab now grouped next to the all-scenery tab.
- Improved: [OpenRCT2#19830] “Highlight path issues” will now hide wall elements.
- Improved: [OpenRCT2#19905] Add prompt before resetting shortcut keys.
- Improved: [OpenRCT2#19952] Add colour preset to Spiral Slide using the new colour options.
- Improved: [OpenRCT2#19953] Add keyboard shortcut to Keyboard Shortcuts window.
- Improved: [OpenRCT2#20055] Performance improvement for the software renderer.
- Change: [OpenSFX#17] Update Hybrid RC lifthill loop.
- Fix: [OpenRCT2#12598] Number of holes is not set correctly when saving track designs.
- Fix: [OpenRCT2#13130] Android always defaulting to UK locale for language, currency and temperature.
- Fix: [OpenRCT2#13397] Ride simulation causes strange station behaviour and makes the ride unusable in some cases.
- Fix: [OpenRCT2#16791] Rotodrop top piece replicates when walls are placed around it and clearance checks are disabled (original bug).
- Fix: [OpenRCT2#18583] Land dropdown is incorrect if there are surface entry index holes.
- Fix: [OpenRCT2#18895] Responding mechanic blocked at level crossing.
- Fix: [OpenRCT2#19231] Crash due to null pointer to previously deleted banner in tile copy/paste functionality.
- Fix: [OpenRCT2#19296] Crash due to a race condition for parallel object loading.
- Fix: [OpenRCT2#19733] Favorite ride of X guests integer overflow.
- Fix: [OpenRCT2#19756] Crash with title sequences containing no commands.
- Fix: [OpenRCT2#19767] No message when path is not connected to ride exit and is therefore unreachable for mechanics.
- Fix: [OpenRCT2#19800] Crash when displaying station stats with more than 62 stations.
- Fix: [OpenRCT2#19801] The in-game load/save window cannot be resized anymore.
- Fix: [OpenRCT2#19854] Looping Coaster trains clipping through steep quarter turns down.
- Fix: [OpenRCT2#19858] Issue drawing simulate flag icon on alternate colour palettes.
- Fix: [OpenRCT2#19901] Random shop colours never assigning last colour.
- Fix: [OpenRCT2#19911] Guests stuck at certain railway crossings.
- Fix: [OpenRCT2#19924] Destructible cheat does not allow partial ride modification.
- Fix: [OpenRCT2#19950] Mine train block brake supports drawn incorrectly.
- Fix: [OpenRCT2#19955] Mine Train Roller Coaster has incorrect supports on the sloped left small turn (original bug).
- Fix: [OpenRCT2#19987] [Plugin] ‘SetCheatAction’ has wrong ID in plugin API.
- Fix: [OpenRCT2#20016] The group box for small scenery details in the Tile Inspector window has unused empty space.
- Fix: [OpenRCT2#20018] Shops not calculating up-keep cost.
- Fix: [OpenRCT2#20033] Asset packs cannot reference game data.
- Fix: [OpenRCT2#20104] [Plugin] Some network APIs use player index and group index.
- Fix: [OpenRCT2#20099] Some scrollbar is glitched or have incorrect size when open window for the first time
- Fix: [OpenRCT2#20134] Grass length being updated for tiles in the void, causing unneccesary drawing operations.
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

8 participants