new GetComponentString, and docs updated
This commit is contained in:
@@ -54,10 +54,25 @@ namespace Barotrauma.Networking
|
||||
namespace Barotrauma
|
||||
{
|
||||
using Barotrauma.Networking;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
|
||||
|
||||
partial class Character
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
partial class AfflictionPrefab
|
||||
{
|
||||
public static AfflictionPrefab[] ListArray
|
||||
{
|
||||
get
|
||||
{
|
||||
return List.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
partial class CharacterInfo
|
||||
@@ -75,6 +90,18 @@ namespace Barotrauma
|
||||
EntitySpawner.Spawner.AddToRemoveQueue(item);
|
||||
}
|
||||
|
||||
public object GetComponentString(string component)
|
||||
{
|
||||
Type type = Type.GetType("Barotrauma.Items.Components." + component);
|
||||
|
||||
if (type == null)
|
||||
return null;
|
||||
|
||||
MethodInfo method = typeof(Item).GetMethod(nameof(Item.GetComponent));
|
||||
MethodInfo generic = method.MakeGenericMethod(type);
|
||||
return generic.Invoke(this, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
partial class ItemPrefab
|
||||
|
||||
@@ -144,6 +144,8 @@ namespace Barotrauma
|
||||
return GameMain.Server.ServerPeer is LidgrenServerPeer;
|
||||
}
|
||||
}
|
||||
|
||||
public ServerSettings Settings => GameMain.Server.ServerSettings;
|
||||
|
||||
public static void SendMessage(string msg, ChatMessageType? messageType = null, Client sender = null, Character character = null)
|
||||
{
|
||||
|
||||
@@ -220,6 +220,9 @@ namespace Barotrauma
|
||||
UserData.RegisterType<Holdable>();
|
||||
UserData.RegisterType<CustomInterface>();
|
||||
UserData.RegisterType<Inventory>();
|
||||
UserData.RegisterType<ItemContainer>();
|
||||
UserData.RegisterType<PowerContainer>();
|
||||
UserData.RegisterType<Pickable>();
|
||||
UserData.RegisterType<CharacterInventory>();
|
||||
UserData.RegisterType<Hull>();
|
||||
UserData.RegisterType<Gap>();
|
||||
@@ -242,6 +245,7 @@ namespace Barotrauma
|
||||
UserData.RegisterType<HumanAIController>();
|
||||
UserData.RegisterType<AITarget>();
|
||||
UserData.RegisterType<AITargetMemory>();
|
||||
UserData.RegisterType<ServerSettings>();
|
||||
|
||||
lua = new Script(CoreModules.Preset_SoftSandbox);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user