I have just started plugin development. I was wondering if there is an existing plugin which creates a preset building at a designated spot.
If not, I am thinking of developing one. Is it possible to programmatically place walls, pillars, roofs, etc? Is there an API documentation, which lists Rust classes and methods?
Generating buildings at locations?
Discussion in 'Rust Development' started by sparkymat, Feb 16, 2016.
-
Yes, it is possible to programmatically place entities. Check the source code of plugins like build, copy paste or several other plugins to see how this works.
There isn't any API documentation except for Oxide itself, which you can find at Rust.
Oxide is just a third party thing that Rust itself doesn't care about much, there is no documentation.
Your decompiler is your documentation tool. -
Thank you for pointing them out. I have seen copy-paste being used on a server. I will look at the code for that one. Which is what I have done so far. I wrote my first plugin by looking at the code of other plugins, to figure out how to get various data.
I would like to help improve the documentation. I should probably contribute to GitHub - OxideMod/Docs: API documentation for the Oxide mod framework. -
The docs are specifically for the Oxide API, not for what Rust does.
Docs for Rust itself would be incredibly hard to maintain because you'd be relying on the ENTIRE implementation of the Rust server side, which changes every week.
The Oxide API is pretty much static and not dependent on Rust implementation changes, which is why there is documentation for that, but not for Rust. -
That's a good point. Maybe I can look into hosting it elsewhere.
-
Maybe there's a point in collecting best-practice code examples for the most common use cases somewhere, but certainly not in documenting the entire thing.
Then you've also got the issue that the languages that Oxide implements still differ in some ways, so you'd often have to provide different code examples for different languages, as they aren't always directly translatable. -
I was thinking of only documenting C# classes, since there is a performance advantage to developing plugins in C# (AFAIK). If I can devise a test plugin which I can run on my server which validates the classes and methods that are documented, we can test across releases whether it needs updating.
-
Wulf Community Admin
Plugins won't compile if things change. We already have test plugins we use to test hooks and such as well.
As far as docs for each game's classes go, we'll likely have generated docs eventually, and Oxide's actual API will be wrapping more as we get time to add to it. -
Do you suggest that I don't waste time on this?
-
Sure there is, but it isn't essentially relevant to every plugin (mostly just for plugins that work very frequently, like Rust:IO).
Again, keep in mind that you'd have to test the entire implementation of Rust, which you essentially have full access to.
Also, it's pretty hard to properly test the implementation further than whether it compiles - you often rely on implementation details that may change, but will still compile, just fail at runtime.
I don't think it's worth the effort - finding things you need isn't that difficult with a decompiler.
Examples might be a good idea, but I certainly wouldn't spend that much effort on documenting the implementation of an alpha that changes each week. -
I am reluctant to completely abandon this idea, since I find it annoying looking through decompiled code instead of a indexed, searchable API doc.
That being said, like sqroot, maybe it would make more sense documenting best practices, or even snippets, for frequently used things.
For example,
position of a player -
name of the player -
etc.
