new GetComponentString, and docs updated

This commit is contained in:
Evil Factory
2021-09-13 16:47:05 -03:00
parent b480e6797c
commit 6e5de74f37
7 changed files with 46 additions and 13 deletions

View File

@@ -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

View File

@@ -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)
{

View File

@@ -220,6 +220,9 @@ namespace Barotrauma
UserData.RegisterType<Holdable>();
UserData.RegisterType<CustomInterface>();
UserData.RegisterType<Inventory>();
UserData.RegisterType<ItemContainer>();
UserData.RegisterType<PowerContainer>();
UserData.RegisterType<Pickable>();
UserData.RegisterType<CharacterInventory>();
UserData.RegisterType<Hull>();
UserData.RegisterType<Gap>();
@@ -242,6 +245,7 @@ namespace Barotrauma
UserData.RegisterType<HumanAIController>();
UserData.RegisterType<AITarget>();
UserData.RegisterType<AITargetMemory>();
UserData.RegisterType<ServerSettings>();
lua = new Script(CoreModules.Preset_SoftSandbox);

View File

@@ -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; }
/// <summary>

Binary file not shown.

View File

@@ -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

View File

@@ -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