This should be ItemPrefab, not Item, also add it the source code compat
This commit is contained in:
@@ -26,13 +26,13 @@ namespace Barotrauma
|
||||
|
||||
public static class ModUtils
|
||||
{
|
||||
public static class Item
|
||||
public static class ItemPrefab
|
||||
{
|
||||
internal static ItemPrefab GetItemPrefab(string itemNameOrId)
|
||||
internal static Barotrauma.ItemPrefab GetItemPrefab(string itemNameOrId)
|
||||
{
|
||||
ItemPrefab itemPrefab =
|
||||
(MapEntityPrefab.Find(itemNameOrId, identifier: null, showErrorMessages: false) ??
|
||||
MapEntityPrefab.Find(null, identifier: itemNameOrId, showErrorMessages: false)) as ItemPrefab;
|
||||
Barotrauma.ItemPrefab itemPrefab =
|
||||
(Barotrauma.MapEntityPrefab.Find(itemNameOrId, identifier: null, showErrorMessages: false) ??
|
||||
Barotrauma.MapEntityPrefab.Find(null, identifier: itemNameOrId, showErrorMessages: false)) as Barotrauma.ItemPrefab;
|
||||
|
||||
return itemPrefab;
|
||||
}
|
||||
|
||||
@@ -639,7 +639,8 @@ public class PluginManagementService : IAssemblyManagementService
|
||||
{
|
||||
return sourceCode
|
||||
.Replace("GameMain.LuaCs", "LuaCsSetup.Instance")
|
||||
.Replace("Client.ClientList", "ModUtils.Client.ClientList");
|
||||
.Replace("Client.ClientList", "ModUtils.Client.ClientList")
|
||||
.Replace("ItemPrefab.GetItemPrefab", "ModUtils.ItemPrefab.GetItemPrefab");
|
||||
}
|
||||
|
||||
private IntPtr OnAssemblyLoaderResolvingUnmanaged(Assembly callerAssembly, string targetAssemblyName)
|
||||
|
||||
@@ -183,7 +183,7 @@ public class DefaultLuaRegistrar : IDefaultLuaRegistrar
|
||||
_userDataService.RegisterExtensionType("Barotrauma.XMLExtensions");
|
||||
|
||||
var itemPrefabDescriptor = (StandardUserDataDescriptor)_userDataService.RegisterType("Barotrauma.ItemPrefab");
|
||||
itemPrefabDescriptor.AddMember("GetItemPrefab", new MethodMemberDescriptor(typeof(ModUtils.Item).GetMethod(nameof(ModUtils.Item.GetItemPrefab), BindingFlags.NonPublic | BindingFlags.Static)));
|
||||
itemPrefabDescriptor.AddMember("GetItemPrefab", new MethodMemberDescriptor(typeof(ModUtils.ItemPrefab).GetMethod(nameof(ModUtils.ItemPrefab.GetItemPrefab), BindingFlags.NonPublic | BindingFlags.Static)));
|
||||
|
||||
var clientDescriptor = (StandardUserDataDescriptor)_userDataService.RegisterType("Barotrauma.Networking.Client");
|
||||
clientDescriptor.AddMember("ClientList", new PropertyMemberDescriptor(typeof(ModUtils.Client).GetProperty(nameof(ModUtils.Client.ClientList), BindingFlags.NonPublic | BindingFlags.Static), InteropAccessMode.LazyOptimized));
|
||||
|
||||
Reference in New Issue
Block a user