diff --git a/Barotrauma/BarotraumaServer/ServerSource/Lua/LuaBarotraumaAdditions.cs b/Barotrauma/BarotraumaServer/ServerSource/Lua/LuaBarotraumaAdditions.cs index b40c14bd7..f8daf14cb 100644 --- a/Barotrauma/BarotraumaServer/ServerSource/Lua/LuaBarotraumaAdditions.cs +++ b/Barotrauma/BarotraumaServer/ServerSource/Lua/LuaBarotraumaAdditions.cs @@ -54,10 +54,25 @@ namespace Barotrauma.Networking namespace Barotrauma { using Barotrauma.Networking; + using System.Linq; + using System.Reflection; + + partial class Character { + + } + partial class AfflictionPrefab + { + public static AfflictionPrefab[] ListArray + { + get + { + return List.ToArray(); + } + } } partial class CharacterInfo @@ -75,6 +90,18 @@ namespace Barotrauma EntitySpawner.Spawner.AddToRemoveQueue(item); } + public object GetComponentString(string component) + { + Type type = Type.GetType("Barotrauma.Items.Components." + component); + + if (type == null) + return null; + + MethodInfo method = typeof(Item).GetMethod(nameof(Item.GetComponent)); + MethodInfo generic = method.MakeGenericMethod(type); + return generic.Invoke(this, null); + } + } partial class ItemPrefab diff --git a/Barotrauma/BarotraumaServer/ServerSource/Lua/LuaClasses.cs b/Barotrauma/BarotraumaServer/ServerSource/Lua/LuaClasses.cs index 81ca91f69..d0cbb9c0e 100644 --- a/Barotrauma/BarotraumaServer/ServerSource/Lua/LuaClasses.cs +++ b/Barotrauma/BarotraumaServer/ServerSource/Lua/LuaClasses.cs @@ -144,6 +144,8 @@ namespace Barotrauma return GameMain.Server.ServerPeer is LidgrenServerPeer; } } + + public ServerSettings Settings => GameMain.Server.ServerSettings; public static void SendMessage(string msg, ChatMessageType? messageType = null, Client sender = null, Character character = null) { diff --git a/Barotrauma/BarotraumaServer/ServerSource/Lua/LuaSetup.cs b/Barotrauma/BarotraumaServer/ServerSource/Lua/LuaSetup.cs index 1688d36ad..3b3dee67d 100644 --- a/Barotrauma/BarotraumaServer/ServerSource/Lua/LuaSetup.cs +++ b/Barotrauma/BarotraumaServer/ServerSource/Lua/LuaSetup.cs @@ -220,6 +220,9 @@ namespace Barotrauma UserData.RegisterType(); UserData.RegisterType(); UserData.RegisterType(); + UserData.RegisterType(); + UserData.RegisterType(); + UserData.RegisterType(); UserData.RegisterType(); UserData.RegisterType(); UserData.RegisterType(); @@ -242,6 +245,7 @@ namespace Barotrauma UserData.RegisterType(); UserData.RegisterType(); UserData.RegisterType(); + UserData.RegisterType(); lua = new Script(CoreModules.Preset_SoftSandbox); diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/Health/Afflictions/AfflictionPrefab.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/Health/Afflictions/AfflictionPrefab.cs index ff89cb4a9..a056bfcf9 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Characters/Health/Afflictions/AfflictionPrefab.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/Health/Afflictions/AfflictionPrefab.cs @@ -111,7 +111,7 @@ namespace Barotrauma public readonly bool NeedsAir; } - class AfflictionPrefab : IPrefab, IDisposable, IHasUintIdentifier + partial class AfflictionPrefab : IPrefab, IDisposable, IHasUintIdentifier { public class Effect { @@ -261,14 +261,6 @@ namespace Barotrauma } } - public static AfflictionPrefab[] ListArray - { - get - { - return List.ToArray(); - } - } - public string FilePath { get; private set; } /// diff --git a/Workshop/blacklist_files.zip b/Workshop/blacklist_files.zip index 04ba3622b..7b8ff7321 100644 Binary files a/Workshop/blacklist_files.zip and b/Workshop/blacklist_files.zip differ diff --git a/docs/lua/Game.lua b/docs/lua/Game.lua index 361a5084b..77edf8187 100644 --- a/docs/lua/Game.lua +++ b/docs/lua/Game.lua @@ -15,6 +15,10 @@ RoundStarted = true -- @realm server IsDedicated = true +--- Server settings. +-- @realm server +ServerSettings = true + --- Send chat message to every client. -- @realm server function SendMessage(msg, messageType, sender, character) end @@ -36,7 +40,7 @@ function SendDirectChatMessage(chatMessage, client) end -- @realm server function OverrideTraitors(override) end ---- True to override respawn shuttle. +--- True to override respawn sub, stops players from being respawned. -- @realm server function OverrideRespawnSub(override) end @@ -60,12 +64,12 @@ function Log(message, ServerLogMessageType) end -- @realm server function Explode(pos, range, force, damage, structureDamage, itemDamage, empStrength, ballastFloraStrength) end ---- Get respawn shuttle submarine. +--- Get respawn sub submarine. --@treturn Submarine Respawn Shuttle -- @realm shared -function GetRespawnShuttle() end +function GetRespawnSub() end ---- Dispatch respawn shuttle. +--- Dispatch respawn sub. -- @realm server function DispatchRespawnSub() end diff --git a/docs/lua/Item.lua b/docs/lua/Item.lua index 49169edf3..044c25412 100644 --- a/docs/lua/Item.lua +++ b/docs/lua/Item.lua @@ -11,6 +11,10 @@ Barotrauma source code: [Item.cs](https://github.com/evilfactory/Barotrauma-lua- -- @realm server function AddToRemoveQueue(item) end +--- Gets a component from an item by a string name. +-- @treturn Component component +-- @realm server +function GetComponentString(componentName) end --- Sends a signal. -- @realm server