Hi everybody,
i've found it useful to share a small and fast solution to start your career as an succesful and effective Rust plugin developer.
This Guide aims on the developing on your local Windows client.
This guide is not intended to be used on a linux machine or on a remote server.
It would only work on a remote "windows" server with full access to the machine (remote desktop or similar).
First of all, you need to get the server files into a folder on your client:
For this i've prepared the needed files and scripts:
Download this archive to your client: RustDev.zip
VirusTotal analysis to the file: RustDev-check-result
As of the fact, that it consists of 3 executables, its always a good hint, to re-check any files by yourself which are provided on the web
Once downloaded,create anywhere on the root of a drive a folder, for example "RustDev", and extract the content of the archive to it.
The result should look like this:
Inside the folder "_Updater" you'll find this:
On first start, you need to download the needed files, which is done by running "update.bat".
this file runs steamcmd to download first the steamfiles needed, and then it downloads the Rust server files to the folder "rustds".
Second it will download, unzip and patch your server-files with the current oxide version, and delete the downloaded Oxide-Rust.zip after being copied to "rustds".
The "update.bat" file consists of this code:
The result will look then like this in the folder "rustds":Code:@echo off cls :startcd _Updater cd steam steamcmd.exe +runscript ../update_script.txt cd ..wget.exe -O oxide\Oxide-Rust.zip https://github.com/OxideMod/Snapshots/blob/master/Oxide-Rust.zip?raw=true 7za.exe x oxide\Oxide-Rust.zip -oOxide\Oxide-Rust del oxide\Oxide-Rust.zip xcopy oxide\Oxide-Rust ..\rustds /e /y rd oxide\Oxide-Rust /s /q cd ..
Now you would be ready to start your dev-server with the map "craggy-island" by running "run_craggy_dev.bat"
This file has this content:
INFO on starting local dev server: With current version it seems to be needed to start FIRST your Rust client and AFTERWARDS the server. Before the patches from June'16 it was possible to start the client when server was running before. This seems atm not more possible.Code:@echo off cls :startcd rustds cls RustDedicated -batchmode -nographics +server.level "CraggyIsland" +server.hostname "__Craggy DEV Server" +server.identity "craggy" +server.maxplayers 5 +rcon.password "12345" +rcon.port 28016 +server.ip 0.0.0.0@echo. @echo Restarting server... @echo. cd .. goto start
The file "run_craggy_dev.bat" will always reload the server on commands like restart or quit, is its somtetimes needed to have a clean restart after you've produced a loop or looping exceptions
A save exit to close the server/batch is best be done of using "ctrl+c" and to approve this with "y".
Once the server and client are running, you can connect to your local server by hitting F1 and type into console: "client.connect 127.0.0.1:28015"
To give yourself ownerrights on your server, hit into serverconsole "ownerid <your steamid>" followed by "writecfg" and restart the server by "restart 0" or "quit".
Your first plugin needs to be placed insde the right folder: RustDev\rustds\server\craggy\oxide\plugins
The need basic code for this will be found in the Oxide-docs: Oxide API for Rust
This simple example will look like this:
"Unknown" should be replaced by your name you want to choose.Code:namespace Oxide.Plugins { [Info("EpicPlugin", "Unknown", 0.1)] // << "EpicPlugin is the name, needs your plugin name, obey the Capital letter at start [Description("Makes epic stuff happen")] class EpicPlugin : RustPlugin // << "EpicPlugin needs to be changed to your plaugin name too { // The rest of the code and magic } }
This file needs to be saved inside the oxide\plugins folder, inm this example it must be called "EpicPlugin.cs".
A good place to start would be the Oxide API for Rust
This should be your first source for getting conform with all the hooks which are available to be used to create your stuff you want to happen by your plugin.
A deeper dive into the hooks is the following page, but its usage would require a deeper knowlegde: GitHub Oxide.Game.Rust/Rust.opj
Second of all its always good to know the Unity-docs scriptreference: Unity ScriptReference
Additonally its always a good practice to look into what others have created in their plugins. Most times another developer had used a similar function before, what could nearly that what you want to do. In my first days ongiong to develop, my beat source for learning C# was oxide itself and their lot of plugins, to show my the right direction, whats possible to do within.
Create yourself for the beginning a local plugin repository, and take this as your reference.
This is best used with a grep-search tool. Those are able to search in complete texts and to show you on the results in advance snippets/fragments, what simplifies it to identitfy/find the right code-fragments, you could try or need.
Some example Grep-Tools:
sqroot did also write down a comprehensive link collection in this post
[GUIDE] How to develop on your local dev-machine
Discussion in 'Rust Development' started by FuJiCuRa, Jun 25, 2016.
-
- spacer -
-
-
-
I think, additionally a quick guide for decompiling should be one right addtion to this.
And debugging, how to dive into this, is almost some semtences worth, i think -
At this point I think one of the most lacking things is library documentation, which is best added via the Docs repo. -
Many years in costumer support teached me to explain things like "changes in IT" with included pictures, this increases the ability to consume the information faster then instead only by reading boring text (seen from the users view)