custom intefaces

This commit is contained in:
Evil Factory
2021-08-17 23:59:14 -03:00
parent 9f2261827a
commit c11d889d51
3 changed files with 10 additions and 3 deletions
@@ -314,6 +314,11 @@ namespace Barotrauma
return item.GetComponent<LightComponent>(); return item.GetComponent<LightComponent>();
} }
public static CustomInterface GetCustomInterface(Item item)
{
return item.GetComponent<CustomInterface>();
}
public static void DispatchRespawnSub() public static void DispatchRespawnSub()
{ {
GameMain.Server.RespawnManager.DispatchShuttle(); GameMain.Server.RespawnManager.DispatchShuttle();
@@ -145,6 +145,7 @@ namespace Barotrauma
UserData.RegisterType<ItemComponent>(); UserData.RegisterType<ItemComponent>();
UserData.RegisterType<WifiComponent>(); UserData.RegisterType<WifiComponent>();
UserData.RegisterType<LightComponent>(); UserData.RegisterType<LightComponent>();
UserData.RegisterType<CustomInterface>();
UserData.RegisterType<Inventory>(); UserData.RegisterType<Inventory>();
UserData.RegisterType<CharacterInventory>(); UserData.RegisterType<CharacterInventory>();
UserData.RegisterType<Hull>(); UserData.RegisterType<Hull>();
@@ -155,7 +156,7 @@ namespace Barotrauma
UserData.RegisterType<ItemPrefab>(); UserData.RegisterType<ItemPrefab>();
UserData.RegisterType<SerializableProperty>(); UserData.RegisterType<SerializableProperty>();
UserData.RegisterType<StatusEffect>(); UserData.RegisterType<StatusEffect>();
UserData.RegisterType<CustomInterface.CustomInterfaceElement>();
lua = new Script(CoreModules.Preset_SoftSandbox | CoreModules.LoadMethods); lua = new Script(CoreModules.Preset_SoftSandbox | CoreModules.LoadMethods);
@@ -196,6 +197,7 @@ namespace Barotrauma
lua.Globals["ChatMessage"] = UserData.CreateStatic<ChatMessage>(); lua.Globals["ChatMessage"] = UserData.CreateStatic<ChatMessage>();
lua.Globals["Hull"] = UserData.CreateStatic<Hull>(); lua.Globals["Hull"] = UserData.CreateStatic<Hull>();
lua.Globals["InvSlotType"] = UserData.CreateStatic<InvSlotType>(); lua.Globals["InvSlotType"] = UserData.CreateStatic<InvSlotType>();
lua.Globals["Gap"] = UserData.CreateStatic<Gap>();
foreach (string d in Directory.GetDirectories("Mods")) foreach (string d in Directory.GetDirectories("Mods"))
{ {
@@ -7,7 +7,7 @@ namespace Barotrauma.Items.Components
{ {
partial class CustomInterface : ItemComponent, IClientSerializable, IServerSerializable partial class CustomInterface : ItemComponent, IClientSerializable, IServerSerializable
{ {
class CustomInterfaceElement : ISerializableEntity public class CustomInterfaceElement : ISerializableEntity
{ {
public bool ContinuousSignal; public bool ContinuousSignal;
public bool State; public bool State;
@@ -130,7 +130,7 @@ namespace Barotrauma.Items.Components
public override bool RecreateGUIOnResolutionChange => true; public override bool RecreateGUIOnResolutionChange => true;
private readonly List<CustomInterfaceElement> customInterfaceElementList = new List<CustomInterfaceElement>(); public readonly List<CustomInterfaceElement> customInterfaceElementList = new List<CustomInterfaceElement>();
public CustomInterface(Item item, XElement element) public CustomInterface(Item item, XElement element)
: base(item, element) : base(item, element)