Fix exception in ReagentPrototype caused by IMetabolizable (#451)

* Fix exception in ReagentPrototype

Due to client trying to access concrete implementations of IMetabolizable that are in Content.Server. This fix checks to see if the prototype is being loaded by the client through reflection. I don't want to move the prototype completely into Content.Server since it's useful for the client to view descriptions and values of reagents without needing to send that data from the server.

* Make fix slightly more explicit

Now it will only load the metabolizable when in Robust.Server, instead of it being anything that's not Robust.Client.

* Add IModuleManager and ModuleManager

Provide simple way to check if shared code is being run by the server or the client

* Change ModuleManager implementations to not require assembly name comparison

Now just has ClientModuleManager registered to client, and ServerModuleManager registered to server.

* Change IModuleManager functions to properties

* Fix failing tests.

This was failing because the tests weren't initializing IoC. Simply using RobustUnitTest wasn't enough because that doesn't initialize content either. I did some cleaning up so now content IoC is registered via ContentUnitTest.
This commit is contained in:
moneyl
2019-11-23 15:55:31 -05:00
committed by Pieter-Jan Briers
parent 4198b6dc4e
commit b89615342e
11 changed files with 162 additions and 28 deletions

View File

@@ -0,0 +1,15 @@
using Content.Shared.Interfaces;
namespace Content.Server.Utility
{
/// <summary>
/// Server implementation of IModuleManager.
/// Provides simple way for shared code to check if it's being run by
/// the client of the server.
/// </summary>
public class ServerModuleManager : IModuleManager
{
bool IModuleManager.IsClientModule => false;
bool IModuleManager.IsServerModule => true;
}
}