Fixed GetComponentString not working with custom types and registered/added missing types
This commit is contained in:
@@ -27,6 +27,7 @@ defaultLib["SoundPrefab"] = CreateStatic("Barotrauma.SoundPrefab", true)
|
||||
defaultLib["BackgroundMusic"] = CreateStatic("Barotrauma.BackgroundMusic", true)
|
||||
defaultLib["GUISound"] = CreateStatic("Barotrauma.GUISound", true)
|
||||
defaultLib["DamageSound"] = CreateStatic("Barotrauma.DamageSound", true)
|
||||
defaultLib["WaterRenderer"] = CreateStatic("Barotrauma.WaterRenderer", true)
|
||||
|
||||
defaultLib["TextureLoader"] = CreateStatic("Barotrauma.TextureLoader")
|
||||
defaultLib["Sprite"] = CreateStatic("Barotrauma.Sprite", true)
|
||||
|
||||
@@ -56,6 +56,8 @@ defaultLib["InputType"] = CreateStatic("Barotrauma.InputType")
|
||||
|
||||
|
||||
defaultLib["Inventory"] = CreateStatic("Barotrauma.Inventory")
|
||||
defaultLib["CharacterInventory"] = CreateStatic("Barotrauma.CharacterInventory")
|
||||
defaultLib["ItemInventory"] = CreateStatic("Barotrauma.ItemInventory")
|
||||
defaultLib["ContentPackageManager"] = CreateStatic("Barotrauma.ContentPackageManager")
|
||||
defaultLib["GameSettings"] = CreateStatic("Barotrauma.GameSettings")
|
||||
defaultLib["RichString"] = CreateStatic("Barotrauma.RichString", true)
|
||||
|
||||
@@ -68,6 +68,10 @@ RegisterBarotrauma("Key")
|
||||
RegisterBarotrauma("PlayerInput")
|
||||
RegisterBarotrauma("ScalableFont")
|
||||
|
||||
Register("Microsoft.Xna.Framework.Graphics.Effect")
|
||||
Register("Microsoft.Xna.Framework.Graphics.EffectParameterCollection")
|
||||
Register("Microsoft.Xna.Framework.Graphics.EffectParameter")
|
||||
|
||||
Register("Microsoft.Xna.Framework.Graphics.SpriteBatch")
|
||||
Register("Microsoft.Xna.Framework.Graphics.Texture2D")
|
||||
Register("EventInput.KeyboardDispatcher")
|
||||
|
||||
@@ -57,10 +57,12 @@ namespace Barotrauma
|
||||
{
|
||||
public object GetComponentString(string component)
|
||||
{
|
||||
Type type = Type.GetType("Barotrauma.Items.Components." + component);
|
||||
Type type = LuaUserData.GetType("Barotrauma.Items.Components." + component);
|
||||
|
||||
if (type == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
MethodInfo method = typeof(Item).GetMethod(nameof(Item.GetComponent));
|
||||
MethodInfo generic = method.MakeGenericMethod(type);
|
||||
|
||||
Reference in New Issue
Block a user