Updated Moonsharp Interpreter, added support for implicit conversions, new types: LuaByte, LuaUShort and LuaFloat added to solve method overload conflict, support for setting UserData metatables, remove LuaUserData.AddCallMetaMethod and moved GUI object to Lua
This commit is contained in:
@@ -8,63 +8,6 @@ namespace Barotrauma
|
||||
{
|
||||
partial class LuaSetup
|
||||
{
|
||||
public class LuaGUI
|
||||
{
|
||||
LuaSetup env;
|
||||
public LuaGUI(LuaSetup _env)
|
||||
{
|
||||
env = _env;
|
||||
}
|
||||
|
||||
public void CreateStaticValues()
|
||||
{
|
||||
RectTransform = UserData.CreateStatic<RectTransform>();
|
||||
LayoutGroup = UserData.CreateStatic<GUILayoutGroup>();
|
||||
Button = UserData.CreateStatic<GUIButton>();
|
||||
TextBox = UserData.CreateStatic<GUITextBox>();
|
||||
Canvas = UserData.CreateStatic<GUICanvas>();
|
||||
Frame = UserData.CreateStatic<GUIFrame>();
|
||||
TextBlock = UserData.CreateStatic<GUITextBlock>();
|
||||
TickBox = UserData.CreateStatic<GUITickBox>();
|
||||
Image = UserData.CreateStatic<GUIImage>();
|
||||
ListBox = UserData.CreateStatic<GUIListBox>();
|
||||
ScrollBar = UserData.CreateStatic<GUIScrollBar>();
|
||||
DropDown = UserData.CreateStatic<GUIDropDown>();
|
||||
|
||||
Screen = UserData.CreateStatic<Screen>();
|
||||
|
||||
Anchor = UserData.CreateStatic<Anchor>();
|
||||
Alignment = UserData.CreateStatic<Alignment>();
|
||||
Pivot = UserData.CreateStatic<Pivot>();
|
||||
}
|
||||
|
||||
public ChatBox ChatBox
|
||||
{
|
||||
get
|
||||
{
|
||||
return GameMain.Client.ChatBox;
|
||||
}
|
||||
}
|
||||
|
||||
public static object Screen;
|
||||
|
||||
public static object RectTransform;
|
||||
public static object LayoutGroup;
|
||||
public static object Button;
|
||||
public static object TextBox;
|
||||
public static object Canvas;
|
||||
public static object Frame;
|
||||
public static object TextBlock;
|
||||
public static object TickBox;
|
||||
public static object Image;
|
||||
public static object ListBox;
|
||||
public static object ScrollBar;
|
||||
public static object DropDown;
|
||||
|
||||
public static object Pivot;
|
||||
public static object Anchor;
|
||||
public static object Alignment;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +121,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MonoMod.Common" Version="22.1.20.1" />
|
||||
<PackageReference Include="MoonSharp" Version="2.0.0" />
|
||||
<PackageReference Include="NVorbis" Version="0.8.6" />
|
||||
<PackageReference Include="RestSharp" Version="106.12.0" />
|
||||
</ItemGroup>
|
||||
@@ -130,6 +129,9 @@
|
||||
<Reference Include="0Harmony">
|
||||
<HintPath>..\..\Libraries\0Harmony.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MoonSharp.Interpreter">
|
||||
<HintPath>..\..\Libraries\MoonSharp.Interpreter.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Sourced from https://stackoverflow.com/a/45248069 -->
|
||||
|
||||
@@ -122,7 +122,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MonoMod.Common" Version="22.1.20.1" />
|
||||
<PackageReference Include="MoonSharp" Version="2.0.0" />
|
||||
<PackageReference Include="NVorbis" Version="0.8.6" />
|
||||
<PackageReference Include="RestSharp" Version="106.12.0" />
|
||||
</ItemGroup>
|
||||
@@ -138,6 +137,9 @@
|
||||
<Reference Include="0Harmony">
|
||||
<HintPath>..\..\Libraries\0Harmony.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MoonSharp.Interpreter">
|
||||
<HintPath>..\..\Libraries\MoonSharp.Interpreter.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Update="libfreetype6.dylib">
|
||||
|
||||
@@ -128,7 +128,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MonoMod.Common" Version="22.1.20.1" />
|
||||
<PackageReference Include="MoonSharp" Version="2.0.0" />
|
||||
<PackageReference Include="NVorbis" Version="0.8.6" />
|
||||
<PackageReference Include="RestSharp" Version="106.12.0" />
|
||||
</ItemGroup>
|
||||
@@ -137,6 +136,9 @@
|
||||
<Reference Include="0Harmony">
|
||||
<HintPath>..\..\Libraries\0Harmony.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MoonSharp.Interpreter">
|
||||
<HintPath>..\..\Libraries\MoonSharp.Interpreter.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -75,7 +75,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MonoMod.Common" Version="22.1.20.1" />
|
||||
<PackageReference Include="MoonSharp" Version="2.0.0" />
|
||||
<PackageReference Include="RestSharp" Version="106.13.0" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -83,6 +82,9 @@
|
||||
<Reference Include="0Harmony">
|
||||
<HintPath>..\..\Libraries\0Harmony.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MoonSharp.Interpreter">
|
||||
<HintPath>..\..\Libraries\MoonSharp.Interpreter.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Sourced from https://stackoverflow.com/a/45248069 -->
|
||||
|
||||
@@ -82,7 +82,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MonoMod.Common" Version="22.1.20.1" />
|
||||
<PackageReference Include="MoonSharp" Version="2.0.0" />
|
||||
<PackageReference Include="RestSharp" Version="106.13.0" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -97,6 +96,9 @@
|
||||
<Reference Include="0Harmony">
|
||||
<HintPath>..\..\Libraries\0Harmony.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MoonSharp.Interpreter">
|
||||
<HintPath>..\..\Libraries\MoonSharp.Interpreter.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<Target Name="GetGitRevision" BeforeTargets="WriteGitRevision" Condition="'$(BuildHash)' == ''">
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -83,7 +83,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MonoMod.Common" Version="22.1.20.1" />
|
||||
<PackageReference Include="MoonSharp" Version="2.0.0" />
|
||||
<PackageReference Include="RestSharp" Version="106.13.0" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -91,6 +90,9 @@
|
||||
<Reference Include="0Harmony">
|
||||
<HintPath>..\..\Libraries\0Harmony.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MoonSharp.Interpreter">
|
||||
<HintPath>..\..\Libraries\MoonSharp.Interpreter.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Sourced from https://stackoverflow.com/a/45248069 -->
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
local compatibilityLib = {}
|
||||
|
||||
LuaUserData.AddMethod(LuaUserData.RegisterType("Barotrauma.LuaSetup+LuaUserData"), "AddCallMetaMember", function (v)
|
||||
print("AddCallMetaMember is deprecated, use debug.setmetatable instead.")
|
||||
end)
|
||||
|
||||
compatibilityLib.CreateVector2 = Vector2.__new
|
||||
compatibilityLib.CreateVector3 = Vector3.__new
|
||||
compatibilityLib.CreateVector4 = Vector4.__new
|
||||
|
||||
@@ -2,41 +2,42 @@ local defaultLib = {}
|
||||
|
||||
require("DefaultRegister")
|
||||
|
||||
local CreateStatic = function (typeName)
|
||||
return LuaUserData.CreateStatic("Barotrauma." .. typeName)
|
||||
local CreateStatic = function (typeName, addCallMethod)
|
||||
local staticUserdata = LuaUserData.CreateStatic(typeName)
|
||||
|
||||
if addCallMethod then
|
||||
debug.setmetatable(staticUserdata, {
|
||||
__call = function(obj, ...)
|
||||
return staticUserdata.__new(...)
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
return staticUserdata
|
||||
end
|
||||
|
||||
defaultLib["WayPoint"] = CreateStatic("WayPoint")
|
||||
defaultLib["SpawnType"] = CreateStatic("SpawnType")
|
||||
defaultLib["ChatMessageType"] = CreateStatic("Networking.ChatMessageType")
|
||||
defaultLib["ServerLog_MessageType"] = CreateStatic("Networking.ServerLog+MessageType")
|
||||
defaultLib["ServerLogMessageType"] = CreateStatic("Networking.ServerLog+MessageType")
|
||||
defaultLib["Submarine"] = CreateStatic("Submarine")
|
||||
defaultLib["Client"] = CreateStatic("Networking.Client")
|
||||
defaultLib["Character"] = CreateStatic("Character")
|
||||
defaultLib["CharacterInfo"] = CreateStatic("CharacterInfo")
|
||||
defaultLib["Item"] = CreateStatic("Item")
|
||||
defaultLib["ItemPrefab"] = CreateStatic("ItemPrefab")
|
||||
defaultLib["Level"] = CreateStatic("Level")
|
||||
defaultLib["PositionType"] = CreateStatic("Level+PositionType")
|
||||
defaultLib["Job"] = CreateStatic("Job")
|
||||
defaultLib["JobPrefab"] = CreateStatic("JobPrefab")
|
||||
defaultLib["TraitorMessageType"] = CreateStatic("Networking.TraitorMessageType")
|
||||
defaultLib["CauseOfDeathType"] = CreateStatic("CauseOfDeathType")
|
||||
defaultLib["AfflictionPrefab"] = CreateStatic("AfflictionPrefab")
|
||||
defaultLib["CharacterTeamType"] = CreateStatic("CharacterTeamType")
|
||||
defaultLib["Vector2"] = LuaUserData.CreateStatic("Microsoft.Xna.Framework.Vector2")
|
||||
defaultLib["Vector3"] = LuaUserData.CreateStatic("Microsoft.Xna.Framework.Vector3")
|
||||
defaultLib["Vector4"] = LuaUserData.CreateStatic("Microsoft.Xna.Framework.Vector4")
|
||||
defaultLib["Color"] = LuaUserData.CreateStatic("Microsoft.Xna.Framework.Color")
|
||||
defaultLib["Point"] = LuaUserData.CreateStatic("Microsoft.Xna.Framework.Point")
|
||||
defaultLib["ChatMessage"] = CreateStatic("Networking.ChatMessage")
|
||||
defaultLib["Hull"] = CreateStatic("Hull")
|
||||
defaultLib["InvSlotType"] = CreateStatic("InvSlotType")
|
||||
defaultLib["LimbType"] = CreateStatic("LimbType")
|
||||
defaultLib["ActionType"] = CreateStatic("ActionType")
|
||||
defaultLib["Gap"] = CreateStatic("Gap")
|
||||
defaultLib["ContentPackage"] = CreateStatic("ContentPackage")
|
||||
defaultLib["Byte"] = CreateStatic("Barotrauma.LuaByte", true)
|
||||
defaultLib["UShort"] = CreateStatic("Barotrauma.LuaUShort", true)
|
||||
defaultLib["Float"] = CreateStatic("Barotrauma.LuaFloat", true)
|
||||
|
||||
defaultLib["SpawnType"] = CreateStatic("Barotrauma.SpawnType")
|
||||
defaultLib["ChatMessageType"] = CreateStatic("Barotrauma.Networking.ChatMessageType")
|
||||
defaultLib["ServerLog_MessageType"] = CreateStatic("Barotrauma.Networking.ServerLog+MessageType")
|
||||
defaultLib["ServerLogMessageType"] = CreateStatic("Barotrauma.Networking.ServerLog+MessageType")
|
||||
defaultLib["PositionType"] = CreateStatic("Barotrauma.Level+PositionType")
|
||||
defaultLib["InvSlotType"] = CreateStatic("Barotrauma.InvSlotType")
|
||||
defaultLib["LimbType"] = CreateStatic("Barotrauma.LimbType")
|
||||
defaultLib["ActionType"] = CreateStatic("Barotrauma.ActionType")
|
||||
defaultLib["DeliveryMethod"] = CreateStatic("Barotrauma.Networking.DeliveryMethod")
|
||||
defaultLib["ClientPacketHeader"] = CreateStatic("Barotrauma.Networking.ClientPacketHeader")
|
||||
defaultLib["ServerPacketHeader"] = CreateStatic("Barotrauma.Networking.ServerPacketHeader")
|
||||
defaultLib["RandSync"] = CreateStatic("Barotrauma.Rand+RandSync")
|
||||
defaultLib["DisconnectReason"] = CreateStatic("Barotrauma.Networking.DisconnectReason")
|
||||
defaultLib["TraitorMessageType"] = CreateStatic("Barotrauma.Networking.TraitorMessageType")
|
||||
defaultLib["CombatMode"] = CreateStatic("Barotrauma.AIObjectiveCombat+CombatMode")
|
||||
defaultLib["CauseOfDeathType"] = CreateStatic("Barotrauma.CauseOfDeathType")
|
||||
defaultLib["CharacterTeamType"] = CreateStatic("Barotrauma.CharacterTeamType")
|
||||
|
||||
defaultLib["ClientPermissions"] = {
|
||||
None = 0x0,
|
||||
ManageRound = 0x1,
|
||||
@@ -53,58 +54,94 @@ defaultLib["ClientPermissions"] = {
|
||||
KarmaImmunity = 0x800,
|
||||
All = 0xFFF
|
||||
}
|
||||
defaultLib["Signal"] = CreateStatic("Items.Components.Signal")
|
||||
defaultLib["DeliveryMethod"] = CreateStatic("Networking.DeliveryMethod")
|
||||
defaultLib["ClientPacketHeader"] = CreateStatic("Networking.ClientPacketHeader")
|
||||
defaultLib["ServerPacketHeader"] = CreateStatic("Networking.ServerPacketHeader")
|
||||
defaultLib["RandSync"] = CreateStatic("Rand+RandSync")
|
||||
defaultLib["SubmarineInfo"] = CreateStatic("SubmarineInfo")
|
||||
defaultLib["Rectangle"] = LuaUserData.CreateStatic("Microsoft.Xna.Framework.Rectangle")
|
||||
defaultLib["Entity"] = CreateStatic("Entity")
|
||||
defaultLib["Physics"] = CreateStatic("Physics")
|
||||
defaultLib["FireSource"] = CreateStatic("FireSource")
|
||||
defaultLib["TextManager"] = CreateStatic("TextManager")
|
||||
defaultLib["NetEntityEvent"] = CreateStatic("Networking.NetEntityEvent")
|
||||
|
||||
defaultLib["AIObjective"] = CreateStatic("AIObjective")
|
||||
defaultLib["AIObjectiveChargeBatteries"] = CreateStatic("AIObjectiveChargeBatteries")
|
||||
defaultLib["AIObjectiveCleanupItem"] = CreateStatic("AIObjectiveCleanupItem")
|
||||
defaultLib["AIObjectiveCleanupItems"] = CreateStatic("AIObjectiveCleanupItems")
|
||||
defaultLib["AIObjectiveCombat"] = CreateStatic("AIObjectiveCombat")
|
||||
defaultLib["AIObjectiveContainItem"] = CreateStatic("AIObjectiveContainItem")
|
||||
defaultLib["AIObjectiveDecontainItem"] = CreateStatic("AIObjectiveDecontainItem")
|
||||
defaultLib["AIObjectiveEscapeHandcuffs"] = CreateStatic("AIObjectiveEscapeHandcuffs")
|
||||
defaultLib["AIObjectiveExtinguishFire"] = CreateStatic("AIObjectiveExtinguishFire")
|
||||
defaultLib["AIObjectiveExtinguishFires"] = CreateStatic("AIObjectiveExtinguishFires")
|
||||
defaultLib["AIObjectiveFightIntruders"] = CreateStatic("AIObjectiveFightIntruders")
|
||||
defaultLib["AIObjectiveFindDivingGear"] = CreateStatic("AIObjectiveFindDivingGear")
|
||||
defaultLib["AIObjectiveFindSafety"] = CreateStatic("AIObjectiveFindSafety")
|
||||
defaultLib["AIObjectiveFixLeak"] = CreateStatic("AIObjectiveFixLeak")
|
||||
defaultLib["AIObjectiveFixLeaks"] = CreateStatic("AIObjectiveFixLeaks")
|
||||
defaultLib["AIObjectiveGetItem"] = CreateStatic("AIObjectiveGetItem")
|
||||
defaultLib["AIObjectiveGoTo"] = CreateStatic("AIObjectiveGoTo")
|
||||
defaultLib["AIObjectiveIdle"] = CreateStatic("AIObjectiveIdle")
|
||||
defaultLib["AIObjectiveOperateItem"] = CreateStatic("AIObjectiveOperateItem")
|
||||
defaultLib["AIObjectiveOperateItem"] = CreateStatic("AIObjectiveOperateItem")
|
||||
defaultLib["AIObjectivePumpWater"] = CreateStatic("AIObjectivePumpWater")
|
||||
defaultLib["AIObjectiveRepairItem"] = CreateStatic("AIObjectiveRepairItem")
|
||||
defaultLib["AIObjectiveRepairItems"] = CreateStatic("AIObjectiveRepairItems")
|
||||
defaultLib["AIObjectiveRescue"] = CreateStatic("AIObjectiveRescue")
|
||||
defaultLib["AIObjectiveRescueAll"] = CreateStatic("AIObjectiveRescueAll")
|
||||
defaultLib["AIObjectiveReturn"] = CreateStatic("AIObjectiveReturn")
|
||||
defaultLib["CombatMode"] = CreateStatic("AIObjectiveCombat+CombatMode")
|
||||
|
||||
defaultLib["DisconnectReason"] = CreateStatic("Networking.DisconnectReason")
|
||||
defaultLib["WayPoint"] = CreateStatic("Barotrauma.WayPoint", true)
|
||||
defaultLib["Submarine"] = CreateStatic("Barotrauma.Submarine", true)
|
||||
defaultLib["Client"] = CreateStatic("Barotrauma.Networking.Client", true)
|
||||
defaultLib["Character"] = CreateStatic("Barotrauma.Character")
|
||||
defaultLib["CharacterInfo"] = CreateStatic("Barotrauma.CharacterInfo", true)
|
||||
defaultLib["Item"] = CreateStatic("Barotrauma.Item", true)
|
||||
defaultLib["ItemPrefab"] = CreateStatic("Barotrauma.ItemPrefab", true)
|
||||
defaultLib["Level"] = CreateStatic("Barotrauma.Level")
|
||||
defaultLib["Job"] = CreateStatic("Barotrauma.Job", true)
|
||||
defaultLib["JobPrefab"] = CreateStatic("Barotrauma.JobPrefab", true)
|
||||
defaultLib["AfflictionPrefab"] = CreateStatic("Barotrauma.AfflictionPrefab", true)
|
||||
defaultLib["ChatMessage"] = CreateStatic("Barotrauma.Networking.ChatMessage")
|
||||
defaultLib["Hull"] = CreateStatic("Barotrauma.Hull", true)
|
||||
defaultLib["Gap"] = CreateStatic("Barotrauma.Gap", true)
|
||||
defaultLib["ContentPackage"] = CreateStatic("Barotrauma.ContentPackage", true)
|
||||
defaultLib["Signal"] = CreateStatic("Barotrauma.Items.Components.Signal", true)
|
||||
defaultLib["SubmarineInfo"] = CreateStatic("Barotrauma.SubmarineInfo", true)
|
||||
defaultLib["Entity"] = CreateStatic("Barotrauma.Entity", true)
|
||||
defaultLib["Physics"] = CreateStatic("Barotrauma.Physics")
|
||||
defaultLib["FireSource"] = CreateStatic("Barotrauma.FireSource", true)
|
||||
defaultLib["TextManager"] = CreateStatic("Barotrauma.TextManager")
|
||||
defaultLib["NetEntityEvent"] = CreateStatic("Barotrauma.Networking.NetEntityEvent")
|
||||
defaultLib["Screen"] = CreateStatic("Barotrauma.Screen")
|
||||
|
||||
defaultLib["AIObjective"] = CreateStatic("Barotrauma.AIObjective", true)
|
||||
defaultLib["AIObjectiveChargeBatteries"] = CreateStatic("Barotrauma.AIObjectiveChargeBatteries", true)
|
||||
defaultLib["AIObjectiveCleanupItem"] = CreateStatic("Barotrauma.AIObjectiveCleanupItem", true)
|
||||
defaultLib["AIObjectiveCleanupItems"] = CreateStatic("Barotrauma.AIObjectiveCleanupItems", true)
|
||||
defaultLib["AIObjectiveCombat"] = CreateStatic("Barotrauma.AIObjectiveCombat", true)
|
||||
defaultLib["AIObjectiveContainItem"] = CreateStatic("Barotrauma.AIObjectiveContainItem", true)
|
||||
defaultLib["AIObjectiveDecontainItem"] = CreateStatic("Barotrauma.AIObjectiveDecontainItem", true)
|
||||
defaultLib["AIObjectiveEscapeHandcuffs"] = CreateStatic("Barotrauma.AIObjectiveEscapeHandcuffs", true)
|
||||
defaultLib["AIObjectiveExtinguishFire"] = CreateStatic("Barotrauma.AIObjectiveExtinguishFire", true)
|
||||
defaultLib["AIObjectiveExtinguishFires"] = CreateStatic("Barotrauma.AIObjectiveExtinguishFires", true)
|
||||
defaultLib["AIObjectiveFightIntruders"] = CreateStatic("Barotrauma.AIObjectiveFightIntruders", true)
|
||||
defaultLib["AIObjectiveFindDivingGear"] = CreateStatic("Barotrauma.AIObjectiveFindDivingGear", true)
|
||||
defaultLib["AIObjectiveFindSafety"] = CreateStatic("Barotrauma.AIObjectiveFindSafety", true)
|
||||
defaultLib["AIObjectiveFixLeak"] = CreateStatic("Barotrauma.AIObjectiveFixLeak", true)
|
||||
defaultLib["AIObjectiveFixLeaks"] = CreateStatic("Barotrauma.AIObjectiveFixLeaks", true)
|
||||
defaultLib["AIObjectiveGetItem"] = CreateStatic("Barotrauma.AIObjectiveGetItem", true)
|
||||
defaultLib["AIObjectiveGoTo"] = CreateStatic("Barotrauma.AIObjectiveGoTo", true)
|
||||
defaultLib["AIObjectiveIdle"] = CreateStatic("Barotrauma.AIObjectiveIdle", true)
|
||||
defaultLib["AIObjectiveOperateItem"] = CreateStatic("Barotrauma.AIObjectiveOperateItem", true)
|
||||
defaultLib["AIObjectiveOperateItem"] = CreateStatic("Barotrauma.AIObjectiveOperateItem", true)
|
||||
defaultLib["AIObjectivePumpWater"] = CreateStatic("Barotrauma.AIObjectivePumpWater", true)
|
||||
defaultLib["AIObjectiveRepairItem"] = CreateStatic("Barotrauma.AIObjectiveRepairItem", true)
|
||||
defaultLib["AIObjectiveRepairItems"] = CreateStatic("Barotrauma.AIObjectiveRepairItems", true)
|
||||
defaultLib["AIObjectiveRescue"] = CreateStatic("Barotrauma.AIObjectiveRescue", true)
|
||||
defaultLib["AIObjectiveRescueAll"] = CreateStatic("Barotrauma.AIObjectiveRescueAll", true)
|
||||
defaultLib["AIObjectiveReturn"] = CreateStatic("Barotrauma.AIObjectiveReturn", true)
|
||||
|
||||
defaultLib["Vector2"] = CreateStatic("Microsoft.Xna.Framework.Vector2")
|
||||
defaultLib["Vector3"] = CreateStatic("Microsoft.Xna.Framework.Vector3", true)
|
||||
defaultLib["Vector4"] = CreateStatic("Microsoft.Xna.Framework.Vector4", true)
|
||||
defaultLib["Color"] = CreateStatic("Microsoft.Xna.Framework.Color", true)
|
||||
defaultLib["Point"] = CreateStatic("Microsoft.Xna.Framework.Point", true)
|
||||
defaultLib["Rectangle"] = CreateStatic("Microsoft.Xna.Framework.Rectangle", true)
|
||||
|
||||
if SERVER then
|
||||
|
||||
elseif CLIENT then
|
||||
defaultLib["Sprite"] = CreateStatic("Sprite")
|
||||
defaultLib["Keys"] = LuaUserData.CreateStatic("Microsoft.Xna.Framework.Input.Keys")
|
||||
defaultLib["PlayerInput"] = CreateStatic("PlayerInput")
|
||||
defaultLib["Sprite"] = CreateStatic("Barotrauma.Sprite", true)
|
||||
defaultLib["PlayerInput"] = CreateStatic("Barotrauma.PlayerInput", true)
|
||||
|
||||
GUI.CreateStaticValues()
|
||||
defaultLib["Keys"] = CreateStatic("Microsoft.Xna.Framework.Input.Keys", true)
|
||||
|
||||
defaultLib["GUI"] = {
|
||||
RectTransform = CreateStatic("Barotrauma.RectTransform, true", true),
|
||||
LayoutGroup = CreateStatic("Barotrauma.GUILayoutGroup", true),
|
||||
Button = CreateStatic("Barotrauma.GUIButton", true),
|
||||
TextBox = CreateStatic("Barotrauma.GUITextBox", true),
|
||||
Canvas = CreateStatic("Barotrauma.GUICanvas", true),
|
||||
Frame = CreateStatic("Barotrauma.GUIFrame", true),
|
||||
TextBlock = CreateStatic("Barotrauma.GUITextBlock", true),
|
||||
TickBox = CreateStatic("Barotrauma.GUITickBox", true),
|
||||
Image = CreateStatic("Barotrauma.GUIImage", true),
|
||||
ListBox = CreateStatic("Barotrauma.GUIListBox", true),
|
||||
ScrollBar = CreateStatic("Barotrauma.GUIScrollBar", true),
|
||||
DropDown = CreateStatic("Barotrauma.GUIDropDown", true),
|
||||
|
||||
Screen = CreateStatic("Barotrauma.Screen"),
|
||||
|
||||
Anchor = CreateStatic("Barotrauma.Anchor"),
|
||||
Alignment = CreateStatic("Barotrauma.Alignment"),
|
||||
Pivot = CreateStatic("Barotrauma.Pivot"),
|
||||
}
|
||||
end
|
||||
|
||||
return defaultLib
|
||||
|
||||
@@ -2,14 +2,16 @@ local function RegisterBarotrauma(typeName)
|
||||
return LuaUserData.RegisterType("Barotrauma." .. typeName)
|
||||
end
|
||||
|
||||
local AddCallMetaMember = LuaUserData.AddCallMetaMember
|
||||
|
||||
LuaUserData.RegisterType("System.TimeSpan")
|
||||
|
||||
if SERVER then
|
||||
RegisterBarotrauma("Networking.GameServer")
|
||||
end
|
||||
|
||||
RegisterBarotrauma("LuaByte")
|
||||
RegisterBarotrauma("LuaUShort")
|
||||
RegisterBarotrauma("LuaFloat")
|
||||
|
||||
RegisterBarotrauma("CauseOfDeathType")
|
||||
RegisterBarotrauma("Level+InterestingPosition")
|
||||
RegisterBarotrauma("Level+PositionType")
|
||||
@@ -18,7 +20,7 @@ RegisterBarotrauma("SpawnType")
|
||||
RegisterBarotrauma("Networking.ChatMessageType")
|
||||
RegisterBarotrauma("InputType")
|
||||
|
||||
AddCallMetaMember(RegisterBarotrauma("Job"))
|
||||
RegisterBarotrauma("Job")
|
||||
RegisterBarotrauma("JobPrefab")
|
||||
RegisterBarotrauma("Level")
|
||||
RegisterBarotrauma("Networking.ServerLog+MessageType")
|
||||
@@ -64,7 +66,7 @@ RegisterBarotrauma("Networking.ServerSettings")
|
||||
RegisterBarotrauma("Networking.ServerSettings+SavedClientPermission")
|
||||
RegisterBarotrauma("Inventory")
|
||||
RegisterBarotrauma("ItemInventory")
|
||||
AddCallMetaMember(RegisterBarotrauma("FireSource"))
|
||||
RegisterBarotrauma("FireSource")
|
||||
|
||||
RegisterBarotrauma("Items.Components.Connection")
|
||||
RegisterBarotrauma("Items.Components.Fabricator")
|
||||
@@ -129,32 +131,32 @@ RegisterBarotrauma("AITrigger")
|
||||
RegisterBarotrauma("WreckAI")
|
||||
RegisterBarotrauma("WreckAIConfig")
|
||||
|
||||
AddCallMetaMember(RegisterBarotrauma("AIObjective"))
|
||||
AddCallMetaMember(RegisterBarotrauma("AIObjectiveChargeBatteries"))
|
||||
AddCallMetaMember(RegisterBarotrauma("AIObjectiveCleanupItem"))
|
||||
AddCallMetaMember(RegisterBarotrauma("AIObjectiveCleanupItems"))
|
||||
AddCallMetaMember(RegisterBarotrauma("AIObjectiveCombat"))
|
||||
AddCallMetaMember(RegisterBarotrauma("AIObjectiveContainItem"))
|
||||
AddCallMetaMember(RegisterBarotrauma("AIObjectiveDecontainItem"))
|
||||
AddCallMetaMember(RegisterBarotrauma("AIObjectiveEscapeHandcuffs"))
|
||||
AddCallMetaMember(RegisterBarotrauma("AIObjectiveExtinguishFire"))
|
||||
AddCallMetaMember(RegisterBarotrauma("AIObjectiveExtinguishFires"))
|
||||
AddCallMetaMember(RegisterBarotrauma("AIObjectiveFightIntruders"))
|
||||
AddCallMetaMember(RegisterBarotrauma("AIObjectiveFindDivingGear"))
|
||||
AddCallMetaMember(RegisterBarotrauma("AIObjectiveFindSafety"))
|
||||
AddCallMetaMember(RegisterBarotrauma("AIObjectiveFixLeak"))
|
||||
AddCallMetaMember(RegisterBarotrauma("AIObjectiveFixLeaks"))
|
||||
AddCallMetaMember(RegisterBarotrauma("AIObjectiveGetItem"))
|
||||
AddCallMetaMember(RegisterBarotrauma("AIObjectiveGoTo"))
|
||||
AddCallMetaMember(RegisterBarotrauma("AIObjectiveIdle"))
|
||||
AddCallMetaMember(RegisterBarotrauma("AIObjectiveOperateItem"))
|
||||
AddCallMetaMember(RegisterBarotrauma("AIObjectiveOperateItem"))
|
||||
AddCallMetaMember(RegisterBarotrauma("AIObjectivePumpWater"))
|
||||
AddCallMetaMember(RegisterBarotrauma("AIObjectiveRepairItem"))
|
||||
AddCallMetaMember(RegisterBarotrauma("AIObjectiveRepairItems"))
|
||||
AddCallMetaMember(RegisterBarotrauma("AIObjectiveRescue"))
|
||||
AddCallMetaMember(RegisterBarotrauma("AIObjectiveRescueAll"))
|
||||
AddCallMetaMember(RegisterBarotrauma("AIObjectiveReturn"))
|
||||
RegisterBarotrauma("AIObjectiveChargeBatteries")
|
||||
RegisterBarotrauma("AIObjective")
|
||||
RegisterBarotrauma("AIObjectiveCleanupItem")
|
||||
RegisterBarotrauma("AIObjectiveCleanupItems")
|
||||
RegisterBarotrauma("AIObjectiveCombat")
|
||||
RegisterBarotrauma("AIObjectiveContainItem")
|
||||
RegisterBarotrauma("AIObjectiveDecontainItem")
|
||||
RegisterBarotrauma("AIObjectiveEscapeHandcuffs")
|
||||
RegisterBarotrauma("AIObjectiveExtinguishFire")
|
||||
RegisterBarotrauma("AIObjectiveExtinguishFires")
|
||||
RegisterBarotrauma("AIObjectiveFightIntruders")
|
||||
RegisterBarotrauma("AIObjectiveFindDivingGear")
|
||||
RegisterBarotrauma("AIObjectiveFindSafety")
|
||||
RegisterBarotrauma("AIObjectiveFixLeak")
|
||||
RegisterBarotrauma("AIObjectiveFixLeaks")
|
||||
RegisterBarotrauma("AIObjectiveGetItem")
|
||||
RegisterBarotrauma("AIObjectiveGoTo")
|
||||
RegisterBarotrauma("AIObjectiveIdle")
|
||||
RegisterBarotrauma("AIObjectiveOperateItem")
|
||||
RegisterBarotrauma("AIObjectiveOperateItem")
|
||||
RegisterBarotrauma("AIObjectivePumpWater")
|
||||
RegisterBarotrauma("AIObjectiveRepairItem")
|
||||
RegisterBarotrauma("AIObjectiveRepairItems")
|
||||
RegisterBarotrauma("AIObjectiveRescue")
|
||||
RegisterBarotrauma("AIObjectiveRescueAll")
|
||||
RegisterBarotrauma("AIObjectiveReturn")
|
||||
RegisterBarotrauma("AIObjectiveCombat+CombatMode")
|
||||
|
||||
RegisterBarotrauma("TalentPrefab")
|
||||
@@ -224,19 +226,19 @@ RegisterBarotrauma("Pair`2[[Barotrauma.JobPrefab],[System.Int32]]")
|
||||
|
||||
RegisterBarotrauma("Range`1[System.Single]")
|
||||
|
||||
AddCallMetaMember(RegisterBarotrauma("CharacterInfo"))
|
||||
AddCallMetaMember(RegisterBarotrauma("Items.Components.Signal"))
|
||||
AddCallMetaMember(RegisterBarotrauma("SubmarineInfo"))
|
||||
RegisterBarotrauma("CharacterInfo")
|
||||
RegisterBarotrauma("Items.Components.Signal")
|
||||
RegisterBarotrauma("SubmarineInfo")
|
||||
|
||||
RegisterBarotrauma("MapCreatures.Behavior.BallastFloraBehavior")
|
||||
RegisterBarotrauma("MapCreatures.Behavior.BallastFloraBranch")
|
||||
|
||||
AddCallMetaMember(LuaUserData.RegisterType("Microsoft.Xna.Framework.Vector2"))
|
||||
AddCallMetaMember(LuaUserData.RegisterType("Microsoft.Xna.Framework.Vector3"))
|
||||
AddCallMetaMember(LuaUserData.RegisterType("Microsoft.Xna.Framework.Vector4"))
|
||||
AddCallMetaMember(LuaUserData.RegisterType("Microsoft.Xna.Framework.Color"))
|
||||
AddCallMetaMember(LuaUserData.RegisterType("Microsoft.Xna.Framework.Point"))
|
||||
AddCallMetaMember(LuaUserData.RegisterType("Microsoft.Xna.Framework.Rectangle"))
|
||||
LuaUserData.RegisterType("Microsoft.Xna.Framework.Vector2")
|
||||
LuaUserData.RegisterType("Microsoft.Xna.Framework.Vector3")
|
||||
LuaUserData.RegisterType("Microsoft.Xna.Framework.Vector4")
|
||||
LuaUserData.RegisterType("Microsoft.Xna.Framework.Color")
|
||||
LuaUserData.RegisterType("Microsoft.Xna.Framework.Point")
|
||||
LuaUserData.RegisterType("Microsoft.Xna.Framework.Rectangle")
|
||||
|
||||
if SERVER then
|
||||
RegisterBarotrauma("Networking.ServerPeer")
|
||||
@@ -262,18 +264,18 @@ LuaUserData.RegisterType("Microsoft.Xna.Framework.Graphics.Texture2D")
|
||||
LuaUserData.RegisterType("EventInput.KeyEventArgs")
|
||||
LuaUserData.RegisterType("Microsoft.Xna.Framework.Input.Keys")
|
||||
|
||||
AddCallMetaMember(RegisterBarotrauma("Sprite"))
|
||||
AddCallMetaMember(RegisterBarotrauma("GUILayoutGroup"))
|
||||
AddCallMetaMember(RegisterBarotrauma("GUITextBox"))
|
||||
AddCallMetaMember(RegisterBarotrauma("GUITextBlock"))
|
||||
AddCallMetaMember(RegisterBarotrauma("GUIButton"))
|
||||
AddCallMetaMember(RegisterBarotrauma("RectTransform"))
|
||||
AddCallMetaMember(RegisterBarotrauma("GUIFrame"))
|
||||
AddCallMetaMember(RegisterBarotrauma("GUITickBox"))
|
||||
AddCallMetaMember(RegisterBarotrauma("GUICustomComponent"))
|
||||
AddCallMetaMember(RegisterBarotrauma("GUIImage"))
|
||||
AddCallMetaMember(RegisterBarotrauma("GUIListBox"))
|
||||
AddCallMetaMember(RegisterBarotrauma("GUIScrollBar"))
|
||||
AddCallMetaMember(RegisterBarotrauma("GUIDropDown"))
|
||||
RegisterBarotrauma("Sprite")
|
||||
RegisterBarotrauma("GUILayoutGroup")
|
||||
RegisterBarotrauma("GUITextBox")
|
||||
RegisterBarotrauma("GUITextBlock")
|
||||
RegisterBarotrauma("GUIButton")
|
||||
RegisterBarotrauma("RectTransform")
|
||||
RegisterBarotrauma("GUIFrame")
|
||||
RegisterBarotrauma("GUITickBox")
|
||||
RegisterBarotrauma("GUICustomComponent")
|
||||
RegisterBarotrauma("GUIImage")
|
||||
RegisterBarotrauma("GUIListBox")
|
||||
RegisterBarotrauma("GUIScrollBar")
|
||||
RegisterBarotrauma("GUIDropDown")
|
||||
|
||||
end
|
||||
@@ -17,7 +17,6 @@ using System.Diagnostics;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
|
||||
partial class LuaSetup
|
||||
{
|
||||
partial class LuaUserData
|
||||
@@ -39,6 +38,12 @@ namespace Barotrauma
|
||||
{
|
||||
Type type = GetType(typeName);
|
||||
|
||||
if (type == null)
|
||||
{
|
||||
GameMain.Lua.HandleLuaException(new Exception($"Tried to register a type that doesn't exist: {typeName}."));
|
||||
return null;
|
||||
}
|
||||
|
||||
MethodInfo method = typeof(UserData).GetMethod(nameof(UserData.RegisterType), new Type[2] { typeof(InteropAccessMode), typeof(string) });
|
||||
MethodInfo generic = method.MakeGenericMethod(type);
|
||||
return (IUserDataDescriptor)generic.Invoke(null, new object[] { null, null });
|
||||
@@ -48,6 +53,12 @@ namespace Barotrauma
|
||||
{
|
||||
Type type = GetType(typeName);
|
||||
|
||||
if (type == null)
|
||||
{
|
||||
GameMain.Lua.HandleLuaException(new Exception($"Tried to unregister a type that doesn't exist: {typeName}."));
|
||||
return;
|
||||
}
|
||||
|
||||
MethodInfo method = typeof(UserData).GetMethod(nameof(UserData.UnregisterType), new Type[2] { typeof(InteropAccessMode), typeof(string) });
|
||||
MethodInfo generic = method.MakeGenericMethod(type);
|
||||
generic.Invoke(null, new object[] { null, null });
|
||||
@@ -82,18 +93,17 @@ namespace Barotrauma
|
||||
{
|
||||
Type type = GetType(typeName);
|
||||
|
||||
if (type == null)
|
||||
{
|
||||
GameMain.Lua.HandleLuaException(new Exception($"Tried to create a static userdata of a type that doesn't exist: {typeName}."));
|
||||
return null;
|
||||
}
|
||||
|
||||
MethodInfo method = typeof(UserData).GetMethod(nameof(UserData.CreateStatic), 1, new Type[0]);
|
||||
MethodInfo generic = method.MakeGenericMethod(type);
|
||||
return generic.Invoke(null, null);
|
||||
}
|
||||
|
||||
public static void AddCallMetaMember(IUserDataDescriptor IUDD)
|
||||
{
|
||||
var descriptor = (StandardUserDataDescriptor)IUDD;
|
||||
descriptor.RemoveMetaMember("__call");
|
||||
descriptor.AddMetaMember("__call", new ObjectCallbackMemberDescriptor("__call", LuaSetup.luaSetup.HandleCall));
|
||||
}
|
||||
|
||||
public static void MakeFieldAccessible(IUserDataDescriptor IUUD, string fieldName)
|
||||
{
|
||||
var descriptor = (StandardUserDataDescriptor)IUUD;
|
||||
|
||||
@@ -5,56 +5,4 @@ using Barotrauma.Networking;
|
||||
namespace Barotrauma
|
||||
{
|
||||
|
||||
partial class LuaSetup
|
||||
{
|
||||
public class LuaWriteOnlyMessage
|
||||
{
|
||||
private WriteOnlyMessage target;
|
||||
|
||||
[MoonSharpHidden]
|
||||
public LuaWriteOnlyMessage(WriteOnlyMessage p)
|
||||
{
|
||||
target = p;
|
||||
}
|
||||
|
||||
public void WriteByte(byte v) => target.Write(v);
|
||||
public void WriteUShort(ushort v) => target.Write(v);
|
||||
|
||||
public void Write(bool val) => target.Write(val);
|
||||
public void WritePadBits() => target.WritePadBits();
|
||||
public void Write(byte val) => target.Write(val);
|
||||
public void Write(Int16 val) => target.Write(val);
|
||||
public void Write(UInt16 val) => target.Write(val);
|
||||
public void Write(Int32 val) => target.Write(val);
|
||||
public void Write(UInt32 val) => target.Write(val);
|
||||
public void Write(Int64 val) => target.Write(val);
|
||||
public void Write(UInt64 val) => target.Write(val);
|
||||
public void Write(Single val) => target.Write(val);
|
||||
public void Write(Double val) => target.Write(val);
|
||||
public void WriteColorR8G8B8(Microsoft.Xna.Framework.Color val) => target.WriteColorR8G8B8(val);
|
||||
public void WriteColorR8G8B8A8(Microsoft.Xna.Framework.Color val) => target.WriteColorR8G8B8A8(val);
|
||||
public void WriteVariableUInt32(UInt32 val) => target.WriteVariableUInt32(val);
|
||||
public void Write(string val) => target.Write(val);
|
||||
public void WriteRangedInteger(int val, int min, int max) => target.WriteRangedInteger(val, min, max);
|
||||
public void WriteRangedSingle(Single val, Single min, Single max, int bitCount) => target.WriteRangedSingle(val, min, max, bitCount);
|
||||
public void Write(byte[] val, int startIndex, int length) => target.Write(val, startIndex, length);
|
||||
|
||||
public void PrepareForSending(ref byte[] outBuf, out bool isCompressed, out int outLength) => target.PrepareForSending(ref outBuf, out isCompressed, out outLength);
|
||||
|
||||
public int BitPosition
|
||||
{
|
||||
get { return target.BitPosition; }
|
||||
set { target.BitPosition = value; }
|
||||
}
|
||||
public int BytePosition => target.BytePosition;
|
||||
public byte[] Buffer => target.Buffer;
|
||||
public int LengthBits
|
||||
{
|
||||
get { return target.LengthBits; }
|
||||
set { target.LengthBits = value; }
|
||||
}
|
||||
public int LengthBytes => target.LengthBytes;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -222,41 +222,6 @@ namespace Barotrauma
|
||||
return value * 2;
|
||||
}
|
||||
|
||||
// messy solution
|
||||
public object HandleCall(object arg1, ScriptExecutionContext arg2, CallbackArguments arg3)
|
||||
{
|
||||
|
||||
var what = arg3.RawGet(0, true);
|
||||
|
||||
var code = "return " + what.UserData.Descriptor.Type.Name + ".__new(";
|
||||
|
||||
var tbl = new Table(lua);
|
||||
tbl[what.UserData.Descriptor.Type.Name] = what;
|
||||
|
||||
for(var i=1; i < arg3.Count; i++)
|
||||
{
|
||||
if (i == arg3.Count - 1)
|
||||
code = code + "arg" + i;
|
||||
else
|
||||
code = code + "arg" + i + ",";
|
||||
|
||||
tbl["arg" + i] = arg3.RawGet(i, true);
|
||||
}
|
||||
|
||||
code = code + ")";
|
||||
|
||||
try
|
||||
{
|
||||
return lua.DoString(code, tbl);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
HandleLuaException(e);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
#if SERVER
|
||||
public static void InstallClientSideLua()
|
||||
@@ -324,7 +289,7 @@ namespace Barotrauma
|
||||
|
||||
LuaCustomConverters.RegisterAll();
|
||||
|
||||
lua = new Script(CoreModules.Preset_SoftSandbox);
|
||||
lua = new Script(CoreModules.Preset_SoftSandbox | CoreModules.Debug);
|
||||
lua.Options.DebugPrint = PrintMessage;
|
||||
lua.Options.ScriptLoader = luaScriptLoader;
|
||||
|
||||
@@ -344,14 +309,6 @@ namespace Barotrauma
|
||||
UserData.RegisterType<LuaUserData>();
|
||||
UserData.RegisterType<IUserDataDescriptor>();
|
||||
|
||||
UserData.RegisterProxyType<LuaWriteOnlyMessage, WriteOnlyMessage>(r => new LuaWriteOnlyMessage(r));
|
||||
|
||||
#if SERVER
|
||||
|
||||
#elif CLIENT
|
||||
UserData.RegisterType<LuaGUI>();
|
||||
#endif
|
||||
|
||||
lua.Globals["setmodulepaths"] = (Action<string[]>)SetModulePaths;
|
||||
|
||||
lua.Globals["TestFunction"] = (Func<float, float>)TestFunction;
|
||||
@@ -364,7 +321,7 @@ namespace Barotrauma
|
||||
|
||||
lua.Globals["dostring"] = (Func<string, Table, string, DynValue>)DoString;
|
||||
lua.Globals["load"] = (Func<string, Table, string, DynValue>)LoadString;
|
||||
|
||||
|
||||
lua.Globals["LuaUserData"] = UserData.CreateStatic<LuaUserData>();
|
||||
lua.Globals["Game"] = game;
|
||||
lua.Globals["Hook"] = hook;
|
||||
@@ -373,12 +330,6 @@ namespace Barotrauma
|
||||
lua.Globals["File"] = UserData.CreateStatic<LuaFile>();
|
||||
lua.Globals["Networking"] = networking;
|
||||
|
||||
#if SERVER
|
||||
|
||||
#elif CLIENT
|
||||
lua.Globals["GUI"] = new LuaGUI(this);
|
||||
#endif
|
||||
|
||||
bool isServer = true;
|
||||
|
||||
#if SERVER
|
||||
@@ -397,7 +348,7 @@ namespace Barotrauma
|
||||
else if (File.Exists("Mods/LuaForBarotrauma/Lua/LuaSetup.lua")) // in case its the workshop version
|
||||
DoFile("Mods/LuaForBarotrauma/Lua/LuaSetup.lua");
|
||||
else
|
||||
PrintError("Lua loader not found! Lua/LuaSetup.lua, no lua scripts will be executed or work.");
|
||||
PrintError("Lua loader not found! Lua/LuaSetup.lua, no Lua scripts will be executed or work.");
|
||||
}
|
||||
|
||||
public LuaSetup()
|
||||
|
||||
41
Barotrauma/BarotraumaShared/SharedSource/Lua/LuaTypes.cs
Normal file
41
Barotrauma/BarotraumaShared/SharedSource/Lua/LuaTypes.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
public class LuaByte
|
||||
{
|
||||
public byte Value;
|
||||
|
||||
public LuaByte(byte v)
|
||||
{
|
||||
Value = v;
|
||||
}
|
||||
|
||||
public static implicit operator byte(LuaByte lb) => lb.Value;
|
||||
}
|
||||
|
||||
public class LuaUShort
|
||||
{
|
||||
public ushort Value;
|
||||
|
||||
public LuaUShort(ushort v)
|
||||
{
|
||||
Value = v;
|
||||
}
|
||||
|
||||
public static implicit operator ushort(LuaUShort lb) => lb.Value;
|
||||
}
|
||||
|
||||
public class LuaFloat
|
||||
{
|
||||
public float Value;
|
||||
|
||||
public LuaFloat(float v)
|
||||
{
|
||||
Value = v;
|
||||
}
|
||||
|
||||
public static implicit operator float(LuaFloat lb) => lb.Value;
|
||||
}
|
||||
}
|
||||
BIN
Libraries/MoonSharp.Interpreter.dll
Normal file
BIN
Libraries/MoonSharp.Interpreter.dll
Normal file
Binary file not shown.
Reference in New Issue
Block a user