docs update and server event for item components

This commit is contained in:
Evil Factory
2021-09-19 13:26:35 -03:00
parent 75c0dd7425
commit 6c1cd3c5d3
5 changed files with 54 additions and 0 deletions
@@ -43,6 +43,34 @@ namespace Barotrauma.Networking
namespace Barotrauma
{
using Microsoft.Xna.Framework;
using System.Reflection;
partial class Item
{
public object CreateServerEventString(string component)
{
Type type = Type.GetType("Barotrauma.Items.Components." + component);
if (type == null)
return null;
MethodInfo method = typeof(Item).GetMethod(nameof(Item.CreateServerEvent));
MethodInfo generic = method.MakeGenericMethod(type);
return generic.Invoke(this, null);
}
public object CreateServerEventString(string component, object[] extraData)
{
Type type = Type.GetType("Barotrauma.Items.Components." + component);
if (type == null)
return null;
MethodInfo method = typeof(Item).GetMethod(nameof(Item.CreateServerEvent));
MethodInfo generic = method.MakeGenericMethod(type);
return generic.Invoke(this, new object[]{ extraData });
}
}
partial class ItemPrefab
{