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

Implement plugin system #11320

Merged
merged 159 commits into from Apr 26, 2020
Merged

Implement plugin system #11320

merged 159 commits into from Apr 26, 2020

Conversation

IntelOrca
Copy link
Contributor

Closes #3166: Plugins Support For Server

@tupaschoal tupaschoal modified the milestone: v0.2.7 Consideration Apr 19, 2020
Copy link
Member

@Gymnasiast Gymnasiast left a comment

Choose a reason for hiding this comment

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

"Things" need to be renamed to "Entities"

@IntelOrca IntelOrca force-pushed the epic/plug-in-4 branch 5 times, most recently from 17ae39a to 0651c20 Compare April 21, 2020 18:38
@Gymnasiast Gymnasiast dismissed their stale review April 21, 2020 18:41

Request has been implemented

Copy link
Member

@Gymnasiast Gymnasiast left a comment

Choose a reason for hiding this comment

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

Apart from the (now addressed) compilation error, I didn't notice any problems from just running it without any plug-ins.

I think we should just merge it and have people work with it. After all, it's just after the 0.2.6 release, so plenty of time to iron out the creases.

.github/workflows/ci.yml Show resolved Hide resolved
distribution/scripting.md Outdated Show resolved Hide resolved
distribution/scripting.md Outdated Show resolved Hide resolved
distribution/scripting.md Outdated Show resolved Hide resolved
distribution/scripting.md Outdated Show resolved Hide resolved
src/openrct2/scripting/ScTile.hpp Outdated Show resolved Hide resolved
src/openrct2/scripting/ScTile.hpp Show resolved Hide resolved
src/openrct2/scripting/ScTile.hpp Outdated Show resolved Hide resolved
src/openrct2/scripting/ScTile.hpp Outdated Show resolved Hide resolved
src/openrct2/scripting/ScTile.hpp Outdated Show resolved Hide resolved
@IntelOrca IntelOrca force-pushed the epic/plug-in-4 branch 2 times, most recently from 5c05ed4 to 4299de8 Compare April 22, 2020 15:13
@janisozaur janisozaur self-requested a review April 22, 2020 17:34
@IntelOrca IntelOrca force-pushed the epic/plug-in-4 branch 2 times, most recently from 3135a52 to 5803cc0 Compare April 22, 2020 22:27
Copy link
Member

@tupaschoal tupaschoal left a comment

Choose a reason for hiding this comment

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

Thanks for taking my issues into consideration, I'll assume you went over them all, as they're resolved (except the one to create the issue for mingw, which I'm guessing you'll file after merging)

Copy link
Contributor

@brenoguim brenoguim left a comment

Choose a reason for hiding this comment

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

I have yet little knowledge on the code base so I just passed my eyes fishing for C++ patterns I can recognize.

One of the things I didn't mark but I would review is the passing of std::shared_ptr by copy on parameters. They are cheap but involve incrementing/decrementing reference counters which can be a paper cut :)

src/openrct2/scripting/HookEngine.cpp Outdated Show resolved Hide resolved
src/openrct2/scripting/HookEngine.h Outdated Show resolved Hide resolved
src/openrct2/scripting/ScContext.hpp Outdated Show resolved Hide resolved
src/openrct2/scripting/ScContext.hpp Outdated Show resolved Hide resolved
src/openrct2/scripting/ScDisposable.hpp Outdated Show resolved Hide resolved
src/openrct2/scripting/ScNetwork.hpp Outdated Show resolved Hide resolved
src/openrct2/scripting/ScNetwork.hpp Outdated Show resolved Hide resolved
src/openrct2/scripting/ScriptEngine.cpp Show resolved Hide resolved
src/openrct2/scripting/ScriptEngine.h Outdated Show resolved Hide resolved
@IntelOrca IntelOrca force-pushed the epic/plug-in-4 branch 2 times, most recently from 6c21ced to 4ad4caa Compare April 23, 2020 18:45
Copy link
Member

@janisozaur janisozaur left a comment

Choose a reason for hiding this comment

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

I tried reading the code, at least openrct2 part of it, but i'm certain there were spots i missed and I can't claim I understand all of it. The gist of it looks good, though I have some requests.

distribution/scripting.md Outdated Show resolved Hide resolved
distribution/scripting.md Outdated Show resolved Hide resolved

> Is there a good place to distribute my script to other players?

There is currently no official database for this. For now the recommendation is to upload releases of your script on GitHub alongside your source code (if public). Some people like to make a GitHub repository that just consists of a list of content (scripts in this case) which anyone can add to via pull requests.
Copy link
Member

Choose a reason for hiding this comment

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

There is nothing about versioning of the plugin wrt OpenRCT2 itself. While we can recommend people implement checks for OpenRCT2 tagged version, perhaps we can enforce it in the plugin manifest? OpenRCT2 version would be a rather coarse-grained check, and I'm not fond of adding another one next to network version, so we could use that instead? For networkless builds this is currently set to something like "no multiplayer", but could be easily exposed as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a minimum API version you can specify on the plugin which corresponds to another number we can change in the code base. Is this what you meant?

src/openrct2-ui/interface/InGameConsole.h Outdated Show resolved Hide resolved
src/openrct2-ui/interface/Widget.cpp Show resolved Hide resolved

DukObject(const DukObject&) = delete;

DukObject(DukObject&& m) noexcept
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't that imply presence of operator=(DukObject&& other)?

public:
DukContext();
DukContext(DukContext&) = delete;
DukContext(DukContext&& src) noexcept
Copy link
Member

Choose a reason for hiding this comment

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

move assignment too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what you mean. This is a move assignment constructor?

src/openrct2/scripting/Plugin.h Outdated Show resolved Hide resolved
src/openrct2-ui/scripting/ScUi.hpp Outdated Show resolved Hide resolved
src/openrct2/scripting/Plugin.h Outdated Show resolved Hide resolved
@janisozaur
Copy link
Member

I suppose I should've been more specific: does any of the getters mutate its object?

@IntelOrca
Copy link
Contributor Author

@janisozaur A lot of them won't but can't say for certain.

@janisozaur
Copy link
Member

Err on the const side then.

Copy link
Member

@janisozaur janisozaur left a comment

Choose a reason for hiding this comment

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

Dukglue and duktape need to be properly documented in file with the licenses of used projects.

Also dukglue needs documentation on where it was obtained and in which version

@AaronVanGeffen
Copy link
Member

We should probably create the 'plugin' folder in the config folder if it doesn't exist yet. At least I had to manually create one (and initially used 'plugins' rather than 'plugin'…)

Copy link
Member

@janisozaur janisozaur left a comment

Choose a reason for hiding this comment

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

I still have some requests:

  1. Tests
  2. Uploading plugins tobacktrace
  3. Replay+plugin

and while I'd love to have this issues addressed in the pull request introducing those features, I realise how much effort must've went into preparing current state and fixing those means another(?) indefinite postponing of long awaited feature that seems to work. Let's not forget to file issues for the topics mentioned to be fixed later on.

@IntelOrca IntelOrca merged commit f9909e7 into OpenRCT2:develop Apr 26, 2020
@janisozaur
Copy link
Member

ping @pkubaj @PureTryOut @joepie91 @geistesk @ibara this adds new dependency: duktape.

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.

Plugins Support For Server
8 participants