docs update and server event for item components
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
@@ -55,6 +55,7 @@ tparam_alias("Client", "client")
|
||||
tparam_alias("Character", "character")
|
||||
tparam_alias("Submarine", "submarine")
|
||||
tparam_alias("Item", "item")
|
||||
tparam_alias("ItemPrefab", "ItemPrefab")
|
||||
tparam_alias("Vector2", "Vector2")
|
||||
tparam_alias("Vector3", "Vector3")
|
||||
tparam_alias("Vector4", "Vector4")
|
||||
|
||||
@@ -172,6 +172,11 @@ function TeleportTo(position) end
|
||||
-- @realm shared
|
||||
-- @bool IsInFriendlySub
|
||||
|
||||
---
|
||||
-- WorldPosition, Vector2 position of the Character in the world
|
||||
-- @realm shared
|
||||
-- @Vector2 WorldPosition
|
||||
|
||||
---
|
||||
-- Position, returns a Vector2.
|
||||
-- @realm shared
|
||||
|
||||
@@ -34,3 +34,18 @@ function Item:SendSignal(signalOrString, connectionOrConnectionName) end
|
||||
-- Item.ItemList, Table containing all items.
|
||||
-- @realm shared
|
||||
-- @Item Item.ItemList
|
||||
|
||||
---
|
||||
-- Prefab, ItemPrefab containing the original prefab of the item.
|
||||
-- @realm shared
|
||||
-- @ItemPrefab Prefab
|
||||
|
||||
---
|
||||
-- Name, the name of the item.
|
||||
-- @realm shared
|
||||
-- @string Name
|
||||
|
||||
---
|
||||
-- WorldPosition, Vector2 position of the item in the world
|
||||
-- @realm shared
|
||||
-- @Vector2 WorldPosition
|
||||
|
||||
@@ -29,3 +29,8 @@ function ItemPrefab.AddToSpawnQueue(itemPrefab, inventory, spawned) end
|
||||
-- @treturn ItemPrefab
|
||||
-- @realm shared
|
||||
function ItemPrefab.GetItemPrefab(itemNameOrId) end
|
||||
|
||||
---
|
||||
-- Identifier, the identifier of the prefab.
|
||||
-- @realm shared
|
||||
-- @string Identifier
|
||||
|
||||
Reference in New Issue
Block a user