Closed bleehu closed 4 years ago
Why don't you just write a plugin...
You mean an IRocketPlugin
? I'm trying to keep the server itself completely vanilla. I think it attracts more players that way. A plugin would be a good backup option though if I really can't get command I/O to work.
What you are doing looks like it should work. If you add the "-NoRedirectConsoleInput" and "-NoRedirectConsoleOutput" arguments to the StartInfo.Arguments
does it work properly?
That said, creating a custom module would give you the most control. You do not necessarily need to use Rocket. You would implement the IModuleNexus interface, and register your custom CommandIO handler.
Thanks for the quick replies, both from Trojaner and from SDGNelson! :)
I've added those arguments, but the server still doesn't react to commands written. I've taken some debug steps, like running the server from CMD, and making sure it works normally (all ran as expected).
I get this output on start with my script. Maybe some of this info has a hint I missed?
Mono path[0] = 'C:/Program Files (x86)/Steam/steamapps/common/Unturned/Unturned_Data/Managed'
Mono config path = 'C:/Program Files (x86)/Steam/steamapps/common/Unturned/MonoBleedingEdge/etc'
Initialize engine version: 2018.4.23f1 (c9cf1a90e812)
Forcing GfxDevice: Null
GfxDevice: creating device client; threaded=0
NullGfxDevice:
Version: NULL 1.0 [1.0]
Renderer: Null Device
Vendor: Unity Technologies
Begin MonoManager ReloadAssembly
- Completed reload, in 0.151 seconds
WARNING: Shader Unsupported: 'Hidden/Nature/Terrain/Utilities' - All passes removed
ERROR: Shader Hidden/Nature/Terrain/Utilities shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
UnloadTime: 0.797500 ms
3.20.5.5
Unloading 4 Unused Serialized files (Serialized files now loaded: 0)
Unloading 2 unused Assets to reduce memory usage. Loaded Objects now: 2157.
Total: 4.166600 ms (FindLiveObjects: 0.536500 ms CreateObjectMapping: 0.115900 ms MarkObjects: 3.501200 ms DeleteObjects: 0.012200 ms)
Mounting core: 0%
Mounting core: 1%
Mounting core: 2%
...
If I debug the streamwriter, it looks like maybe some things are missing? Intellisense gives me a bunch of "not implemented error"s for things that seem like they ought to have been implemented?
Maybe I need to figure out asynch write?
I haven't head of the IModuleNexus. Where can I learn more?
Create a new .NET Framework Library project. Add Assembly-CSharp, Assembly-CSharp-firstpass, UnityEngine and UnityEngine.CoreModule dlls to your project. Create a new class, name it how you want it and make sure it inherits from IModuleNexus. After that you can use the object browser to see the available Unturned APIs and interact with them. After compiling, create the .module file (see this repo for examples) and move your dll and .module file to a directory in the Modules directory.
Thanks for writing those quickstart tips Trojaner! If you follow those steps bleehu it should be straightforward to get your custom code in-game with your custom input handling.
If I go that route, the server won't be considered "vanilla" though, right?
Servers with custom modules are listed as "vanilla", only Rocket plugins make it show up as Rocket / non-vanilla. Personally I think that if your module is for the quality of life of different command handling then that still counts as vanilla. ;)
Feel free to comment and I will re-open.
I'm attempting to replicate a rocketmod-like script to do things like save on a certain hour, and have the server make periodic announcements.
This is the function that I'm trying to fix; I've tried
process.standardinput.writeline('some command');
. But the server doesn't seem to receive input from the stream.The docs here say that command I/O is taken from the process's stand input, so I think I'm barking up the right tree.
Is there a problem with how I'm configuring the process start info? reproduced below for convenience.
The server suggests using the dedicated app. Is the current one out of support for headless server mode?